You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR adds sample support of YOLOv9 and YOLOv10) in OpenCV. Models for this test are located in this PR.
Running YOLOv10 using OpenCV.
In oder to run YOLOv10 one 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" and imgsz=(480,640). This will generate file yolov10s.onnx, which can be use for inference in OpenCV
For inference part on OpenCV. one can use yolo_detector.cppsample. If you have followed above exporting procedure, then you can use following command to run the model.
If you do not specify --input argument, OpenCV will grab first camera that is avaliable on your platform.
For more deatils on how to run the yolo_detector.cpp file see this guide
Running YOLOv9 using OpenCV
Export model following official guideof the YOLOv9 repository. Particularly you can do following for converting.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds sample support of
YOLOv9
andYOLOv10
) in OpenCV. Models for this test are located in this PR.Running YOLOv10 using OpenCV.
YOLOv10
one 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.cpp
sample. If you have followed above exporting procedure, then you can use following command to run the model.If you do not specify
--input
argument, OpenCV will grab first camera that is avaliable on your platform.For more deatils on how to run the
yolo_detector.cpp
file 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.