Caffe network getting very low loss but very bad accuracy in testing

限于喜欢 提交于 2019-12-06 06:26:41

Your code for testing the model you posted seem to miss some components:

  1. It seems like you did not subtract the image's mean.
  2. You did not swap channels from RGB to BGR.
  3. You did not scale the inputs to [0..255] range.

Looking at similar instances of caffe.Classifier you may see something like:

net = caffe.Classifier('bvlc_reference_caffenet/deploy.prototxt',
                       'bvlc_reference_caffenet/caffenet_train_iter_28000.caffemodel', 
                       mean = NP.load( 'ilsvrc_2012_mean.npy' ),
                       input_scale=1.0, raw_scale=255,
                       channel_swap=(2,1,0),
                       image_dims=(227, 227, 1))

It is crucial to have the same input transformation in test as in training.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!