Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
triple-Mu fc53080cb0 | 1 year ago | |
---|---|---|
.. | ||
README.md | 1 year ago | |
eval.py | 1 year ago | |
eval.yaml | 1 year ago | |
partial_quant.py | 1 year ago | |
ptq.py | 1 year ago | |
sensitivity_analyse.py | 1 year ago | |
utils.py | 1 year ago |
The performance of YOLOv6s heavily degrades from 42.4% to 35.6% after traditional PTQ, which is unacceptable. To resolve this issue, we propose partial quantization. First we analyze the quantization sensitivity of all layers, and then we let the most sensitive layers to have full precision as a compromise.
With partial quantization, we finally reach 42.1%, only 0.3% loss in accuracy, while the throughput of the partially quantized model is about 1.56 times that of the FP16 model at a batch size of 32. This method achieves a nice tradeoff between accuracy and throughput.
pip install --extra-index-url=https://pypi.ngc.nvidia.com --trusted-host pypi.ngc.nvidia.com nvidia-pyindex
pip install --extra-index-url=https://pypi.ngc.nvidia.com --trusted-host pypi.ngc.nvidia.com pytorch_quantization
Please use the following command to perform sensitivity analysis. Since we randomly sample 128 images from train dataset each time, the sensitivity files will be slightly different.
python3 sensitivity_analyse.py --weights yolov6s_reopt.pt \
--batch-size 32 \
--batch-number 4 \
--data-root train_data_path
With the sensitivity file at hand, we then proceed with partial quantization as follows.
python3 partial_quant.py --weights yolov6s_reopt.pt \
--calib-weights yolov6s_repot_calib.pt \
--sensitivity-file yolov6s_reopt_sensivitiy_128_calib.txt \
--quant-boundary 55 \
--export-batch-size 1
Build a TRT engine
trtexec --workspace=1024 --percentile=99 --streams=1 --int8 --fp16 --avgRuns=10 --onnx=yolov6s_reopt_partial_bs1.sim.onnx --saveEngine=yolov6s_reopt_partial_bs1.sim.trt
Model | Size | Precision | mAPval 0.5:0.95 |
SpeedT4 trt b1 (fps) |
SpeedT4 trt b32 (fps) |
---|---|---|---|---|---|
[YOLOv6-s-partial] bs1 bs32 |
640 | INT8 | 42.1 | 503 | 811 |
[YOLOv6-s] | 640 | FP16 | 42.4 | 373 | 520 |
No Description
Jupyter Notebook Python other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》