Ncnn: 混合精度量化如何实现?

Created on 31 Dec 2020  ·  5Comments  ·  Source: Tencent/ncnn

如果只想量化模型中的某些层,如何进行设置?

quantization

Most helpful comment

@MonicaChen426 @JSnobody
不用修改代码呀,只需要把 ncnn2table 生成的 calibration table 文件中,不需要量化的 layer 的信息删掉就可以了。再用 ncnn2int8,自动识别。很先进的~~

All 5 comments

如果只想量化模型中的某些层,如何进行设置?

我试过的两种方式:
1、在ncnn2table.cpp修改代码,只量化指定的op。
2、在ncnn2int8.cpp修改代码,只生成指定的op的量化模型。
两种方式都可以。
第2种会灵活很多。

如果只想量化模型中的某些层,如何进行设置?

我试过的两种方式:
1、在ncnn2table.cpp修改代码,只量化指定的op。
2、在ncnn2int8.cpp修改代码,只生成指定的op的量化模型。
两种方式都可以。
第2种会灵活很多。

感谢回复,请问下有没有针对层数的量化和不量化的控制方法?比如同样是1*1的conv,我只想量化第10层,而不量化其他层,如何操作?

第二种方法啊,可以想量化哪层就量化哪层,我就是这么做的。

@MonicaChen426 @JSnobody
不用修改代码呀,只需要把 ncnn2table 生成的 calibration table 文件中,不需要量化的 layer 的信息删掉就可以了。再用 ncnn2int8,自动识别。很先进的~~

对,这样也可以。我为了避免修改calibration table出错,干脆就在ncnn2int8加个判断。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baiyecha picture baiyecha  ·  3Comments

xhappy picture xhappy  ·  5Comments

SisterL picture SisterL  ·  3Comments

lovehuanhuan picture lovehuanhuan  ·  3Comments

makaaay picture makaaay  ·  4Comments