meituan / YOLOv6

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

使用yolov6n_opt_ptq.py量化问题,在进行PTQ量化时,出现TypeError: _output_padding() missing 1 required positional argument: 'num_spatial_dims'报错 #811

Open lanRHC opened 1 year ago

lanRHC commented 1 year ago

Before Asking

Search before asking

Question

大佬,我先后使用yolov6n_hs.py和yolov6n_opt.py 通过自己的数据集训练出了对应的scale和目标网络,之后再进行PTQ量化时,出现报错TypeError: _output_padding() missing 1 required positional argument: 'num_spatial_dims' 我看到您之前有回复说官方代码只检验了0.2.0版本的适配性,但是我发现0.2.0版本官方只提供了yolov6s的文件,我试了0.2.0以上版本的代码发现都有问题,不知道现在该如何解决,目前我是想使用最小的n型模型训练出最新的模型,再通过量化使他变得更小,以满足我的需求,希望能够得到大佬的帮助!谢谢!

Additional

No response

ChenGongfu commented 1 year ago

这个问题已经解答了哦: 我按照这个大佬的回答,改了错误提示的文件quant_conv.py的参数就可以了。 modify QuantConvTranspose2d method in YOLOv6/venv/lib/python3.10/site-packages/pytorch_quantization/nn/modules/quant_conv.py change output_padding = self._output_padding(input, output_size, self.stride, self.padding, self.kernel_size) to output_padding = self._output_padding(input, output_size, self.stride, self.padding, self.kernel_size, 2)

Originally posted by @EchoEsprit in https://github.com/meituan/YOLOv6/issues/557#issuecomment-1472210244