meituan / YOLOv6

YOLOv6: a single-stage object detection framework dedicated to industrial applications.
GNU General Public License v3.0
5.72k stars 1.04k forks source link

The weights used in quantization #439

Closed ysuwl closed 2 years ago

ysuwl commented 2 years ago

Hello, excuse me, where can I find the weights and quant weights used in the onnx model, and how do I get the weights used in the quantization process? It would be nice to have a relevant explanation.

Chilicyy commented 2 years ago

hi @ysuwl , you can download the weights relevant to quantization process from the 2.0 release. Tutorials of quantization can be found in here.

ysuwl commented 2 years ago

I have problems with quantification: Traceback (most recent call last): File "tools/qat/qat_export.py", line 84, in concat_quant_amax_fuse(ops) File ".../YOLOv6-quantization/tools/partial_quantization/utils.py", line 62, in concat_quant_amax_fuse op_amax = op._input_quantizer._amax.detach().item() File "/usr/local/Python-3.8.6/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'TensorQuantizer' object has no attribute '_amax' I printed out the information of op._input_quantizer and found that it didn't have _amax: (_input_quantizer): TensorQuantizer(8bit fake per-tensor amax=dynamic calibrator=HistogramCalibrator scale=1.0 quant) What causes this? I suspect that my quantification process went wrong, and I want to ask how do I set up the calib_pt of the yolov6n_opt_qat.py and the teacher_model_path of the QAT process in the subsequent quantization process?

shensheng272 commented 2 years ago

@xingyueye

lippman1125 commented 2 years ago

@ysuwl please use commands from tutorials https://github.com/meituan/YOLOv6/blob/main/tools/qat/README.md to perform quantization

oforomar commented 2 years ago

Hello, I am trying to perform QAT after training scales and fp32 model on custom dataset for the yolov6 nano variant, But I am confused about the .pt file here:- image would appreciate your help