question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Predefined ImageNets `predict` method is inaccurate

See original GitHub issue

Hello. I have been using Chainer predefined ImageNets (chainer.links.VGG16Layers etc.) but recently found out that they are inaccurate than one can usually expect.

Specifically, one can basically use either __call__ or predict to run inference and I think the result should be the same if an equivalent preprocessing is appropriately conducted. However in my quick experiments the results are significantly different. With VGG and GoogLeNet, __call__ performs better whereas predict works better with ResNets.

Here is Top-5 accuracy of single-image (no crop, no oversample, no ensemble) inference (I used only 2000 samples)

CNN __call__ predict
GoogLeNet 86.75% 74.1%
VGG16Layers 85.2% 74.0%
ResNet50Layers 12.7% 78.6%
ResNet101Layers 15.1% 78.75%
ResNet152Layers 14.8% 80.65%

I’m not pretty sure if it’s a chainer-side problem or just I’m doing wrong, but as far as I checked the document (and briefly read the source code) I couldn’t find that I’m doing badly.

Here is the reproduction code and the result. https://gist.github.com/belltailjp/7677987c699b2f3cf766ecc89958dff2 Run prepare.sh followed by python run.py. You can change CNN type by just comment out, and switch __call__ and predict by simply changing use_predict = False line. I confirmed this issue with the following environment: Chainer 3.0.0, Cupy 2.0.0, Ubuntu 16.04, CUDA8.0, cuDNN7, Python 3.6.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
belltailjpcommented, Nov 1, 2017

@ronekko It solved!!! It’s also a common pitfall… (of course I tried both RGB&BGR, but I changed the color order for both predict and __call__, that’s why I couldn’t notice…) This should definitely be properly documented. I will submit a small document update patch. Thanks so much @chenzhekl , too

0reactions
stale[bot]commented, Mar 1, 2018

This issue is closed as announced. Feel free to re-open it if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

wrong classification with imagenet - python - Stack Overflow
I have used VGG16 and imagenet weights to predict an image. ... orig = cv2.imread(args["image"]) #Opencv function to load a image image ...
Read more >
Are we done with ImageNet? - arXiv
We search for all images in which the ImageNet label disagrees with a given model's prediction (i.e. “mistakes” accord- ing to the original ......
Read more >
High train and val results. Bad test and predict results
I found out my method of evaluation was wrong. I tried to use model.evaluate_generator which yielded the wrong results. I think it was...
Read more >
Do Modern ImageNet Classifiers Accurately Predict ...
Each value denotes the improvement obtained by scaling down a model across a given hyperparameter over the model with default hyperparameters.
Read more >
How to Correctly Use Test-Time Data Augmentation to ...
Optimize test-time data augmentation (TTA) for production to improve deep learning model prediction with minimal overhead.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found