Hi Everyone,
I'm new to Caffe and trying to determine if I can get the same output for python and c++ feature extraction. I ran the example C++ feature extraction over the fish-bike.jpg
I get an array like:
[ 0. 0. 1.52356386 ..., 0. 0. 0. ]
However, when I do feature extraction in python my feature array looks like:
net.predict([caffe.io.load_image('examples/images/fish-bike.jpg')], oversample=False)
features = copy.deepcopy(net.blobs['fc7'].data[0])
print (features)
[ 0. 0. 2.89886808 ..., 0. 0. 0. ]
I think it has something to do with differences between the imagenet_val.prototext transformation params and the configuration I'm using for the python Classifier:
transform_param {
mirror: false
crop_size: 227
mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
}
image_data_param {
source: "examples/_temp/file_list.txt"
batch_size: 50
new_height: 256
new_width: 256
}
vs
net = caffe.Classifier(MODEL_FILE,
PRETRAINED,
mean=np.load(MEAN).mean(1).mean(1),
input_scale=1.0, raw_scale=255,
channel_swap=(2,1,0),
image_dims=(227, 227))
Does anyone know the mapping between new_height, new_width and crop size and the corresponding Classifier parameters?
Thanks,
Brant