Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infer_tensorrt_imagenet.py: Not Predicting The Correct Classes #22

Open
Hassan313 opened this issue Jul 12, 2020 · 1 comment
Open

infer_tensorrt_imagenet.py: Not Predicting The Correct Classes #22

Hassan313 opened this issue Jul 12, 2020 · 1 comment

Comments

@Hassan313
Copy link

Hassan313 commented Jul 12, 2020

Hi @rmccorm4 ,

I am using the infer_tensorrt_imagenet.py file to infer the images of imagenet with the int8 engine created by TensorRT.

Here is the way that I am using the code:

python3 infer_tensorrt_imagenet.py --engine resnet18.int8.engine
-d /home/hassan/Datasets/ImageNet/ -b 1 -n 5

Here are the results:

[TensorRT] WARNING: Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles
[TensorRT] WARNING: Explicit batch network detected and batch size specified, use execute without batch size instead.
Allocating buffers ...
Input image: /home/hassan/Datasets/ImageNet/ILSVRC2012_val_00000025.JPEG
Prediction: wall clock Probability: 0.09
Prediction: matchstick Probability: 0.06
Prediction: switch Probability: 0.03
Prediction: screw Probability: 0.03
Prediction: envelope Probability: 0.02

[TensorRT] WARNING: Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles
[TensorRT] WARNING: Explicit batch network detected and batch size specified, use execute without batch size instead.
Allocating buffers ...
Input image: /home/hassan/Datasets/ImageNet/ILSVRC2012_val_00000073.JPEG
Prediction: wall clock Probability: 0.06
Prediction: matchstick Probability: 0.06
Prediction: switch Probability: 0.04
Prediction: screw Probability: 0.03
Prediction: envelope Probability: 0.02

[TensorRT] WARNING: Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles
[TensorRT] WARNING: Explicit batch network detected and batch size specified, use execute without batch size instead.
Allocating buffers ...
Input image: /home/hassan/Datasets/ImageNet/ILSVRC2012_val_00000117.JPEG
Prediction: wing Probability: 0.07
Prediction: spotlight Probability: 0.02
Prediction: lampshade Probability: 0.02
Prediction: matchstick Probability: 0.02
Prediction: wall clock Probability: 0.02

[TensorRT] WARNING: Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles
[TensorRT] WARNING: Explicit batch network detected and batch size specified, use execute without batch size instead.
Allocating buffers ...
Input image: /home/hassan/Datasets/ImageNet/ILSVRC2012_val_00000113.JPEG
Prediction: wall clock Probability: 0.06
Prediction: envelope Probability: 0.06
Prediction: matchstick Probability: 0.04
Prediction: lampshade Probability: 0.03
Prediction: refrigerator Probability: 0.03

There are certain classes popping up (like wall clock). Can you kindly help?

Thank you.

@rmccorm4
Copy link
Owner

rmccorm4 commented Jul 22, 2020

Hi @Hassan313 ,

Sorry for the delay.

Few questions come to mind:

  1. Are the inference results correct on fp32/fp16 engines? If yes, then probably an int8 calibration issue. If not, then probably an issue with the model/conversion.

  2. Was your int8 calibration data similar/representative of the data you're testing with inference?

  3. Are the images already pre-processed?

  4. Does using a different pre-processing function give better results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants