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

INT8 calibration for efficientdet #1498

Closed
srihari-humbarwadi opened this issue Sep 18, 2021 · 4 comments
Closed

INT8 calibration for efficientdet #1498

srihari-humbarwadi opened this issue Sep 18, 2021 · 4 comments
Labels
question Further information is requested Samples Issues when using TensorRT samples triaged Issue has been triaged by maintainers

Comments

@srihari-humbarwadi
Copy link

From the readme

Where --calib_input points to a directory with several thousands of images. For example,
this could be a subset of the training or validation datasets that were used for the model. 
It's important that this data represents the runtime data distribution relatively well,  therefore,
the more images that are used for calibration, the better accuracy that will be achieved in
INT8 precision. For models  trained for the COCO dataset, we have found that 5,000 images gives a good result.

It is not clear how exactly these 5000 images were sampled. Are these 5,000 random images from coco2017 train dataset
or is it the entire coco2017 val dataset which has exactly 5000 images?
Also, can you please share the FP32 vs INT8 mAP scores for the models?

@ttyio
Copy link
Collaborator

ttyio commented Sep 28, 2021

Hello @srihari-humbarwadi ,

It is not clear how exactly these 5000 images were sample

could you check source code https://github.com/NVIDIA/TensorRT/blob/release/8.0/samples/python/efficientdet/image_batcher.py

can you please share the FP32 vs INT8 mAP scores for the models?

The author of the sample has not provide the scores yet, could you follow the instruction to collect mAP?
https://github.com/NVIDIA/TensorRT/tree/release/8.0/samples/python/efficientdet#evaluate-map-metric

@ttyio ttyio added question Further information is requested Samples Issues when using TensorRT samples triaged Issue has been triaged by maintainers labels Sep 28, 2021
@srihari-humbarwadi
Copy link
Author

srihari-humbarwadi commented Sep 28, 2021

class ImageBatcher:
"""
Creates batches of pre-processed images.
"""
def __init__(self, input, shape, dtype, max_num_images=None, exact_batches=False, preprocessor="EfficientDet"):
"""
:param input: The input directory to read images from.
:param shape: The tensor shape of the batch to prepare, either in NCHW or NHWC format.

I went through the code, and also the readme which has a brief mention of it
"For models trained for the COCO dataset, we have found that 5,000 images gives a good result."
but it is not clear how are the 5,000 images for the calibration dataset are chosen!

@nvpohanh
Copy link
Collaborator

nvpohanh commented Jul 1, 2022

but it is not clear how are the 5,000 images for the calibration dataset are chosen!

It is usually by experiments. There is no general guideline on how many images is enough.

@ttyio
Copy link
Collaborator

ttyio commented Nov 29, 2022

closing due to no activity for more than 3 weeks, please reopen if you still have question, thanks!

@ttyio ttyio closed this as completed Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Samples Issues when using TensorRT samples triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

3 participants