CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 09:25:02 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/opencv/opencv.git
etag: W/"091df99750d7a8ad9c219b8c1e82a3cb"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=WobHNiRjoE1W7NDbBYoZEzglZBBSKagcWKYq6YoGXrFdzJJhkaklgnXgO89aUJjfs2LQaBAjY2ce5VtLkmeTd%2ByvwxeSPYWX6Ej809ajAJ1qjf9D9AKXKrggNGniz3o9b1CSFppZRSZ0%2F1gYXNoGFz09Pjp%2FlcGgSP1Hnur1umBXfTaZ7WejW3sGTMap9ys24HaFLp2sVeFXdpuWXmKNtRt%2BVo5fAnS1oay06H1cPZNmlJBXmYsOq%2BvOSB2VBnLxtqx%2BxrLbBBGbX0CfIKHyKg%3D%3D--aHptTnS6E40Gd9TX--Mz92lY%2FdLeweZwEzV1Kymg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1286861989.1753608301; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 09:25:01 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 09:25:01 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: DC1A:3E3773:3576A4:48E9DD:6885F06D
Merge pull request #25794 from Abdurrahheem:ash/yolov10-support · opencv/opencv@a8d1373 · GitHub
Copy file name to clipboardExpand all lines: doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown
Copy file name to clipboardExpand all lines: modules/dnn/test/test_onnx_importer.cpp
Copy file name to clipboardExpand all lines: samples/dnn/yolo_detector.cpp
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Commit a8d1373
authored
Merge pull request #25794 from Abdurrahheem:ash/yolov10-support
Add sample support of YOLOv9 and YOLOv10 in OpenCV #25794
This PR adds sample support of [`YOLOv9`](https://github.com/WongKinYiu/yolov9) and [`YOLOv10`](https://github.com/THU-MIG/yolov10/tree/main)) in OpenCV. Models for this test are located in this [PR](opencv/opencv_extra#1186).
**Running YOLOv10 using OpenCV.**
1. 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](https://github.com/Abdurrahheem/yolov10/tree/ash/opencv-export) from official YOLOv10. Particularty follow this proceduce.
```bash
git clone git@github.com:Abdurrahheem/yolov10.git
conda create -n yolov10 python=3.9
conda activate yolov10
pip install -r requirements.txt
python export_opencv.py --model=<model-name> --imgsz=<input-img-size>
```
By default `model="yolov10s"` and `imgsz=(480,640)`. This will generate file `yolov10s.onnx`, which can be use for inference in OpenCV
2. For inference part on OpenCV. one can use `yolo_detector.cpp` [sample](https://github.com/opencv/opencv/blob/4.x/samples/dnn/yolo_detector.cpp). If you have followed above exporting procedure, then you can use following command to run the model.
``` bash
build opencv from source
cd build
./bin/example_dnn_yolo_detector --model=<path-to-yolov10s.onnx-file> --yolo=yolov10 --width=640 --height=480 --input=<path-to-image> --scale=0.003921568627 --padvalue=114
```
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](https://docs.opencv.org/4.x/da/d9d/tutorial_dnn_yolo.html#autotoc_md443)
**Running YOLOv9 using OpenCV**
1. Export model following [official guide](https://github.com/WongKinYiu/yolov9)of the YOLOv9 repository. Particularly you can do following for converting.
```bash
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.
2. Inference on OpenCV.
```bash
build opencv from source
cd build
./bin/example_dnn_yolo_detector --model=<path-to-yolov9-t-converted.onnx> --yolo=yolov9 --width=640 --height=480 --scale=0.003921568627 --padvalue=114 --path=<path-to-image>
```
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake1 parent 939cb58 commit a8d1373Copy full SHA for a8d1373
File tree
Expand file treeCollapse file tree
3 files changed
+151
-28
lines changedFilter options
- doc/tutorials/dnn/dnn_yolo
- modules/dnn/test
- samples/dnn
Expand file treeCollapse file tree
3 files changed
+151
-28
lines changeddoc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown
Copy file name to clipboardExpand all lines: doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown+43-8Lines changed: 43 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 |
| |
29 | 31 |
| |
30 | 32 |
| |
| |||
79 | 81 |
| |
80 | 82 |
| |
81 | 83 |
| |
82 |
| - | |
| 84 | + | |
83 | 85 |
| |
84 | 86 |
| |
85 | 87 |
| |
| |||
125 | 127 |
| |
126 | 128 |
| |
127 | 129 |
| |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
128 | 144 |
| |
129 | 145 |
| |
130 | 146 |
| |
| |||
144 | 160 |
| |
145 | 161 |
| |
146 | 162 |
| |
147 |
| - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
148 | 166 |
| |
149 | 167 |
| |
150 |
| - | |
151 |
| - | |
152 |
| - | |
153 | 168 |
| |
154 | 169 |
| |
155 | 170 |
| |
156 | 171 |
| |
157 | 172 |
| |
158 |
| - | |
| 173 | + | |
159 | 174 |
| |
160 | 175 |
| |
161 | 176 |
| |
162 | 177 |
| |
163 | 178 |
| |
164 | 179 |
| |
| 180 | + | |
| 181 | + | |
165 | 182 |
| |
166 | 183 |
| |
167 | 184 |
| |
| |||
183 | 200 |
| |
184 | 201 |
| |
185 | 202 |
| |
186 |
| - | |
| 203 | + | |
| 204 | + | |
187 | 205 |
| |
188 | 206 |
| |
189 | 207 |
| |
| |||
195 | 213 |
| |
196 | 214 |
| |
197 | 215 |
| |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
198 | 233 |
| |
199 | 234 |
| |
200 | 235 |
| |
|
modules/dnn/test/test_onnx_importer.cpp
Copy file name to clipboardExpand all lines: modules/dnn/test/test_onnx_importer.cpp+86-10Lines changed: 86 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| |||
2670 | 2671 |
| |
2671 | 2672 |
| |
2672 | 2673 |
| |
2673 |
| - | |
| 2674 | + | |
| 2675 | + | |
2674 | 2676 |
| |
2675 | 2677 |
| |
2676 | 2678 |
| |
2677 | 2679 |
| |
2678 | 2680 |
| |
2679 | 2681 |
| |
2680 | 2682 |
| |
2681 |
| - | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
2682 | 2686 |
| |
2683 | 2687 |
| |
2684 | 2688 |
| |
2685 |
| - | |
| 2689 | + | |
2686 | 2690 |
| |
2687 | 2691 |
| |
2688 | 2692 |
| |
| |||
2696 | 2700 |
| |
2697 | 2701 |
| |
2698 | 2702 |
| |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
2699 | 2707 |
| |
2700 | 2708 |
| |
2701 | 2709 |
| |
2702 | 2710 |
| |
2703 | 2711 |
| |
2704 | 2712 |
| |
2705 |
| - | |
| 2713 | + | |
| 2714 | + | |
2706 | 2715 |
| |
2707 | 2716 |
| |
2708 | 2717 |
| |
2709 |
| - | |
| 2718 | + | |
2710 | 2719 |
| |
2711 | 2720 |
| |
2712 | 2721 |
| |
2713 | 2722 |
| |
2714 |
| - | |
| 2723 | + | |
2715 | 2724 |
| |
2716 | 2725 |
| |
2717 | 2726 |
| |
| |||
2722 | 2731 |
| |
2723 | 2732 |
| |
2724 | 2733 |
| |
2725 |
| - | |
2726 | 2734 |
| |
2727 |
| - | |
| 2735 | + | |
2728 | 2736 |
| |
2729 | 2737 |
| |
2730 | 2738 |
| |
2731 | 2739 |
| |
2732 | 2740 |
| |
2733 |
| - | |
| 2741 | + | |
2734 | 2742 |
| |
2735 | 2743 |
| |
2736 | 2744 |
| |
| |||
2747 | 2755 |
| |
2748 | 2756 |
| |
2749 | 2757 |
| |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
2750 | 2786 |
| |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
2751 | 2827 |
| |
2752 | 2828 |
| |
2753 | 2829 |
| |
|
samples/dnn/yolo_detector.cpp
Copy file name to clipboardExpand all lines: samples/dnn/yolo_detector.cpp+22-10Lines changed: 22 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
| 30 | + | |
| 31 | + | |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| |||
40 | 41 |
| |
41 | 42 |
| |
42 | 43 |
| |
| 44 | + | |
43 | 45 |
| |
44 | 46 |
| |
45 | 47 |
| |
| |||
107 | 109 |
| |
108 | 110 |
| |
109 | 111 |
| |
110 |
| - | |
| 112 | + | |
| 113 | + | |
111 | 114 |
| |
112 | 115 |
| |
113 | 116 |
| |
114 | 117 |
| |
115 | 118 |
| |
116 | 119 |
| |
117 |
| - | |
| 120 | + | |
| 121 | + | |
118 | 122 |
| |
119 | 123 |
| |
120 | 124 |
| |
121 | 125 |
| |
122 |
| - | |
| 126 | + | |
123 | 127 |
| |
124 | 128 |
| |
125 | 129 |
| |
| |||
131 | 135 |
| |
132 | 136 |
| |
133 | 137 |
| |
134 |
| - | |
| 138 | + | |
135 | 139 |
| |
136 | 140 |
| |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
137 | 145 |
| |
138 | 146 |
| |
139 | 147 |
| |
140 | 148 |
| |
141 | 149 |
| |
142 | 150 |
| |
143 |
| - | |
| 151 | + | |
| 152 | + | |
144 | 153 |
| |
145 | 154 |
| |
146 | 155 |
| |
147 |
| - | |
| 156 | + | |
148 | 157 |
| |
149 | 158 |
| |
150 | 159 |
| |
151 | 160 |
| |
152 |
| - | |
| 161 | + | |
153 | 162 |
| |
154 | 163 |
| |
155 | 164 |
| |
| |||
161 | 170 |
| |
162 | 171 |
| |
163 | 172 |
| |
164 |
| - | |
| 173 | + | |
165 | 174 |
| |
166 | 175 |
| |
167 | 176 |
| |
| |||
203 | 212 |
| |
204 | 213 |
| |
205 | 214 |
| |
| 215 | + | |
206 | 216 |
| |
207 | 217 |
| |
208 | 218 |
| |
| |||
219 | 229 |
| |
220 | 230 |
| |
221 | 231 |
| |
| 232 | + | |
222 | 233 |
| |
223 | 234 |
| |
224 | 235 |
| |
| |||
331 | 342 |
| |
332 | 343 |
| |
333 | 344 |
| |
334 |
| - | |
| 345 | + | |
| 346 | + | |
335 | 347 |
| |
336 | 348 |
| |
337 | 349 |
| |
|
You can’t perform that action at this time.
0 commit comments