ONNX runtime quantization is under active development. please use 1.6.0+ to get more quantization support.
This example load an object detection model converted from ONNX Model Zoo and confirm its accuracy and speed based on MS COCO 2017 dataset. You need to download this dataset yourself.
onnx: 1.9.0 onnxruntime: 1.10.0
Download model from ONNX Model Zoo
wget https://github.com/onnx/models/raw/main/vision/object_detection_segmentation/ssd/model/ssd-12.onnx
Quantize model with QLinearOps:
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
--config=ssd.yaml \
--output_model=path/to/save
Make sure anno_path in ssd.yaml is updated to the path of label_map.yaml.
Quantize model with QDQ mode:
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
--config=ssd_qdq.yaml \
--output_model=path/to/save
Make sure anno_path in ssd_qdq.yaml is updated to the path of label_map.yaml.
bash run_benchmark.sh --input_model=path/to/model \ # model path as *.onnx
--config=ssd.yaml \
--mode=performance # or accuracy