soeaver / caffe-model

Caffe models (including classification, detection and segmentation) and deploy files for famouse networks
MIT License
1.28k stars 624 forks source link

Unable to get correct results from inception_v3 and v4 models #22

Closed szm-R closed 7 years ago

szm-R commented 7 years ago

Hi, Thank you for the models you have provided, I downloaded and tested resnet269-v2 and was able to get the same result as the one reported here. I use a cpp code for testing which is based on caffe classification example but not exactly the same.

The thing is I can't get one correct results using this same code with inception_v3 and v4 models. I tested inception_v4 weights with the evaluation_cls.py you have provided and it's results are OK, but the cpp code using the same version of caffe gives me very different results. Here are the top-5 predictions for the first 5 validation images: ILSVRC2012_val_00000001.JPEG 65 600 616 748 840 765 ILSVRC2012_val_00000002.JPEG 970 600 700 731 748 765 ILSVRC2012_val_00000003.JPEG 230 987 722 998 818 846 ILSVRC2012_val_00000004.JPEG 809 429 494 577 427 616 ILSVRC2012_val_00000005.JPEG 516 722 494 616 429 600

What do you think could be the reason? Thanks in advance for your help

soeaver commented 7 years ago

I think you should pay attention on image pre-processing:

  1. The RGB channel or BGR channel;
  2. The mean value and std value;
szm-R commented 7 years ago

I'm using bgr channels (which I believe are the same used by the python code) I also tested with the mean and std values provided but the results were still off. I have had experiences of different results when having different preprocessing steps but not this much! usually only the final accuracy would differ in 1 or 2 percent but here I get nearly 0% of accuracy with my code (and as I mentioned resnet269v2 works just fine with my code)

larsoncs commented 7 years ago

i used inception-v4, but the recognition is different at every time.