Skip to content

Commit 4200830

Browse files
committed
Merge branch 'chi/trt_ep_quantization_yolov3_update' of https://github.com/microsoft/onnxruntime-inference-examples into chi/trt_ep_quantization_yolov3_update
2 parents 6fec3fd + f56a16c commit 4200830

File tree

1 file changed

+10
-5
lines changed
  • quantization/image_classification/trt/resnet50

1 file changed

+10
-5
lines changed

quantization/image_classification/trt/resnet50/README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# ONNX PTQ for using TensorRT EP
2-
Following is the end-to-end example using ORT quantization tool to quantize ONNX model and run/evaluate the quantized model with TRT EP.
1+
# ONNX PTQ overview
2+
Following is the end-to-end example using ORT quantization tool to quantize ONNX model, specifially image classification model, and run/evaluate the quantized model with TRT EP.
33

44
## Environment setup
55
### dataset
6-
We suggest to use ImageNet 2012 classification dataset to do the model calibration and evaluation. In addition to the sample code we provide below, TensorRT model optimizer which leverages torchvision.datasets already provides
7-
the ability to work with ImageNet dataset.
6+
First, prepare the dataset for calibration. TensorRT recommends calibration data size to be at least 500 for CNN and ViT models.
7+
Generally, the dataset used for calibration should differ from the one used for evaluation. However, to simplify the sample code, we will use the same dataset for both calibration and evaluation. We recommend utilizing the ImageNet 2012 classification dataset for this purpose.
8+
9+
In addition to the sample code we provide below, TensorRT model optimizer which leverages torchvision.datasets already provides the ability to work with ImageNet dataset.
810

911
#### Prepare ImageNet dataset
1012
You can either download from [Kaggle](https://www.kaggle.com/c/imagenet-object-localization-challenge/data) or origianl image-net website: val [tarball](https://image-net.org/data/ILSVRC/2012/ILSVRC2012_img_val.tar) and devkit [tarball](https://image-net.org/data/ILSVRC/2012/ILSVRC2012_devkit_t12.tar.gz)
@@ -16,7 +18,7 @@ wget https://image-net.org/data/ILSVRC/2012/ILSVRC2012_devkit_t12.tar.gz --no-ch
1618
```
1719
Untar the tarballs to `val` and `ILSVRC2012_devkit_t12` folder separately.
1820

19-
The dataset layout should look like this: Following sample code expects this dataset layout.
21+
The dataset layout should look like below and the sample code expects this dataset layout
2022

2123
```
2224
|-- ILSVRC2012_devkit_t12
@@ -78,4 +80,7 @@ wget -qO- https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/
7880
| |-- ILSVRC2012_val_00003014.JPEG
7981
...
8082
```
83+
Lastly, download `synset_words.txt` from https://github.com/HoldenCaulfieldRye/caffe/blob/master/data/ilsvrc12/synset_words.txt into `ILSVRC2012` (top-level folder)
84+
85+
## Quantize an ONNX model
8186

0 commit comments

Comments
 (0)