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 pull
from within your yolov5/
directory or git 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:latest
to 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 !