3

I have trained my own dataset of images (traffic light images 11x27) with LeNet, using caffe and DIGITS interface. I get 99% accuracy and when I give new images via DIGITS, it predicts the good label, so the network seems to work very well.

However, I struggle to predict the labels through Python/Matlab API for caffe. The last layer output (ip2) is a vector with 2 elements (I have 2 classes), which looks like [4.8060, -5.2608] for example (the first component is always positive, the second always negative and the absolute values range from 4 to 20). I know it from many tests in Python, Matlab and DIGITS.

My problem is :

  • Argmax can't work directly on this layer (it always gives 0)
  • If I use a softmax function, it will always give me [1, 0] (and that's actually the value of net.blobs['prob'] or out['prob'] in the python interface, no matter the class of my image)

So, how can I get the good label predicted ?

Thanks!

Arthur Pesah
  • 235
  • 2
  • 9
  • 2
    it seems like your net gives a constant prediction of "0". How many "0" examples and how many "1" examples do you have in your test set? Do you feed the net with an image that underwent **exactly** the same transformation as the training images? do you subtract the mean, crop and resize in the exact same way? – Shai Jan 04 '16 at 06:57
  • 1
    I thought the mean was automatically substracted by the layer "data" (by the transform_param of the prototxt), but indeed, it's absolutely not, and when I do, it works perfectly! Thank you very much! – Arthur Pesah Jan 04 '16 at 23:04

0 Answers0