You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So normally I ecpect to have the same feature vector for this image from these two different approach. However they are different. I compare both feature vector on Python like below to see that whether only the non-zero values are different or activated units are different too.
I believe this is not users problem since Python wrapper gives different output compared to caffe backhand. I guess something in the pycaffe preprocessing breaks the given image.
I created a single image path file_list2.txt and I give it to caffe_reference model as
layers {
name: "data"
type: IMAGE_DATA
top: "data"
top: "label"
image_data_param {
source: "file_list2.txt"
batch_size: 1
new_height: 256
new_width: 256
}
transform_param {
crop_size: 224
mean_file: "mean_file.binaryproto"
mirror: false
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
blobs_lr: 1
....
the I call extract_features.cpp as
./build/tools/extract_features.bin models/CaffeRef_iter_100000.caffemodel models/caffe_reference/train_val_feat_ext.prototxt fc7 /path/to/features 1
so it takes 1 image for 1 instance batch
Then for the same image I run following python code
net = caffe.Classifier(MODEL_FILE, "models/CaffeRef_iter_100000.caffemodel ",
mean=np.load(mean_file.npy'),
channel_swap=(2,1,0),
image_dims = [256,256],
raw_scale=255)
img_path = 'same/file/path'
img = caffe.io.load_image(img_path)
plt.imshow(img)
x = net.predict([img], oversample=False)
MODEL_FILE is same with last one except it has different data input;
input: "data"
input_dim: 10
input_dim: 3
input_dim: 224
input_dim: 224
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
convolution_param {
num_output: 96
.....
So normally I ecpect to have the same feature vector for this image from these two different approach. However they are different. I compare both feature vector on Python like below to see that whether only the non-zero values are different or activated units are different too.
X[X>0] = 1
x[x>0] = 1
print len(np.nonzero(X-x)[0])
output: 845
I guess this needs a bit of attention from the community. Please direct me to enhance the observation.
The text was updated successfully, but these errors were encountered: