yolov5-net
yolov5-net copied to clipboard
Converting from .pt to .onnx not working correctly.
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?
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.
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.
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.
I didn't write any inherited class, I'm pretty sure. I used this to train and create my onnx file.