-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with a custom trained yolov5 ONNX model #6
Comments
Concerning your Error messageIf the inputs and ouputs layers are properly defined in your ONNX, I would suggest removing or commenting the following lines (keeping in mind that your issue comes from the definition of the YOLOv4MLNet/YOLOv4MLNet/Program.cs Lines 35 to 39 in 0104728
If this doesn't work, you need to investigate further:
Concerning the differences in output layersPlease see my #2 (comment), I think the difference is related to the
|
The new error comes from the fact that your model expect 16 images as input (batch size is 16) and you only input 1 image (input data is of size 1,228,800 = 1 x 3 x 640 x 640). Try changing the batch size when you export your model to 1, and change the batch to 1 in the C# code (or you could try to input 16 images in the C# code, but I don't know how to do that). Concerning your ouput layers, you indeed have 3:
|
I convert pt file again this time into an ONNX file with batch size = 1, this time I've no exception for my model. |
At last, with help of this link |
Hi, thanks for providing a source code for yolov5, I, ve tried it and it works for me with yolov5 default ONNX files.
I trained a custom model with PyTorch (.pt) and converted it into ONNX.
I try to change your code parameters to my own ONNX file by open it on Netron app.
My model's input type is
type: float32[16,3,640,640]
and output is type: float32[16,3,80,80,33], that is not same dimension of yolov5s_full_layer output (float32[1,25200,85]) and also if I try to run code it throws an exception like this atvar model = pipeline.Fit(mlContext.Data.LoadFromEnumerable(new List<YoloV4BitmapData>()));
code:Please help me to do the right changes.
The text was updated successfully, but these errors were encountered: