-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Add sample support of YOLOv9 and YOLOv10 in OpenCV
#25794
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
Conversation
YOLOv10 in OpenCVYOLOv9 and YOLOv10 in OpenCV
|
opencv_extra PR is missing. |
Just added. Here |
|
Test and sample changes look good for me. What about Yolov10 export steps? I expect significant changes in the tutorial text. |
Exprot steps are outline in this fork of yolov10 in GitHub. And the instruction for this are lacted in this READme |
|
I propose to extend "PyTorch Model Export" for Yolov10 as soon as it's not trivial. |
|
Hi. results differ significantly (worse) from the original model. Original model : yolo predict model= models/yolov10s.pt source= ultralytics/assets/bus.jpg _Ultralytics YOLOv8.1.34 🚀 Python-3.10.14 torch-2.0.1+cu117 CPU (13th Gen Intel Core(TM) i7-13700H) image 1/1 /home/salinas/yolov10/ultralytics/assets/bus.jpg: 640x480 4 0s, 1 5, 1 11, 81.1ms Proposed model: |
|
infer error, incorrect frames are numerous ,in yolov9 and yolov10 |


This PR adds sample support of
YOLOv9andYOLOv10) in OpenCV. Models for this test are located in this PR.Running YOLOv10 using OpenCV.
YOLOv10one needs to cut off postporcessing with dynamic shapes from torch and then convert it to ONNX. If someone is looking for ready solution, there is this forked branch from official YOLOv10. Particularty follow this proceduce.By default
model="yolov10s"andimgsz=(480,640). This will generate fileyolov10s.onnx, which can be use for inference in OpenCVyolo_detector.cppsample. If you have followed above exporting procedure, then you can use following command to run the model.If you do not specify
--inputargument, OpenCV will grab first camera that is avaliable on your platform.For more deatils on how to run the
yolo_detector.cppfile see this guideRunning YOLOv9 using OpenCV
git clone https://github.com/WongKinYiu/yolov9.git cd yolov9 conda create -n yolov9 python=3.9 conda activate yolov9 pip install -r requirements.txt wget https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-t-converted.pt python export.py --weights=./yolov9-t-converted.pt --include=onnx --img-size=(480,640)This will generate <yolov9-t-converted.onnx> file.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.