Could anybody please help me to convert YOLOv5 PyTorch model to ONNX or TensorFlow format to be able to use it with OpenCV C++ inference?
I used this tutorial to train the model with colab: https://blog.roboflow.com/how-to-train-yolov5-on-a-custom-dataset/
Maybe there is a way of conversion in colab or I should use any other tools?
Below is the recent reply from ultralytics developers(YoloV5 creators) regarding OpenCV & YoloV5 compatibility. In fact I'm also looking for correct implementation tutorial.
👉 Original Thread
Good news 😃! Your original issue may now be fixed ✅ in PR #4833 by @SamFC10. This PR implements architecture updates to allow for ONNX-exported YOLOv5 models to be used with OpenCV DNN.
To receive this update:
- Git –
git pullfrom withinyour yolov5/directory orgit clone https://github.com/ultralytics/yolov5- PyTorch Hub – Force-reload with
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)- Notebooks – View updated notebooks Open In Colab Open In Kaggle. Colab
- Docker –
sudo docker pull ultralytics/yolov5:latestto update your image.Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With