|
本帖最后由 xsky 于 2021-9-9 15:14 编辑
v1.7写了支持onnx量化模型
文档对使用onnx量化模型时,应该怎么输出onnx没有说明,其它python接口调用时要不要设置do_quantization,或者量化类型这些,都没有说明啊,这咋用?
尝试了在TensorRT上可以用的,拿过来完全不行。
环境:
widows 10, python 3.6
- onnx 1.6.0
- onnx-simplifier 0.3.5
- onnx-tf 1.2.1
- onnxoptimizer 0.2.6
- onnxruntime 1.8.1
- rknn-toolkit 1.7.0
- torch 1.8.1+cu101 d:\program files\python\python36\lib\site-packages
- torchsummary 1.5.1
- torchvision 0.9.1
在load_onnx时就报错
是很简单的一个conv+relu的模块
- D Calc tensor Conv_16 (1, 5, 222, 222)
- D Calc tensor Relu_output (1, 5, 222, 222)
- D Calc tensor QuantizeLinear_output.quant_mid (1, 5, 222, 222)
- D Calc tensor DequantizeLinear_output.dequant_out (1, 5, 222, 222)
- D import clients finished
- I build output layer attach_DequantizeLinear_DequantizeLinear_output:out0
- I Try match DequantizeLinear_DequantizeLinear_output:out0
- I Match r_dequantizelinear [['DequantizeLinear_DequantizeLinear_output', 'Initializer_output.y_scale', 'Initializer_output.y_zero_point']] [['DequantizeLinear', 'Constant', 'Constant_1']] to [['dequantize']]
- I Try match QuantizeLinear_QuantizeLinear_output:out0
- I Match r_quantizelinear [['QuantizeLinear_QuantizeLinear_output', 'Initializer_output.y_scale', 'Initializer_output.y_zero_point']] [['QuantizeLinear', 'Constant', 'Constant_1']] to [['quantize']]
- I Try match Relu_Relu_3:out0
- I Match r_relu [['Relu_Relu_3']] [['Relu']] to [['relu']]
- I Try match Conv_Conv_2:out0
- W Not match tensor Conv_Conv_2:out0
- E Try match Conv_Conv_2:out0 failed, catch exception!
- W ----------------Warning(3)----------------
- E Catch exception when loading onnx model: qdq_convbnrelu.onnx!
- E Traceback (most recent call last):
- E File "rknn\base\RKNNlib\converter\convert_onnx.py", line 1608, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.match_paragraph_and_param
- E File "rknn\base\RKNNlib\converter\convert_onnx.py", line 1508, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx._onnx_push_ready_tensor
- E TypeError: 'NoneType' object is not iterable
- E During handling of the above exception, another exception occurred:
- E Traceback (most recent call last):
- E File "rknn\api\rknn_base.py", line 292, in rknn.api.rknn_base.RKNNBase.load_onnx
- E File "rknn\base\RKNNlib\RK_nn.py", line 141, in rknn.base.RKNNlib.RK_nn.RKnn.load_onnx
- E File "rknn\base\RKNNlib\app\importer\import_onnx.py", line 129, in rknn.base.RKNNlib.app.importer.import_onnx.Importonnx.run
- E File "rknn\base\RKNNlib\converter\convert_onnx.py", line 1614, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.match_paragraph_and_param
- E File "rknn\api\rknn_log.py", line 312, in rknn.api.rknn_log.RKNNLog.e
- E ValueError: Try match Conv_Conv_2:out0 failed, catch exception!
- Traceback (most recent call last):
- File "F:/Work/smtc/_code/python/qat/q.py", line 31, in <module>
- rknn.build(do_quantization=True, dataset='dataset.txt', rknn_batch_size=1)
- File "D:\Program Files\Python\Python36\lib\site-packages\rknn\api\rknn.py", line 241, in build
- inputs = self.rknn_base.net.get_input_layers()
- AttributeError: 'NoneType' object has no attribute 'get_input_layers'
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|