Toybrick

标题: pytorch的上采样不支持转rknn模型? [打印本页]

作者: wjzhoumm    时间: 2021-4-17 10:04
标题: pytorch的上采样不支持转rknn模型?
  1. nn.Upsample(size=(x1.size()[2]*2, x1.size()[3]*2), mode='bilinear', align_corners=True)
复制代码
或者
  1. F.interpolate(x1, size=(x1.size()[2]*2, x1.size()[3]*2), mode='bilinear', align_corners=True)
复制代码

使用以上两种上采样的pytorch模型总是无法转换成rknn模型,在转换模型的过程中会报如下错误:
  1. --> Config model
  2. done
  3. --> Loading model
  4. ./unet.pt ********************
  5. E Catch exception when loading pytorch model: ./unet.pt!
  6. E Traceback (most recent call last):
  7. E   File "rknn\api\rknn_base.py", line 339, in rknn.api.rknn_base.RKNNBase.load_pytorch
  8. E   File "rknn\base\RKNNlib\RK_nn.py", line 146, in rknn.base.RKNNlib.RK_nn.RKnn.load_pytorch
  9. E   File "rknn\base\RKNNlib\app\importer\import_pytorch.py", line 128, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
  10. E   File "rknn\base\RKNNlib\converter\convert_pytorch_new.py", line 2255, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.load
  11. E   File "rknn\base\RKNNlib\converter\convert_pytorch_new.py", line 2370, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.parse_nets
  12. E   File "rknn\base\RKNNlib\converter\convert_pytorch_new.py", line 2059, in rknn.base.RKNNlib.converter.convert_pytorch_new.PyTorchOpConverter.convert_operators
  13. E   File "rknn\base\RKNNlib\converter\convert_pytorch_new.py", line 1439, in rknn.base.RKNNlib.converter.convert_pytorch_new.PyTorchOpConverter.size
  14. E   File "rknn\base\RKNNlib\core\shape.py", line 42, in rknn.base.RKNNlib.core.shape.Shape.reset_shape_format
  15. E   File "rknn\base\RKNNlib\core\shape.py", line 86, in rknn.base.RKNNlib.core.shape.Shape.format
  16. E TypeError: '>=' not supported between instances of 'Tensor' and 'int'
  17. Load Pytorch model failed!
复制代码
请问大佬们这个错误该如何解决,或者这个上采样的函数有可替换的吗?

作者: brunolin    时间: 2021-4-29 10:26
試試先轉成ONNX,再轉RKNN




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