sh1r0 / caffe-android-demo

An android caffe demo app exploiting caffe pre-trained ImageNet model for image classification
https://github.com/sh1r0/caffe-android-lib
MIT License
255 stars 164 forks source link

Not an issue per se: Why is CaffeMobile::SetMean used? How to manipulate it to get better result if at all possible? #17

Closed rivaldo4t closed 8 years ago

rivaldo4t commented 8 years ago

Kindly let me know what this function does.

sh1r0 commented 8 years ago

As name tells, set mean values for mean subtraction. And also, code tells you the truth. Thanks.

rivaldo4t commented 8 years ago

A little weak on the concepts here. Why is mean subtraction required in evaluation of a net?

sh1r0 commented 8 years ago

IMHO, this is not weird for following the same preprocessing protocol as in the training.

sh1r0 commented 8 years ago

Note: the "mean" here is not from your test image, it's the one used in the model training.

rivaldo4t commented 8 years ago

Yes I figured that. The mean values are set to some seemingly random values in the demo code.

float[] meanValues = {104, 117, 123}; caffeMobile.setMean(meanValues);

This is what does not make sense to me. What are these values.

sh1r0 commented 8 years ago

https://github.com/BVLC/caffe/blob/master/models/bvlc_reference_caffenet/train_val.prototxt

rivaldo4t commented 8 years ago

Ok; not random. Still not clear on the WHY part.

rivaldo4t commented 8 years ago

Is it because we have trained the network on transformed images (mean subtracted) by these mean values and we must transform the test image in the same way during the evaluation phase?

sh1r0 commented 8 years ago

Exactly.

rivaldo4t commented 8 years ago

Okay, thanks.