yolov5-net icon indicating copy to clipboard operation
yolov5-net copied to clipboard

Converting from .pt to .onnx not working correctly.

Open GeneralSyb opened this issue 3 years ago • 4 comments

I've been trying to get my own models working in the .onnx type, but when it is exported to .onnx it doesn't find anything in an image. The results in pytorch are pretty good, but even converting models like coco don't work.

I saw this issue: https://github.com/mentalstack/yolov5-net/issues/51, but he seems to have fixed it by adding more image or something?

GeneralSyb avatar Apr 01 '22 13:04 GeneralSyb

I don't understand wtf he said fixed it... BUT... I was having the same issue and the key was the "Dimensions" property on the inherited class. I left it as the default cause I have no idea what it means. Didn't find anything. But, I used Netron to inspect my ONNX file and the output was of type float32[1, 25200, 6]. I guessed that the last dimension in the tensor was the "Dimensions" here... and then BAM. 88% confidence.

sstainba avatar Jul 26 '22 22:07 sstainba

Sorry for the late reply, I was on vacation.

Thank you for your reply, but which inherited class do you mean? I can't seem to find anything with a Dimensions property.

GeneralSyb avatar Aug 04 '22 10:08 GeneralSyb

the inherited class you write. for a custom model, he says you have to inherit from the yolomodel base class. it has a property for "dimensions." but, after reading more, i think it actually means the dimensions of the float array (which in this case is 3). i think it only seemed to work for me because 6 is a multiple of 3.

sstainba avatar Aug 05 '22 02:08 sstainba

I didn't write any inherited class, I'm pretty sure. I used this to train and create my onnx file.

GeneralSyb avatar Aug 07 '22 13:08 GeneralSyb