- def forward(self, x):
- z = [] # inference output
- for i in range(self.nl):
- x[i] = self.m[i](x[i]) # conv
-
- return x
复制代码
2.从官方yolov5s.pt导出模型yolov5s.torchscript.pt- --> Config model
- done
- --> Loading model
- yolov5s.torchscript.pt ********************
- E Catch exception when loading pytorch model: yolov5s.torchscript.pt!
- E Traceback (most recent call last):
- E File "rknn/api/rknn_base.py", line 376, in rknn.api.rknn_base.RKNNBase.load_pytorch
- E File "rknn/base/RKNNlib/RK_nn.py", line 157, in rknn.base.RKNNlib.RK_nn.RKnn.load_pytorch
- E File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 129, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
- E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 3971, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.load
- E File "/usr/local/lib/python3.6/dist-packages/torch/jit/__init__.py", line 275, in load
- E cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
- E RuntimeError:
- E aten::_convolution(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, bool transposed, int[] output_padding, int groups, bool benchmark, bool deterministic, bool cudnn_enabled) -> (Tensor):
- E Expected at most 12 arguments but found 13 positional arguments.
复制代码
我对demo的操作和理解有哪里不对的吗 烦指点- root@e0ded6759c5b:/examples/pytorch/yolov5# python test.py
- --> Config model
- done
- --> Loading model
- yolov5s.torchscript.pt ********************
- E Catch exception when loading pytorch model: yolov5s.torchscript.pt!
- E Traceback (most recent call last):
- E File "rknn/api/rknn_base.py", line 376, in rknn.api.rknn_base.RKNNBase.load_pytorch
- E File "rknn/base/RKNNlib/RK_nn.py", line 157, in rknn.base.RKNNlib.RK_nn.RKnn.load_pytorch
- E File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 129, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
- E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 3971, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.load
- E File "/usr/local/lib/python3.6/dist-packages/torch/jit/__init__.py", line 275, in load
- E cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
- E RuntimeError:
- E aten::_convolution(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, bool transposed, int[] output_padding, int groups, bool benchmark, bool deterministic, bool cudnn_enabled) -> (Tensor):
- E Expected at most 12 arguments but found 13 positional arguments.
- E :
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/conv.py(440): _conv_forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/conv.py(443): forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1039): _slow_forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1051): _call_impl
- E /home/bertha/Desktop/1/yolov5-6.0/models/common.py(48): forward_fuse
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1039): _slow_forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1051): _call_impl
- E /home/bertha/Desktop/1/yolov5-6.0/models/yolo.py(156): _forward_once
- E /home/bertha/Desktop/1/yolov5-6.0/models/yolo.py(133): forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1039): _slow_forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1051): _call_impl
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/jit/_trace.py(959): trace_module
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/jit/_trace.py(744): trace
- E export.py(56): export_torchscript
- E export.py(304): run
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/autograd/grad_mode.py(28): decorate_context
- E export.py(359): main
- E export.py(364): <module>
- E Serialized File "code/__torch__/torch/nn/modules/conv.py", line 11
- E x: Tensor) -> Tensor:
- E _0 = self.bias
- E x0 = torch._convolution(x, self.weight, _0, [2, 2], [2, 2], [1, 1], False, [0, 0], 1, False, False, True, True)
- E ~~~~~~~~~~~~~~~~~~ <--- HERE
- E return x0
- E Please feedback the detailed log file <log_feedback_to_the_rknn_toolkit_dev_team.log> to the RKNN Toolkit development team.
- E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues
- Load yolov5 failed!
复制代码
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1039): _slow_forward
- E /home/bertha/anaconda3/envs/rknny5v5/lib/python3.6/site-packages/torch/nn/modules/module.py(1051): _call_impl
复制代码
- E /home/bertha/Desktop/1/yolov5-6.0/models/yolo.py(133): forward
复制代码
- import os
- import urllib
- import traceback
- import time
- import sys
- import numpy as np
- import cv2
- #from torch.autograd.grad_mode import F
- from rknn.api import RKNN
- ....
复制代码
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |