ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.36k stars 16.26k forks source link

Issue using PaddleDetection's YOLOv5 model in val.py after converting to ONNX - Error with scale_factor #13367

Open gauricollab09 opened 4 days ago

gauricollab09 commented 4 days ago

Search before asking

Question

Hi all,

I'm working with a YOLOE plus model from PaddleDetection and trying to use its .pdparams weights in the val.py script. My process involves converting the Paddle model to ONNX and then using .onnx model for validation. (I wanted to use val.py from this repo as I want to compare some of my previous results with the yoloe plus). However, I am encountering an issue related to scale_factor during this process.

Issue Details: Model: YOLOv5 from PaddleDetection (weights in .pdparams format). Error: The script throws an error related to scale_factor. image

Environment: PaddleDetection version: 3.0.0-betal PaddlePaddle version: release/2.5

Question: Is there any known compatibility issue or additional steps required when using a PaddleDetection YOLOv5 model converted to ONNX with scale_factor in the val.py script? How should I adjust the scale_factor parameter properly in the val.py scenario to ensure correct evaluation?

Any guidance or suggestions would be greatly appreciated!

Thanks in advance.

Additional

No response

pderrenger commented 4 days ago

@gauricollab09 hi,

To address the scale_factor issue, ensure that the ONNX model's input dimensions match those expected by val.py. You might need to adjust the preprocessing steps to align with YOLOv5's input requirements. Additionally, verify if the latest YOLOv5 version resolves any compatibility issues. For more details on exporting models, visit YOLOv5 Model Export.

Best of luck!

gauricollab09 commented 7 hours ago

Hi @pderrenger, Thank you for your reply. I have been trying something making the scale factor as 1.33 for onnx models and 1 for all other models. But it seems I am running into subsequent errors while implementing this. Is there an example I can refer to or use for the preprocessing step that you mentioned? It would help streamline my efforts if there is an example I could follow. Thank you.

pderrenger commented 3 hours ago

Hi @gauricollab09, you can refer to the preprocessing steps in the YOLOv5 export tutorial for guidance on handling ONNX models. Adjusting the scale factor might require aligning input dimensions with the model's expectations. For more details, check the YOLOv5 Model Export documentation.