vision
image-detection
mathmanu commited on
Commit
9315afd
·
verified ·
1 Parent(s): d5688c0

Add yolo11 model files

Browse files
README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: agpl-3.0
3
+ tags:
4
+ - vision
5
+ - image-detection
6
+ datasets:
7
+ - COCO
8
+ ---
9
+
10
+ <div align="center">
11
+
12
+ # YOLO11 for TI EdgeAI
13
+
14
+ ### Real-Time Object Detector with an Enhanced Backbone and C2PSA Attention
15
+
16
+ [![License](https://img.shields.io/badge/License-AGPL%203.0-blue?style=for-the-badge)](https://opensource.org/licenses/AGPL-3.0)
17
+ [![Framework](https://img.shields.io/badge/Framework-ONNX-orange?style=for-the-badge)](https://onnx.ai/)
18
+ [![Task](https://img.shields.io/badge/Task-Object%20Detection-green?style=for-the-badge)](https://github.com/TexasInstruments/edgeai)
19
+ [![Dataset](https://img.shields.io/badge/Dataset-COCO-blueviolet?style=for-the-badge)](https://cocodataset.org/)
20
+
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## Overview
26
+
27
+ **YOLO11** is Ultralytics' successor to YOLOv8, released in September 2024. It keeps the overall one-stage, anchor-free detection pipeline but reworks the backbone and neck for more efficient feature extraction: the `C2f` block used throughout YOLOv8 is replaced by a `C3k2` block (a faster variant of the CSP bottleneck that can switch between smaller convolution kernels for efficiency), and a `C2PSA` (Cross-Stage Partial with Spatial Attention) module is inserted after the backbone's SPPF layer to add lightweight spatial-attention refinement to the extracted features. Together with a refined training pipeline, these changes let YOLO11 reach higher COCO mAP than the equivalent YOLOv8 scale while using noticeably fewer parameters — for example, YOLO11m matches or beats YOLOv8m's accuracy with about 22% fewer parameters.
28
+
29
+ YOLO11 is offered in five size variants — n, s, m, l, x — spanning a wide accuracy-speed trade-off, from resource-constrained edge devices up to high-throughput deployments. This model is optimized for **Texas Instruments MPU (Microprocessor Unit) devices**, targeting edge computer vision use cases such as industrial automation, smart cameras, robotics, and IoT vision.
30
+
31
+ > See [YOLO26](../YOLO26/) for the newest Ultralytics generation, with native end-to-end (NMS-free) detection.
32
+
33
+ ---
34
+
35
+ ## Model Variants
36
+
37
+ | Model | Params (M) | Input Size | mAP[.5:.95]% | Validated Devices | Config |
38
+ |-------|------------|------------|--------------|--------------------|--------|
39
+ | `yolo11n` | 2.6 | 640×640 | 39.5 | TDA4VH, TDA4VL | [yolo11n_model_config.yaml](yolo11n_model_config.yaml) |
40
+ | `yolo11s` | 9.4 | 640×640 | 47.0 | TDA4VH, TDA4VL | [yolo11s_model_config.yaml](yolo11s_model_config.yaml) |
41
+ | `yolo11m` | 20.1 | 640×640 | 51.5 | TDA4VH, TDA4VL | [yolo11m_model_config.yaml](yolo11m_model_config.yaml) |
42
+ | `yolo11l` | 25.3 | 640×640 | 53.4 | TDA4VH, TDA4VL | [yolo11l_model_config.yaml](yolo11l_model_config.yaml) |
43
+ | `yolo11x` | 56.9 | 640×640 | 54.7 | TDA4VH, TDA4VL | [yolo11x_model_config.yaml](yolo11x_model_config.yaml) |
44
+
45
+ **Recommended for edge deployment:** `yolo11n` (best accuracy/compute trade-off, smallest footprint)
46
+
47
+ ---
48
+
49
+ ## Quick Start
50
+
51
+ ### Prerequisites
52
+
53
+ ```bash
54
+ pip install onnx>=1.22.0
55
+ pip install onnxruntime>=1.23.2
56
+ pip install ultralytics
57
+ ```
58
+
59
+ For TI hardware deployment, also set up **[tidlrunner](https://github.com/TexasInstruments/edgeai-tidlrunner/blob/main/README.md)**.
60
+
61
+ If accessing this model from HuggingFace, clone the repository using the `hf` CLI:
62
+
63
+ ```bash
64
+ hf download <REPO_ID> --local-dir <download_location>
65
+ ```
66
+
67
+ ### Export the Model
68
+
69
+ ```bash
70
+ # Prepare the default model (yolo11n)
71
+ python prepare_model.py
72
+
73
+ # Prepare a specific model variant
74
+ python prepare_model.py --model yolo11s
75
+
76
+ # Prepare multiple variants in one run
77
+ python prepare_model.py --model yolo11n yolo11s yolo11m
78
+
79
+ # Prepare every supported variant
80
+ python prepare_model.py --model all
81
+
82
+ # List all supported variants and their local download/conversion status
83
+ python prepare_model.py --list-models
84
+
85
+ # Re-run shape fixing on an already-downloaded ONNX
86
+ python prepare_model.py --model yolo11n --skip-download
87
+ ```
88
+
89
+ The script automatically:
90
+ - Parses the variant's `.link` file to get the HuggingFace download URL for the `.pt` checkpoint
91
+ - Downloads the `.pt` model with `curl` if it isn't already present locally
92
+ - Converts the `.pt` model to ONNX (opset 17) using Ultralytics' `model.export()`
93
+ - Fixes dynamic input dimensions to a static shape (default `[1, 3, 640, 640]`)
94
+ - Runs ONNX shape inference and optional `onnx-simplifier` optimization, then validates the result
95
+
96
+ ### Compile and Infer uing edgeai-tidlrunner
97
+
98
+ > **Note:** Run the commands below from inside the `tidlrunner` directory (the cloned [edgeai-tidlrunner](https://github.com/TexasInstruments/edgeai-tidlrunner) repository), with `--config_path` pointing to this model's config file.
99
+
100
+ **Compile using edgeai-tidlrunner - on PC**
101
+
102
+ ```bash
103
+ cd /path/to/edgeai-tidlrunner
104
+ tidlrunner-cli compile --target_device J784S4 \
105
+ --config_path /path/to/yolo11n_model_config.yaml
106
+ ```
107
+
108
+ **Run Inference Benchmark - on device**
109
+
110
+ ```bash
111
+ cd /path/to/edgeai-tidlrunner
112
+ tidlrunner-cli infer --target_device J784S4 \
113
+ --config_path /path/to/yolo11n_model_config.yaml
114
+ ```
115
+
116
+ To evaluate accuracy instead, replace `infer` with `evaluate` in the command above.
117
+
118
+ ### Compile and Infer using edgeai-tidl-tools (Advanced):
119
+
120
+ Follow the instructions at https://github.com/TexasInstruments/edgeai-tidl-tools
121
+
122
+ ### Deploy using edgeai-tidl-tools:
123
+
124
+ Deplyment can be done using **[edgeai-tidl-tools](https://github.com/TexasInstruments/edgeai-tidl-tools)**. For ONNX models, onnxruntime-tidl with TIDL acceleration can be used. Consult the documentation of edgeai-tidl-tools for more details.
125
+
126
+ ---
127
+
128
+ ## Citation
129
+
130
+ Ultralytics has not published a formal research paper for YOLO11 due to the rapidly evolving nature of the models. If you use the YOLO11 model or any other software from the Ultralytics repository in your work, please cite it using the following format:
131
+
132
+ ```bibtex
133
+ @software{yolo11_ultralytics,
134
+ author = {Glenn Jocher and Jing Qiu},
135
+ title = {Ultralytics YOLO11},
136
+ version = {11.0.0},
137
+ year = {2024},
138
+ url = {https://github.com/ultralytics/ultralytics},
139
+ orcid = {0000-0001-5950-6979, 0000-0003-3783-7069},
140
+ license = {AGPL-3.0}
141
+ }
142
+ ```
143
+
144
+ ---
145
+
146
+ ## 🔗 Resources
147
+
148
+ | Resource | Link |
149
+ |----------|------|
150
+ | **Source Code** | [ultralytics/ultralytics](https://github.com/ultralytics/ultralytics) |
151
+ | **Documentation** | [YOLO11 Docs](https://docs.ultralytics.com/models/yolo11/) |
152
+ | **edgeai-tidl-tools** | [GitHub](https://github.com/TexasInstruments/edgeai-tidl-tools) |
153
+ | **edgeai-tidlrunner** | [GitHub](https://github.com/TexasInstruments/edgeai-tidlrunner) |
154
+ | **EdgeAI SDK** | [Documentation](https://github.com/TexasInstruments/edgeai/blob/main/edgeai-mpu/readme_sdk.md) |
155
+ | **EdgeAI MPU Overview** | [GitHub](https://github.com/TexasInstruments/edgeai/tree/main/edgeai-mpu) |
156
+ | **TI EdgeAI Ecosystem** | [GitHub](https://github.com/TexasInstruments/edgeai) |
157
+
158
+ ---
159
+
160
+ ## Related Models
161
+
162
+ <table>
163
+ <tr>
164
+ <td align="center">
165
+
166
+ **YOLOv8**
167
+ Predecessor generation
168
+ Anchor-free split head
169
+
170
+ </td>
171
+ <td align="center">
172
+
173
+ **YOLO26**
174
+ Newest Ultralytics generation
175
+ NMS-free end-to-end detection
176
+
177
+ </td>
178
+ <td align="center">
179
+
180
+ **YOLOX**
181
+ Anchor-free YOLO variant
182
+ Decoupled head design
183
+
184
+ </td>
185
+ <td align="center">
186
+
187
+ **RTMDet**
188
+ CNN-based alternative
189
+ Real-time mmdetection model
190
+
191
+ </td>
192
+ </tr>
193
+ </table>
194
+
195
+ ---
196
+
197
+ <div align="center">
198
+
199
+ **Maintained by:** Texas Instruments EdgeAI Team
200
+ **Last Updated:** August 2026
201
+
202
+ </div>
prepare_model.py ADDED
@@ -0,0 +1,656 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+
3
+ # Copyright (c) 2018-2026, Texas Instruments
4
+ # All Rights Reserved.
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions are met:
8
+ #
9
+ # * Redistributions of source code must retain the above copyright notice, this
10
+ # list of conditions and the following disclaimer.
11
+ #
12
+ # * Redistributions in binary form must reproduce the above copyright notice,
13
+ # this list of conditions and the following disclaimer in the documentation
14
+ # and/or other materials provided with the distribution.
15
+ #
16
+ # * Neither the name of the copyright holder nor the names of its
17
+ # contributors may be used to endorse or promote products derived from
18
+ # this software without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ """
32
+ Script to download YOLO11 PyTorch (.pt) model from HuggingFace and convert to ONNX
33
+ for hardware deployment on TI edge devices.
34
+
35
+ Reads .link files containing download URLs and automatically:
36
+ 1. Downloads the .pt model if not present
37
+ 2. Converts the .pt model to ONNX format using Ultralytics
38
+ 3. Fixes dynamic shapes to static shapes
39
+ 4. Validates the result
40
+
41
+ Link file format:
42
+ <download_url> -o <output_filename>
43
+
44
+ Example:
45
+ https://huggingface.co/Ultralytics/YOLO11/blob/main/yolo11n.pt -o yolo11n.pt
46
+ """
47
+
48
+ import sys
49
+ import subprocess
50
+ from pathlib import Path
51
+ import argparse
52
+
53
+
54
+ def _ensure_dependencies():
55
+ required = {"onnx": "onnx", "onnxsim": "onnx-simplifier", "ultralytics": "ultralytics"}
56
+ for module, package in required.items():
57
+ try:
58
+ __import__(module)
59
+ except ImportError:
60
+ print(f"Installing missing dependency: {package}")
61
+ subprocess.check_call([sys.executable, "-m", "pip", "install", package])
62
+
63
+
64
+ def parse_link_file(link_file_path):
65
+ """
66
+ Parse .link file to extract download URL and output filename.
67
+
68
+ Expected format: <URL> -o <filename>
69
+
70
+ Returns:
71
+ tuple: (download_url, output_filename) or (None, None) if parsing fails
72
+ """
73
+ try:
74
+ with open(link_file_path, 'r') as f:
75
+ content = f.read().strip()
76
+
77
+ for line in content.split('\n'):
78
+ line = line.strip()
79
+ if not line or line.startswith('#'):
80
+ continue
81
+
82
+ if '-o' in line:
83
+ parts = line.split('-o')
84
+ if len(parts) == 2:
85
+ url = parts[0].strip()
86
+ filename = parts[1].strip()
87
+
88
+ # Convert HuggingFace blob URLs to resolve URLs for direct download
89
+ if 'huggingface.co' in url and '/blob/' in url:
90
+ url = url.replace('/blob/', '/resolve/')
91
+
92
+ return url, filename
93
+
94
+ print(f"Error: Could not parse link file format. Expected: <URL> -o <filename>")
95
+ return None, None
96
+
97
+ except Exception as e:
98
+ print(f"Error reading link file: {e}")
99
+ return None, None
100
+
101
+
102
+ def download_model(url, output_path, force=False):
103
+ """
104
+ Download model from URL using curl.
105
+
106
+ Args:
107
+ url: Download URL
108
+ output_path: Path to save downloaded model
109
+ force: Force re-download even if file exists
110
+
111
+ Returns:
112
+ bool: True if successful, False otherwise
113
+ """
114
+ if output_path.exists() and not force:
115
+ print(f"Model already exists: {output_path}")
116
+ file_size = output_path.stat().st_size
117
+ print(f"File size: {file_size:,} bytes ({file_size / 1024 / 1024:.2f} MB)")
118
+ return True
119
+
120
+ print(f"\n📥 Downloading Model:")
121
+ print("-" * 80)
122
+ print(f"URL: {url}")
123
+ print(f"Output: {output_path}")
124
+ print()
125
+
126
+ try:
127
+ result = subprocess.run(
128
+ ['curl', '-L', url, '-o', str(output_path), '--progress-bar'],
129
+ check=True,
130
+ capture_output=False
131
+ )
132
+
133
+ if output_path.exists():
134
+ file_size = output_path.stat().st_size
135
+ print(f"\n✓ Download completed successfully!")
136
+ print(f"✓ File size: {file_size:,} bytes ({file_size / 1024 / 1024:.2f} MB)")
137
+ return True
138
+ else:
139
+ print(f"\n✗ Download failed: output file not created")
140
+ return False
141
+
142
+ except subprocess.CalledProcessError as e:
143
+ print(f"\n✗ Download failed: {e}")
144
+ return False
145
+ except FileNotFoundError:
146
+ print(f"\n✗ curl not found. Please install curl.")
147
+ return False
148
+
149
+
150
+ def convert_pt_to_onnx(pt_path, onnx_path, height=640, width=640):
151
+ """
152
+ Convert a YOLO11 PyTorch .pt model to ONNX format using Ultralytics.
153
+
154
+ Args:
155
+ pt_path: Path to the input .pt model
156
+ onnx_path: Desired output path for the ONNX model
157
+ height: Input image height
158
+ width: Input image width
159
+
160
+ Returns:
161
+ bool: True if successful, False otherwise
162
+ """
163
+ print(f"\n🔄 Converting .pt to ONNX:")
164
+ print("=" * 80)
165
+ print(f"Input (.pt): {pt_path}")
166
+ print(f"Output (.onnx): {onnx_path}")
167
+ print(f"Image size: {height}x{width}")
168
+
169
+ try:
170
+ from ultralytics import YOLO
171
+ except ImportError:
172
+ print("\n✗ ultralytics not installed.")
173
+ print(" Install with: pip install ultralytics")
174
+ return False
175
+
176
+ try:
177
+ model = YOLO(str(pt_path))
178
+
179
+ # Export to ONNX; Ultralytics places the file next to the .pt by default
180
+ exported = model.export(
181
+ format='onnx',
182
+ imgsz=(height, width),
183
+ dynamic=False,
184
+ simplify=False, # we run our own simplifier step below
185
+ opset=17,
186
+ )
187
+
188
+ exported_path = Path(exported)
189
+
190
+ # Move/rename to the desired output path if different
191
+ if exported_path.resolve() != onnx_path.resolve():
192
+ exported_path.rename(onnx_path)
193
+ print(f"\n✓ Moved exported model to: {onnx_path}")
194
+
195
+ if onnx_path.exists():
196
+ file_size = onnx_path.stat().st_size
197
+ print(f"✓ ONNX model size: {file_size:,} bytes ({file_size / 1024 / 1024:.2f} MB)")
198
+ return True
199
+ else:
200
+ print(f"\n✗ Conversion failed: output file not found at {onnx_path}")
201
+ return False
202
+
203
+ except Exception as e:
204
+ print(f"\n✗ Conversion failed: {e}")
205
+ return False
206
+
207
+
208
+ def fix_model_shape(model_path, output_path, batch_size=1, channels=3, height=640, width=640, use_simplifier=True):
209
+ """
210
+ Convert dynamic ONNX model input shape to fixed shape in all layers.
211
+
212
+ Uses ONNX shape inference to propagate fixed shapes through all intermediate layers.
213
+ Optionally uses onnxsim for additional simplification and optimization.
214
+ """
215
+ import onnx
216
+ from onnx import shape_inference
217
+
218
+ print(f"\n🔧 Fixing Model Shapes:")
219
+ print("=" * 80)
220
+ print(f"Input model: {model_path}")
221
+ print(f"Output model: {output_path}")
222
+
223
+ # Load model
224
+ print(f"\nLoading model...")
225
+ model = onnx.load(str(model_path))
226
+
227
+ # Get the first input (skip initializers)
228
+ graph = model.graph
229
+ input_tensor = None
230
+ for inp in graph.input:
231
+ if any(init.name == inp.name for init in graph.initializer):
232
+ continue
233
+ input_tensor = inp
234
+ break
235
+
236
+ if input_tensor is None:
237
+ print("✗ Error: No input tensor found!")
238
+ return False
239
+
240
+ # Print original shape
241
+ print(f"\n📋 Original Shape:")
242
+ print("-" * 80)
243
+ print(f"Input name: {input_tensor.name}")
244
+ original_shape = []
245
+ for dim in input_tensor.type.tensor_type.shape.dim:
246
+ if dim.dim_value:
247
+ original_shape.append(str(dim.dim_value))
248
+ elif dim.dim_param:
249
+ original_shape.append(f"'{dim.dim_param}'")
250
+ else:
251
+ original_shape.append("?")
252
+ print(f"Shape: [{', '.join(original_shape)}]")
253
+
254
+ # Modify input shape to fixed dimensions
255
+ print(f"\n🔧 Setting Fixed Shape:")
256
+ print("-" * 80)
257
+ new_shape = [batch_size, channels, height, width]
258
+ print(f"New shape: {new_shape}")
259
+ print(f"Format: [batch_size, channels, height, width]")
260
+
261
+ # Clear existing dimensions and add new fixed dimensions
262
+ input_tensor.type.tensor_type.shape.ClearField('dim')
263
+ for dim_value in new_shape:
264
+ dim = input_tensor.type.tensor_type.shape.dim.add()
265
+ dim.dim_value = dim_value
266
+
267
+ # Run shape inference
268
+ print(f"\n🔄 Running Shape Inference:")
269
+ print("-" * 80)
270
+ try:
271
+ model = shape_inference.infer_shapes(model)
272
+ value_info_count = len(model.graph.value_info)
273
+ print(f"✓ Propagated shapes through {value_info_count} intermediate tensors")
274
+ except Exception as e:
275
+ print(f"⚠ Warning: Shape inference issue: {e}")
276
+ print(" Continuing with partial inference...")
277
+
278
+ # Validate model
279
+ print(f"\n✅ Validating Model:")
280
+ print("-" * 80)
281
+ try:
282
+ onnx.checker.check_model(model)
283
+ print("✓ Model validation passed")
284
+ except Exception as e:
285
+ print(f"✗ Model validation failed: {e}")
286
+ return False
287
+
288
+ # Optional: Use onnx-simplifier
289
+ if use_simplifier:
290
+ print(f"\n🚀 Running ONNX Simplifier:")
291
+ print("-" * 80)
292
+ try:
293
+ import onnxsim
294
+ model_simplified, check = onnxsim.simplify(
295
+ model,
296
+ check_n=3,
297
+ perform_optimization=True,
298
+ skip_fuse_bn=False,
299
+ overwrite_input_shapes={input_tensor.name: new_shape}
300
+ )
301
+
302
+ if check:
303
+ print("✓ Model simplified and optimized")
304
+ model = model_simplified
305
+
306
+ original_nodes = len(graph.node)
307
+ simplified_nodes = len(model.graph.node)
308
+ if simplified_nodes < original_nodes:
309
+ print(f"✓ Reduced nodes: {original_nodes} → {simplified_nodes}")
310
+ else:
311
+ print("⚠ Simplification validation failed, using non-simplified version")
312
+
313
+ except ImportError:
314
+ print("⚠ onnx-simplifier not installed, skipping")
315
+ print(" Install with: pip install onnx-simplifier")
316
+ except Exception as e:
317
+ print(f"⚠ Simplification failed: {e}")
318
+ print(" Continuing with non-simplified model")
319
+
320
+ # Save the modified model
321
+ print(f"\n💾 Saving Fixed Model:")
322
+ print("-" * 80)
323
+ onnx.save(model, str(output_path))
324
+ output_size = output_path.stat().st_size
325
+ print(f"✓ Saved to: {output_path}")
326
+ print(f"✓ File size: {output_size:,} bytes ({output_size / 1024 / 1024:.2f} MB)")
327
+
328
+ # Final verification
329
+ print(f"\n🔍 Final Verification:")
330
+ print("-" * 80)
331
+ try:
332
+ verified_model = onnx.load(str(output_path))
333
+ onnx.checker.check_model(verified_model)
334
+
335
+ verified_graph = verified_model.graph
336
+ for inp in verified_graph.input:
337
+ if any(init.name == inp.name for init in verified_graph.initializer):
338
+ continue
339
+ shape = [dim.dim_value for dim in inp.type.tensor_type.shape.dim]
340
+ all_fixed = all(isinstance(s, int) and s > 0 for s in shape)
341
+ if all_fixed:
342
+ print(f"✓ Input '{inp.name}': {shape}")
343
+ else:
344
+ print(f"⚠ Input '{inp.name}' has dynamic dimensions")
345
+
346
+ if verified_graph.value_info:
347
+ fixed_count = sum(
348
+ 1 for vi in verified_graph.value_info
349
+ if all(dim.dim_value > 0 for dim in vi.type.tensor_type.shape.dim)
350
+ )
351
+ total_count = len(verified_graph.value_info)
352
+ print(f"✓ Fixed shapes: {fixed_count}/{total_count} intermediate tensors")
353
+
354
+ print(f"\n✨ Success! Fixed model ready for deployment")
355
+ return True
356
+
357
+ except Exception as e:
358
+ print(f"✗ Final verification failed: {e}")
359
+ return False
360
+
361
+
362
+ # Supported YOLO11 model variants
363
+ YOLO11_VARIANTS = ['yolo11n', 'yolo11s', 'yolo11m', 'yolo11l', 'yolo11x']
364
+ DEFAULT_MODEL = YOLO11_VARIANTS[0]
365
+
366
+
367
+ def list_models(script_dir):
368
+ """
369
+ Print all supported YOLO11 model variants along with their local status:
370
+ whether a .link file is present and whether the final ONNX output exists.
371
+ """
372
+ col = 14
373
+ header = f" {'Variant':<{col}}{'Link file':<12}{'ONNX output':<30}{'Status'}"
374
+ print("\n" + "=" * len(header))
375
+ print(" Available YOLO11 model variants")
376
+ print("=" * len(header))
377
+ print(header)
378
+ print(" " + "-" * (len(header) - 2))
379
+
380
+ for variant in YOLO11_VARIANTS:
381
+ link_file = script_dir / f'{variant}.onnx.link'
382
+
383
+ if not link_file.exists():
384
+ print(f" {variant:<{col}}{'missing':<12}{'-':<30}{'no link file'}")
385
+ continue
386
+
387
+ _, onnx_filename = parse_link_file(link_file)
388
+ onnx_filename = onnx_filename or '?'
389
+ final_onnx_output = script_dir / onnx_filename
390
+
391
+ if final_onnx_output.exists():
392
+ file_size = final_onnx_output.stat().st_size
393
+ status = f"downloaded ({file_size / 1024 / 1024:.1f} MB)"
394
+ else:
395
+ status = "not downloaded"
396
+
397
+ print(f" {variant:<{col}}{'ok':<12}{onnx_filename:<30}{status}")
398
+
399
+ print("=" * len(header) + "\n")
400
+
401
+
402
+ def process_single_model(model_variant, script_dir, args):
403
+ """
404
+ Process a single model variant.
405
+
406
+ Args:
407
+ model_variant: Name of the model variant (e.g., 'yolo11n')
408
+ script_dir: Directory containing the script and link files
409
+ args: Parsed command line arguments
410
+
411
+ Returns:
412
+ bool: True if successful, False otherwise
413
+ """
414
+ link_file_name = f'{model_variant}.onnx.link'
415
+ link_file = script_dir / link_file_name
416
+
417
+ if not link_file.exists():
418
+ print(f"Error: Link file not found: {link_file}")
419
+ print(f"Expected format in link file: <URL> -o <filename>")
420
+ return False
421
+
422
+ # Parse link file
423
+ print("📄 Parsing Link File:")
424
+ print("=" * 80)
425
+ print(f"Link file: {link_file}")
426
+
427
+ download_url, onnx_filename = parse_link_file(link_file)
428
+
429
+ if download_url is None or onnx_filename is None:
430
+ return False
431
+
432
+ print(f"Download URL: {download_url}")
433
+ print(f"ONNX model name (from .link file): {onnx_filename}")
434
+
435
+ # The final output uses the name from .link file
436
+ final_onnx_output = script_dir / onnx_filename
437
+
438
+ # Derive the .pt filename from the URL (last path segment, keeping .pt extension)
439
+ pt_filename = Path(download_url.split('?')[0]).name # e.g. yolo11n.pt
440
+ if not pt_filename.endswith('.pt'):
441
+ pt_filename = Path(onnx_filename).stem + '.pt'
442
+ pt_path = script_dir / pt_filename
443
+
444
+ # Temporary ONNX file (before shape fixing)
445
+ temp_onnx_path = script_dir / f".tmp_{onnx_filename}"
446
+
447
+ print(f"PT download path: {pt_path.name}")
448
+ print(f"Final ONNX output: {final_onnx_output.name}")
449
+ print(f"Intermediate ONNX: {temp_onnx_path.name}")
450
+
451
+ if args.skip_download:
452
+ # User wants to fix an existing ONNX model
453
+ if not final_onnx_output.exists():
454
+ print(f"\n✗ Error: ONNX model file not found: {final_onnx_output}")
455
+ print(f" Run without --skip-download to download and convert it first.")
456
+ return False
457
+ print(f"Using existing ONNX model: {final_onnx_output.name}")
458
+ model_path_for_fixing = final_onnx_output
459
+ elif final_onnx_output.exists() and not args.force_download:
460
+ # Final ONNX already present — skip download and conversion entirely
461
+ file_size = final_onnx_output.stat().st_size
462
+ print(f"\n⏭ Skipping download and ONNX conversion:")
463
+ print(f" {final_onnx_output.name} already exists "
464
+ f"({file_size:,} bytes / {file_size / 1024 / 1024:.2f} MB).")
465
+ print(f" Use --force-download to re-download and re-convert.")
466
+ model_path_for_fixing = final_onnx_output
467
+ else:
468
+ # Step 1: Download .pt model (always kept)
469
+ success = download_model(download_url, pt_path, force=args.force_download)
470
+ if not success:
471
+ print("\n✗ Download failed, aborting.")
472
+ if pt_path.exists():
473
+ pt_path.unlink()
474
+ return False
475
+
476
+ # Step 2: Convert .pt → ONNX to temporary location
477
+ success = convert_pt_to_onnx(
478
+ pt_path,
479
+ temp_onnx_path,
480
+ height=args.height,
481
+ width=args.width,
482
+ )
483
+ if not success:
484
+ print("\n✗ ONNX conversion failed, aborting.")
485
+ # Clean up temporary files
486
+ if temp_onnx_path.exists():
487
+ temp_onnx_path.unlink()
488
+ return False
489
+
490
+ print(f"\n📦 PT model kept at: {pt_path.name}")
491
+ model_path_for_fixing = temp_onnx_path
492
+
493
+ # Step 3: Fix shapes on the ONNX model (output to final location)
494
+ success = fix_model_shape(
495
+ model_path_for_fixing,
496
+ final_onnx_output,
497
+ batch_size=args.batch_size,
498
+ channels=args.channels,
499
+ height=args.height,
500
+ width=args.width,
501
+ use_simplifier=not args.no_simplifier
502
+ )
503
+
504
+ if success:
505
+ # Step 4: Clean up intermediate file (unless --keep-intermediate)
506
+ if not args.skip_download and model_path_for_fixing != final_onnx_output:
507
+ if args.keep_intermediate:
508
+ print(f"\n📦 Keeping intermediate file: {model_path_for_fixing.name}")
509
+ else:
510
+ print(f"\n🗑️ Cleaning up intermediate file...")
511
+ try:
512
+ model_path_for_fixing.unlink()
513
+ print(f"✓ Removed: {model_path_for_fixing.name}")
514
+ except Exception as e:
515
+ print(f"⚠ Could not remove intermediate file: {e}")
516
+
517
+ print("\n" + "=" * 80)
518
+ print("✅ COMPLETE!")
519
+ print("=" * 80)
520
+ print(f"Final model: {final_onnx_output.name}")
521
+ print(f"Location: {script_dir}")
522
+ print(f"Input shape: [{args.batch_size}, {args.channels}, {args.height}, {args.width}]")
523
+ return True
524
+ else:
525
+ print("\n✗ Shape fixing failed")
526
+ # Clean up temporary file on failure
527
+ if not args.skip_download and model_path_for_fixing.exists() and model_path_for_fixing != final_onnx_output:
528
+ model_path_for_fixing.unlink()
529
+ return False
530
+
531
+
532
+ def main():
533
+ parser = argparse.ArgumentParser(
534
+ description='Download YOLO11 .pt model, convert to ONNX, and fix shapes for hardware deployment',
535
+ formatter_class=argparse.RawDescriptionHelpFormatter,
536
+ epilog="""
537
+ Supported model variants: yolo11n, yolo11s, yolo11m, yolo11l, yolo11x
538
+
539
+ Notes:
540
+ If the final ONNX file already exists, download and conversion are skipped
541
+ automatically and the existing file is used directly. Pass --force-download
542
+ to override this behaviour and re-download / re-convert.
543
+
544
+ Examples:
545
+ # Use default .link file and settings (downloads .pt, converts to ONNX, keeps .pt)
546
+ %(prog)s
547
+
548
+ # Specify a model variant by name (uses <variant>.onnx.link automatically)
549
+ %(prog)s --model yolo11s
550
+ %(prog)s --model yolo11m
551
+ %(prog)s --model yolo11l
552
+ %(prog)s --model yolo11x
553
+
554
+ # Specify multiple models to process
555
+ %(prog)s --model yolo11n yolo11s yolo11m
556
+ %(prog)s --model yolo11l yolo11x
557
+
558
+ # Prepare every supported model variant
559
+ %(prog)s --model all
560
+
561
+ # List all supported model variants and their local status
562
+ %(prog)s --list-models
563
+
564
+ # Specify custom .link file explicitly
565
+ %(prog)s --link-file yolo11n.onnx.link
566
+
567
+ # Custom shape dimensions
568
+ %(prog)s --batch-size 4 --height 640 --width 640
569
+
570
+ # Force re-download and re-conversion even if ONNX already exists
571
+ %(prog)s --force-download
572
+
573
+ # Skip model simplification (faster)
574
+ %(prog)s --no-simplifier
575
+
576
+ # Skip download and conversion (fix existing ONNX model only)
577
+ %(prog)s --skip-download
578
+
579
+ # Keep intermediate downloaded file (the temporary ONNX before shape fixing)
580
+ %(prog)s --keep-intermediate
581
+ """
582
+ )
583
+
584
+ parser.add_argument('--model', nargs='+', type=str, default=[DEFAULT_MODEL],
585
+ choices=YOLO11_VARIANTS + ['all'],
586
+ metavar='VARIANT',
587
+ help=f'YOLO11 model variant(s) to prepare. Default: {DEFAULT_MODEL}. '
588
+ f'One or more of: {", ".join(YOLO11_VARIANTS)}. '
589
+ f"Use 'all' to prepare every supported variant. "
590
+ f'Run --list-models to see all options.')
591
+ parser.add_argument('--link-file', type=str, default=None,
592
+ help='Link file containing download URL for the .pt model '
593
+ '(default: <model>.onnx.link). Ignored if more than one '
594
+ '--model variant is specified.')
595
+ parser.add_argument('--batch-size', type=int, default=1,
596
+ help='Fixed batch size (default: 1)')
597
+ parser.add_argument('--channels', type=int, default=3,
598
+ help='Number of channels (default: 3)')
599
+ parser.add_argument('--height', type=int, default=640,
600
+ help='Image height (default: 640)')
601
+ parser.add_argument('--width', type=int, default=640,
602
+ help='Image width (default: 640)')
603
+ parser.add_argument('--force-download', action='store_true',
604
+ help='Force re-download and re-conversion even if the final ONNX already exists')
605
+ parser.add_argument('--skip-download', action='store_true',
606
+ help='Skip download and conversion; fix existing ONNX model only')
607
+ parser.add_argument('--no-simplifier', action='store_true',
608
+ help='Skip onnx-simplifier optimization')
609
+ parser.add_argument('--keep-intermediate', action='store_true',
610
+ help='Keep intermediate downloaded file (the temporary ONNX before shape fixing)')
611
+ parser.add_argument('--list-models', action='store_true',
612
+ help='Print all supported model variants and their local status, then exit.')
613
+
614
+ args = parser.parse_args()
615
+
616
+ # Resolve paths
617
+ script_dir = Path(__file__).parent
618
+
619
+ if args.list_models:
620
+ list_models(script_dir)
621
+ sys.exit(0)
622
+
623
+ if 'all' in args.model:
624
+ args.model = list(YOLO11_VARIANTS)
625
+
626
+ # Resolve which variants to process. --link-file overrides the model name
627
+ # only when a single model was requested (matches historical behavior).
628
+ if args.link_file is not None:
629
+ if len(args.model) > 1:
630
+ print("Warning: --link-file is ignored when multiple --model variants are specified")
631
+ models_to_process = args.model
632
+ else:
633
+ models_to_process = [args.link_file.replace('.onnx.link', '')]
634
+ else:
635
+ models_to_process = args.model
636
+
637
+ _ensure_dependencies()
638
+
639
+ print(f"🚀 Processing {len(models_to_process)} model(s): {', '.join(models_to_process)}")
640
+ print("=" * 80)
641
+
642
+ success_count = 0
643
+ for model_variant in models_to_process:
644
+ print(f"\n🔄 Processing model: {model_variant}")
645
+ print("-" * 80)
646
+ if process_single_model(model_variant, script_dir, args):
647
+ success_count += 1
648
+ print(f"\n✅ Completed processing for {model_variant}")
649
+ print("=" * 80)
650
+
651
+ print(f"\n🎯 SUMMARY: Successfully processed {success_count}/{len(models_to_process)} model(s)")
652
+ sys.exit(0 if success_count == len(models_to_process) else 1)
653
+
654
+
655
+ if __name__ == "__main__":
656
+ main()
yolo11l.onnx.link ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/Ultralytics/YOLO11/blob/main/yolo11l.pt -o yolo11l.onnx
yolo11l_model_config.yaml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task_type: detection
2
+ input_dataset: coco
3
+ preprocess:
4
+ resize: 640
5
+ crop: 640
6
+ data_layout: NCHW
7
+ reverse_channels: false
8
+ backend: cv2
9
+ interpolation: null
10
+ resize_with_pad:
11
+ - true
12
+ - center
13
+ pad_color:
14
+ - 114
15
+ - 114
16
+ - 114
17
+ name: image_preprocess
18
+ session:
19
+ tidl_offload: true
20
+ input_optimization: false
21
+ input_data_layout: NCHW
22
+ input_mean:
23
+ - 0.0
24
+ - 0.0
25
+ - 0.0
26
+ input_scale:
27
+ - 0.003922
28
+ - 0.003922
29
+ - 0.003922
30
+ # runtime_options:
31
+ # advanced_options:output_feature_16bit_names_list: ''
32
+ # advanced_options:params_16bit_names_list: ''
33
+ # object_detection:meta_arch_type: 6
34
+ model_path: yolo11l.onnx
35
+ model_id: od-mh8007
36
+ input_details: null
37
+ output_details: null
38
+ num_inputs: 1
39
+ postprocess:
40
+ enable_nms: 1
41
+ detection_nms_threshold: 0.7
42
+ # detection_threshold: 0.001
43
+ reshape_list: null
44
+ formatter:
45
+ name: DetectionXYWH2XYXYCenterXY
46
+ resize_with_pad:
47
+ - true
48
+ - center
49
+ normalized_detections: false
50
+ shuffle_indices: null
51
+ squeeze_axis: null
52
+ ignore_index: null
53
+ model_output_type: combined
54
+ transpose_indices: [0,2,1]
55
+ logits_bbox_to_bbox_ls:
56
+ score_fn: null
57
+ bbox_index: [0,4]
58
+ scores_index: [4,-1]
59
+ keypoint: false
60
+ object6dpose: false
61
+ name: detection_postprocess
62
+ metric:
63
+ label_offset_pred:
64
+ 0: 1
65
+ 1: 2
66
+ 2: 3
67
+ 3: 4
68
+ 4: 5
69
+ 5: 6
70
+ 6: 7
71
+ 7: 8
72
+ 8: 9
73
+ 9: 10
74
+ 10: 11
75
+ 11: 13
76
+ 12: 14
77
+ 13: 15
78
+ 14: 16
79
+ 15: 17
80
+ 16: 18
81
+ 17: 19
82
+ 18: 20
83
+ 19: 21
84
+ 20: 22
85
+ 21: 23
86
+ 22: 24
87
+ 23: 25
88
+ 24: 27
89
+ 25: 28
90
+ 26: 31
91
+ 27: 32
92
+ 28: 33
93
+ 29: 34
94
+ 30: 35
95
+ 31: 36
96
+ 32: 37
97
+ 33: 38
98
+ 34: 39
99
+ 35: 40
100
+ 36: 41
101
+ 37: 42
102
+ 38: 43
103
+ 39: 44
104
+ 40: 46
105
+ 41: 47
106
+ 42: 48
107
+ 43: 49
108
+ 44: 50
109
+ 45: 51
110
+ 46: 52
111
+ 47: 53
112
+ 48: 54
113
+ 49: 55
114
+ 50: 56
115
+ 51: 57
116
+ 52: 58
117
+ 53: 59
118
+ 54: 60
119
+ 55: 61
120
+ 56: 62
121
+ 57: 63
122
+ 58: 64
123
+ 59: 65
124
+ 60: 67
125
+ 61: 70
126
+ 62: 72
127
+ 63: 73
128
+ 64: 74
129
+ 65: 75
130
+ 66: 76
131
+ 67: 77
132
+ 68: 78
133
+ 69: 79
134
+ 70: 80
135
+ 71: 81
136
+ 72: 82
137
+ 73: 84
138
+ 74: 85
139
+ 75: 86
140
+ 76: 87
141
+ 77: 88
142
+ 78: 89
143
+ 79: 90
144
+ 80: 91
145
+ model_info:
146
+ metric_reference:
147
+ accuracy_ap[.5:.95]%: 53.4
148
+ compact_name: yolo11l-coco-640x640
149
+ shortlisted: true
yolo11m.onnx.link ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/Ultralytics/YOLO11/blob/main/yolo11m.pt -o yolo11m.onnx
yolo11m_model_config.yaml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task_type: detection
2
+ input_dataset: coco
3
+ preprocess:
4
+ resize: 640
5
+ crop: 640
6
+ data_layout: NCHW
7
+ reverse_channels: false
8
+ backend: cv2
9
+ interpolation: null
10
+ resize_with_pad:
11
+ - true
12
+ - center
13
+ pad_color:
14
+ - 114
15
+ - 114
16
+ - 114
17
+ name: image_preprocess
18
+ session:
19
+ tidl_offload: true
20
+ input_optimization: false
21
+ input_data_layout: NCHW
22
+ input_mean:
23
+ - 0.0
24
+ - 0.0
25
+ - 0.0
26
+ input_scale:
27
+ - 0.003922
28
+ - 0.003922
29
+ - 0.003922
30
+ # runtime_options:
31
+ # advanced_options:output_feature_16bit_names_list: ''
32
+ # advanced_options:params_16bit_names_list: ''
33
+ # object_detection:meta_arch_type: 6
34
+ model_path: yolo11m.onnx
35
+ model_id: od-mh8006
36
+ input_details: null
37
+ output_details: null
38
+ num_inputs: 1
39
+ postprocess:
40
+ enable_nms: 1
41
+ detection_nms_threshold: 0.7
42
+ # detection_threshold: 0.001
43
+ reshape_list: null
44
+ formatter:
45
+ name: DetectionXYWH2XYXYCenterXY
46
+ resize_with_pad:
47
+ - true
48
+ - center
49
+ normalized_detections: false
50
+ shuffle_indices: null
51
+ squeeze_axis: null
52
+ ignore_index: null
53
+ model_output_type: combined
54
+ transpose_indices: [0,2,1]
55
+ logits_bbox_to_bbox_ls:
56
+ score_fn: null
57
+ bbox_index: [0,4]
58
+ scores_index: [4,-1]
59
+ keypoint: false
60
+ object6dpose: false
61
+ name: detection_postprocess
62
+ metric:
63
+ label_offset_pred:
64
+ 0: 1
65
+ 1: 2
66
+ 2: 3
67
+ 3: 4
68
+ 4: 5
69
+ 5: 6
70
+ 6: 7
71
+ 7: 8
72
+ 8: 9
73
+ 9: 10
74
+ 10: 11
75
+ 11: 13
76
+ 12: 14
77
+ 13: 15
78
+ 14: 16
79
+ 15: 17
80
+ 16: 18
81
+ 17: 19
82
+ 18: 20
83
+ 19: 21
84
+ 20: 22
85
+ 21: 23
86
+ 22: 24
87
+ 23: 25
88
+ 24: 27
89
+ 25: 28
90
+ 26: 31
91
+ 27: 32
92
+ 28: 33
93
+ 29: 34
94
+ 30: 35
95
+ 31: 36
96
+ 32: 37
97
+ 33: 38
98
+ 34: 39
99
+ 35: 40
100
+ 36: 41
101
+ 37: 42
102
+ 38: 43
103
+ 39: 44
104
+ 40: 46
105
+ 41: 47
106
+ 42: 48
107
+ 43: 49
108
+ 44: 50
109
+ 45: 51
110
+ 46: 52
111
+ 47: 53
112
+ 48: 54
113
+ 49: 55
114
+ 50: 56
115
+ 51: 57
116
+ 52: 58
117
+ 53: 59
118
+ 54: 60
119
+ 55: 61
120
+ 56: 62
121
+ 57: 63
122
+ 58: 64
123
+ 59: 65
124
+ 60: 67
125
+ 61: 70
126
+ 62: 72
127
+ 63: 73
128
+ 64: 74
129
+ 65: 75
130
+ 66: 76
131
+ 67: 77
132
+ 68: 78
133
+ 69: 79
134
+ 70: 80
135
+ 71: 81
136
+ 72: 82
137
+ 73: 84
138
+ 74: 85
139
+ 75: 86
140
+ 76: 87
141
+ 77: 88
142
+ 78: 89
143
+ 79: 90
144
+ 80: 91
145
+ model_info:
146
+ metric_reference:
147
+ accuracy_ap[.5:.95]%: 51.5
148
+ compact_name: yolo11m-coco-640x640
149
+ shortlisted: true
yolo11n.onnx.link ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/Ultralytics/YOLO11/blob/main/yolo11n.pt -o yolo11n.onnx
yolo11n_model_config.yaml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task_type: detection
2
+ input_dataset: coco
3
+ preprocess:
4
+ resize: 640
5
+ crop: 640
6
+ data_layout: NCHW
7
+ reverse_channels: false
8
+ backend: cv2
9
+ interpolation: null
10
+ resize_with_pad:
11
+ - true
12
+ - center
13
+ pad_color:
14
+ - 114
15
+ - 114
16
+ - 114
17
+ name: image_preprocess
18
+ session:
19
+ tidl_offload: true
20
+ input_optimization: false
21
+ input_data_layout: NCHW
22
+ input_mean:
23
+ - 0.0
24
+ - 0.0
25
+ - 0.0
26
+ input_scale:
27
+ - 0.003922
28
+ - 0.003922
29
+ - 0.003922
30
+ # runtime_options:
31
+ # advanced_options:output_feature_16bit_names_list: ''
32
+ # advanced_options:params_16bit_names_list: ''
33
+ # object_detection:meta_arch_type: 6
34
+ model_path: yolo11n.onnx
35
+ model_id: od-mh8004
36
+ input_details: null
37
+ output_details: null
38
+ num_inputs: 1
39
+ postprocess:
40
+ enable_nms: 1
41
+ detection_nms_threshold: 0.7
42
+ # detection_threshold: 0.001
43
+ reshape_list: null
44
+ formatter:
45
+ name: DetectionXYWH2XYXYCenterXY
46
+ resize_with_pad:
47
+ - true
48
+ - center
49
+ normalized_detections: false
50
+ shuffle_indices: null
51
+ squeeze_axis: null
52
+ ignore_index: null
53
+ model_output_type: combined
54
+ transpose_indices: [0,2,1]
55
+ logits_bbox_to_bbox_ls:
56
+ score_fn: null
57
+ bbox_index: [0,4]
58
+ scores_index: [4,-1]
59
+ keypoint: false
60
+ object6dpose: false
61
+ name: detection_postprocess
62
+ metric:
63
+ label_offset_pred:
64
+ 0: 1
65
+ 1: 2
66
+ 2: 3
67
+ 3: 4
68
+ 4: 5
69
+ 5: 6
70
+ 6: 7
71
+ 7: 8
72
+ 8: 9
73
+ 9: 10
74
+ 10: 11
75
+ 11: 13
76
+ 12: 14
77
+ 13: 15
78
+ 14: 16
79
+ 15: 17
80
+ 16: 18
81
+ 17: 19
82
+ 18: 20
83
+ 19: 21
84
+ 20: 22
85
+ 21: 23
86
+ 22: 24
87
+ 23: 25
88
+ 24: 27
89
+ 25: 28
90
+ 26: 31
91
+ 27: 32
92
+ 28: 33
93
+ 29: 34
94
+ 30: 35
95
+ 31: 36
96
+ 32: 37
97
+ 33: 38
98
+ 34: 39
99
+ 35: 40
100
+ 36: 41
101
+ 37: 42
102
+ 38: 43
103
+ 39: 44
104
+ 40: 46
105
+ 41: 47
106
+ 42: 48
107
+ 43: 49
108
+ 44: 50
109
+ 45: 51
110
+ 46: 52
111
+ 47: 53
112
+ 48: 54
113
+ 49: 55
114
+ 50: 56
115
+ 51: 57
116
+ 52: 58
117
+ 53: 59
118
+ 54: 60
119
+ 55: 61
120
+ 56: 62
121
+ 57: 63
122
+ 58: 64
123
+ 59: 65
124
+ 60: 67
125
+ 61: 70
126
+ 62: 72
127
+ 63: 73
128
+ 64: 74
129
+ 65: 75
130
+ 66: 76
131
+ 67: 77
132
+ 68: 78
133
+ 69: 79
134
+ 70: 80
135
+ 71: 81
136
+ 72: 82
137
+ 73: 84
138
+ 74: 85
139
+ 75: 86
140
+ 76: 87
141
+ 77: 88
142
+ 78: 89
143
+ 79: 90
144
+ 80: 91
145
+ model_info:
146
+ metric_reference:
147
+ accuracy_ap[.5:.95]%: 37.3
148
+ compact_name: yolo11n-coco-640x640
149
+ shortlisted: true
yolo11s.onnx.link ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/Ultralytics/YOLO11/blob/main/yolo11s.pt -o yolo11s.onnx
yolo11s_model_config.yaml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task_type: detection
2
+ input_dataset: coco
3
+ preprocess:
4
+ resize: 640
5
+ crop: 640
6
+ data_layout: NCHW
7
+ reverse_channels: false
8
+ backend: cv2
9
+ interpolation: null
10
+ resize_with_pad:
11
+ - true
12
+ - center
13
+ pad_color:
14
+ - 114
15
+ - 114
16
+ - 114
17
+ name: image_preprocess
18
+ session:
19
+ tidl_offload: true
20
+ input_optimization: false
21
+ input_data_layout: NCHW
22
+ input_mean:
23
+ - 0.0
24
+ - 0.0
25
+ - 0.0
26
+ input_scale:
27
+ - 0.003922
28
+ - 0.003922
29
+ - 0.003922
30
+ # runtime_options:
31
+ # advanced_options:output_feature_16bit_names_list: ''
32
+ # advanced_options:params_16bit_names_list: ''
33
+ # object_detection:meta_arch_type: 6
34
+ model_path: yolo11s.onnx
35
+ model_id: od-mh8005
36
+ input_details: null
37
+ output_details: null
38
+ num_inputs: 1
39
+ postprocess:
40
+ enable_nms: 1
41
+ detection_nms_threshold: 0.7
42
+ # detection_threshold: 0.001
43
+ reshape_list: null
44
+ formatter:
45
+ name: DetectionXYWH2XYXYCenterXY
46
+ resize_with_pad:
47
+ - true
48
+ - center
49
+ normalized_detections: false
50
+ shuffle_indices: null
51
+ squeeze_axis: null
52
+ ignore_index: null
53
+ model_output_type: combined
54
+ transpose_indices: [0,2,1]
55
+ logits_bbox_to_bbox_ls:
56
+ score_fn: null
57
+ bbox_index: [0,4]
58
+ scores_index: [4,-1]
59
+ keypoint: false
60
+ object6dpose: false
61
+ name: detection_postprocess
62
+ metric:
63
+ label_offset_pred:
64
+ 0: 1
65
+ 1: 2
66
+ 2: 3
67
+ 3: 4
68
+ 4: 5
69
+ 5: 6
70
+ 6: 7
71
+ 7: 8
72
+ 8: 9
73
+ 9: 10
74
+ 10: 11
75
+ 11: 13
76
+ 12: 14
77
+ 13: 15
78
+ 14: 16
79
+ 15: 17
80
+ 16: 18
81
+ 17: 19
82
+ 18: 20
83
+ 19: 21
84
+ 20: 22
85
+ 21: 23
86
+ 22: 24
87
+ 23: 25
88
+ 24: 27
89
+ 25: 28
90
+ 26: 31
91
+ 27: 32
92
+ 28: 33
93
+ 29: 34
94
+ 30: 35
95
+ 31: 36
96
+ 32: 37
97
+ 33: 38
98
+ 34: 39
99
+ 35: 40
100
+ 36: 41
101
+ 37: 42
102
+ 38: 43
103
+ 39: 44
104
+ 40: 46
105
+ 41: 47
106
+ 42: 48
107
+ 43: 49
108
+ 44: 50
109
+ 45: 51
110
+ 46: 52
111
+ 47: 53
112
+ 48: 54
113
+ 49: 55
114
+ 50: 56
115
+ 51: 57
116
+ 52: 58
117
+ 53: 59
118
+ 54: 60
119
+ 55: 61
120
+ 56: 62
121
+ 57: 63
122
+ 58: 64
123
+ 59: 65
124
+ 60: 67
125
+ 61: 70
126
+ 62: 72
127
+ 63: 73
128
+ 64: 74
129
+ 65: 75
130
+ 66: 76
131
+ 67: 77
132
+ 68: 78
133
+ 69: 79
134
+ 70: 80
135
+ 71: 81
136
+ 72: 82
137
+ 73: 84
138
+ 74: 85
139
+ 75: 86
140
+ 76: 87
141
+ 77: 88
142
+ 78: 89
143
+ 79: 90
144
+ 80: 91
145
+ model_info:
146
+ metric_reference:
147
+ accuracy_ap[.5:.95]%: 47.0
148
+ compact_name: yolo11s-coco-640x640
149
+ shortlisted: true
yolo11x.onnx.link ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/Ultralytics/YOLO11/blob/main/yolo11x.pt -o yolo11x.onnx
yolo11x_model_config.yaml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task_type: detection
2
+ input_dataset: coco
3
+ preprocess:
4
+ resize: 640
5
+ crop: 640
6
+ data_layout: NCHW
7
+ reverse_channels: false
8
+ backend: cv2
9
+ interpolation: null
10
+ resize_with_pad:
11
+ - true
12
+ - center
13
+ pad_color:
14
+ - 114
15
+ - 114
16
+ - 114
17
+ name: image_preprocess
18
+ session:
19
+ tidl_offload: true
20
+ input_optimization: false
21
+ input_data_layout: NCHW
22
+ input_mean:
23
+ - 0.0
24
+ - 0.0
25
+ - 0.0
26
+ input_scale:
27
+ - 0.003922
28
+ - 0.003922
29
+ - 0.003922
30
+ # runtime_options:
31
+ # advanced_options:output_feature_16bit_names_list: ''
32
+ # advanced_options:params_16bit_names_list: ''
33
+ # object_detection:meta_arch_type: 6
34
+ model_path: yolo11x.onnx
35
+ model_id: od-mh8008
36
+ input_details: null
37
+ output_details: null
38
+ num_inputs: 1
39
+ postprocess:
40
+ enable_nms: 1
41
+ detection_nms_threshold: 0.7
42
+ # detection_threshold: 0.001
43
+ reshape_list: null
44
+ formatter:
45
+ name: DetectionXYWH2XYXYCenterXY
46
+ resize_with_pad:
47
+ - true
48
+ - center
49
+ normalized_detections: false
50
+ shuffle_indices: null
51
+ squeeze_axis: null
52
+ ignore_index: null
53
+ model_output_type: combined
54
+ transpose_indices: [0,2,1]
55
+ logits_bbox_to_bbox_ls:
56
+ score_fn: null
57
+ bbox_index: [0,4]
58
+ scores_index: [4,-1]
59
+ keypoint: false
60
+ object6dpose: false
61
+ name: detection_postprocess
62
+ metric:
63
+ label_offset_pred:
64
+ 0: 1
65
+ 1: 2
66
+ 2: 3
67
+ 3: 4
68
+ 4: 5
69
+ 5: 6
70
+ 6: 7
71
+ 7: 8
72
+ 8: 9
73
+ 9: 10
74
+ 10: 11
75
+ 11: 13
76
+ 12: 14
77
+ 13: 15
78
+ 14: 16
79
+ 15: 17
80
+ 16: 18
81
+ 17: 19
82
+ 18: 20
83
+ 19: 21
84
+ 20: 22
85
+ 21: 23
86
+ 22: 24
87
+ 23: 25
88
+ 24: 27
89
+ 25: 28
90
+ 26: 31
91
+ 27: 32
92
+ 28: 33
93
+ 29: 34
94
+ 30: 35
95
+ 31: 36
96
+ 32: 37
97
+ 33: 38
98
+ 34: 39
99
+ 35: 40
100
+ 36: 41
101
+ 37: 42
102
+ 38: 43
103
+ 39: 44
104
+ 40: 46
105
+ 41: 47
106
+ 42: 48
107
+ 43: 49
108
+ 44: 50
109
+ 45: 51
110
+ 46: 52
111
+ 47: 53
112
+ 48: 54
113
+ 49: 55
114
+ 50: 56
115
+ 51: 57
116
+ 52: 58
117
+ 53: 59
118
+ 54: 60
119
+ 55: 61
120
+ 56: 62
121
+ 57: 63
122
+ 58: 64
123
+ 59: 65
124
+ 60: 67
125
+ 61: 70
126
+ 62: 72
127
+ 63: 73
128
+ 64: 74
129
+ 65: 75
130
+ 66: 76
131
+ 67: 77
132
+ 68: 78
133
+ 69: 79
134
+ 70: 80
135
+ 71: 81
136
+ 72: 82
137
+ 73: 84
138
+ 74: 85
139
+ 75: 86
140
+ 76: 87
141
+ 77: 88
142
+ 78: 89
143
+ 79: 90
144
+ 80: 91
145
+ model_info:
146
+ metric_reference:
147
+ accuracy_ap[.5:.95]%: 54.7
148
+ compact_name: yolo11x-coco-640x640
149
+ shortlisted: true