Toybrick

标题: pytorch->onnx->rknn,转换遇到的问题 [打印本页]

作者: xsky    时间: 2019-12-7 19:13
标题: pytorch->onnx->rknn,转换遇到的问题
本帖最后由 xsky 于 2019-12-13 09:50 编辑

一、onnx模型转换的问题:
1、Pytorch 1.1.0 导出onnx(opset v9),rknn可以加载,Pytorch 1.3.0 导出的不能加载?
2、Pytorch 1.1.0 导出onnx(opset v9),  rknn 1.2.1(onnx 1.4),rknn可加载build,  更新onnx为1.6,rknn加载会报错:E NotImplementedError: Gather version 11 is not implemented。但直接使用onnx prepare()  run(),是可以正常运行且结果是正确的。
3、模型build的输出
  1. D Process Transpose_78_15 ...
  2. D RKNN output shape(permute): (1 15 9 4)
  3. D Process Reshape_98_9 ...
  4. D RKNN output shape(reshape): (1 540)
  5. D Process Concat_99_5 ...
  6. W Warning: Axis may need to be adjusted according to original model shape.
  7. D RKNN output shape(concat): (1 173940)
  8. D Process Reshape_125_3 ...
  9. W Unhandle status: the input shape of reshape layer Reshape_125_3 is not 4-D
  10. D RKNN output shape(reshape): (1 4 43485)
  11. D Process attach_Reshape_125/out0_0 ...
  12. D RKNN output shape(output): (1 4 43485)
  13. D Process Conv_71_22 ...
  14. D RKNN output shape(convolution): (1 60 34 63)
  15. D Process Transpose_72_16 ...
  16. D RKNN output shape(permute): (1 60 34 63)
  17. D Process Reshape_105_10 ...
  18. D RKNN output shape(reshape): (1 128520)
  19. D Process Conv_75_23 ...
  20. D RKNN output shape(convolution): (1 30 17 3)
  21. D Process Transpose_76_17 ...
  22. D RKNN output shape(permute): (1 30 17 3)
  23. D Process Reshape_111_11 ...
  24. D RKNN output shape(reshape): (1 1530)
  25. D Process Conv_79_24 ...
  26. D RKNN output shape(convolution): (1 15 9 3)
  27. D Process Transpose_80_18 ...
  28. D RKNN output shape(permute): (1 15 9 3)
  29. D Process Reshape_117_12 ...
  30. D RKNN output shape(reshape): (1 405)
  31. D Process Concat_118_6 ...
  32. W Warning: Axis may need to be adjusted according to original model shape.
  33. D RKNN output shape(concat): (1 130455)
  34. D Process Reshape_126_4 ...
  35. W Unhandle status: the input shape of reshape layer Reshape_126_4 is not 4-D
  36. D RKNN output shape(reshape): (43485 3)
  37. D Process Softmax_127_2 ...
  38. D RKNN output shape(softmax): (43485 3)
  39. D Process attach_Softmax_127/out0_1 ...
  40. D RKNN output shape(output): (43485 3)
  41. I Build torch-jit-export complete.
  42. I Config File "/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RK1808_PID0X82" load/generated successfully
  43. I Initialzing network optimizer by /home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RK1808_PID0X82 ...
  44. D Optimizing network with qnt_adjust_coef, multiply_transform, add_extra_io, format_input_ops, auto_fill_zero_bias, conv_kernel_transform, twod_op_transform, conv_1xn_transform, strip_op, extend_unstack_split, extend_batchnormalize, swapper, merge_layer, transform_layer, proposal_opt, broadcast_op, strip_op, auto_fill_reshape_zero, adjust_output_attrs
  45. D Optimizing network with c2drv_convert_axis, c2drv_convert_shape, c2drv_convert_array, c2drv_cast_dtype
  46. I Building data ...
  47. I Packing data ...
  48. D Packing AveragePool_13_78_conv_99 ...
  49. D Packing AveragePool_30_62_conv_98 ...
  50. D Packing AveragePool_47_43_conv_97 ...
  51. D Packing Conv_0_93 ...
复制代码

  (1)、Warning 一般影不影响运行结果的。
  (2)、RK3399的系统固件和RK1808是相同的么?为什么下载的Debian 10的固件提示有:  I Config File "/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RK1808_PID0X82" load/generated successfully,这会不会引起错误的。
  (3)、对输入数据的形状,除了对第一个维度是有判断的必须为list,为何对再下一级的维度hwc/chw没有判断,比如图片是 (3, 1920, 1080) 或者是(180,1920,3)甚至其它形状都不会报错,但网络是有形状的,而且在直接使用rknn 直接运行模型时,对输入均有检查。
      a. 如果设置输入参数inputs_pass_through=[1],那么,这个输入数据的数据类型怎么确定?形状?到底转为rknn对通道有没有变换?rknn文档也没有相应说明),在量化和不量化的情况如果使用透传,应该按传什么格式传?


作者: hzxuguozhi    时间: 2019-12-11 11:05
入坑新手,持续关注中




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3