yasenh / libtorch-yolov5

A LibTorch inference implementation of the yolov5
MIT License
374 stars 114 forks source link

run yolov5 v4.0 error #39

Open caixiong110 opened 3 years ago

caixiong110 commented 3 years ago

run: ./libtorch-yolov5 --source ../images/bus.jpg --weights ../weights/yolov5s.torchscript.pt --gpu --view-img error: terminate called after throwing an instance of 'torch::jit::ErrorReport' what():

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): Expected at most 12 arguments but found 13 positional arguments.

why found 13 positional arguments?

system is NVIDIA Jetson Xavier NX and docker opencv 4.4.0 libtorch 1.6.0 cuda 10.2 yolov5 v4.0

yasenh commented 3 years ago

Hi @caixiong110, could you try yolov5 v3.0 or v3.1. Seems they modified the arch since v4.0 but I don't have time to catch it up at this moment.

Jelly123456 commented 3 years ago

@caixiong110 I am facing the same error as you. Do you have any solution?

Apostatee commented 3 years ago

I am using v3.0 and v3.1, and facing this error too.

Jelly123456 commented 3 years ago

@Apostatee The root cause for this error is that pytorch version and libtorch are not the same. you can check your pytorch version and it has nothing to do with whether it is YoLov5-V3.0 or YoLov5-V3.1.

Hope this information can help you.

zhujinwen0924 commented 2 years ago

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): Expected at most 12 arguments but found 13 positional arguments.

hello,Do you have sovle this problem?

caixiong110 commented 2 years ago

i solved it, you must ensure version consistency that python install libtorch with you C++ used libtorch version,such as libtorch 1.7 with same python used install version 'libtorch 1.7' (or 1.6 sames).

At 2022-01-22 20:53:48, "zhujinwen0924" @.***> wrote:

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): Expected at most 12 arguments but found 13 positional arguments.

hello,Do you have sovle this problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>