|
1 | | -# YOLO ONNX Exports for OpenShot |
| 1 | +# OpenShot ONNX Exports |
2 | 2 |
|
3 | | -This repo builds OpenCV-friendly ONNX exports of official Ultralytics YOLO |
4 | | -segmentation models for use in OpenShot and libopenshot. |
| 3 | +This repository builds OpenCV-friendly ONNX model packages for OpenShot and |
| 4 | +libopenshot. The generated ONNX files and zip packages are static runtime |
| 5 | +assets: OpenShot should not need Python, PyTorch, or the upstream training |
| 6 | +frameworks after export. |
5 | 7 |
|
6 | | -The generated models are static ONNX graphs: no Python, PyTorch, or Ultralytics |
7 | | -runtime is needed after export. OpenShot/libopenshot can load them with OpenCV |
8 | | -DNN and handle thresholds, NMS, labels, boxes, and masks in C++. |
| 8 | +## Model Families |
9 | 9 |
|
10 | | -## Getting Started |
| 10 | +| Family | Purpose | Directory | |
| 11 | +| --- | --- | --- | |
| 12 | +| YOLO | Object detection and instance segmentation | [`yolo/`](yolo/) | |
| 13 | +| EfficientSAM | Prompted seed-mask generation for Object Mask | [`efficient-sam/`](efficient-sam/) | |
| 14 | +| Cutie | Video object mask propagation for Object Mask | [`cutie/`](cutie/) | |
11 | 15 |
|
12 | | -```bash |
13 | | -python3 -m venv .venv |
14 | | -source .venv/bin/activate |
| 16 | +XMem remains in `experiments/` as historical scratch work and is not promoted as |
| 17 | +a supported release family. |
15 | 18 |
|
16 | | -python -m pip install --upgrade pip |
17 | | -python -m pip install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/cpu |
18 | | -python -m pip install --no-deps -r requirements.txt |
| 19 | +## Release Artifacts |
19 | 20 |
|
20 | | -python scripts/export_yolo_seg_onnx.py |
21 | | -``` |
| 21 | +Generated model binaries are ignored by Git. Build them locally and upload the |
| 22 | +zip files as GitHub Release assets after reviewing upstream model licenses. |
22 | 23 |
|
23 | | -Default output goes here: |
| 24 | +Common outputs: |
24 | 25 |
|
25 | 26 | ```text |
26 | | -models/pt/ downloaded official checkpoints |
27 | | -models/onnx/ exported ONNX models |
28 | | -models/labels/ shared label files and manifest |
29 | | -releases/ generated GitHub Release zip assets |
30 | | -models.json friendly release/download catalog for consumers |
31 | | -``` |
32 | | - |
33 | | -Large model binaries and generated release zips are ignored by Git. `models.json` |
34 | | -is the file apps and scripts should read: it lists the friendly model names, |
35 | | -release zip assets, and download base URL. During release packaging, the exporter |
36 | | -refreshes each generated zip checksum. |
37 | | - |
38 | | -## Models |
39 | | - |
40 | | -Default export: |
41 | | - |
42 | | -```bash |
43 | | -python scripts/export_yolo_seg_onnx.py |
| 27 | +yolo/releases/ YOLO zip packages and yolo/models.json |
| 28 | +efficient-sam/releases/ EfficientSAM zip packages |
| 29 | +cutie/releases/ Cutie zip packages and cutie-models.json |
44 | 30 | ``` |
45 | 31 |
|
46 | | -Exports nano, small, and medium segmentation models for: |
47 | | - |
48 | | -- `yolov8` COCO 80 classes |
49 | | -- `yolo11` COCO 80 classes |
50 | | -- `yolo26` COCO 80 classes |
| 32 | +## Quick Commands |
51 | 33 |
|
52 | | -Optional broad-vocabulary YOLOE export: |
| 34 | +YOLO: |
53 | 35 |
|
54 | 36 | ```bash |
55 | | -python scripts/export_yolo_seg_onnx.py --families yoloe26 |
| 37 | +python yolo/scripts/export_yolo_seg_onnx.py |
56 | 38 | ``` |
57 | 39 |
|
58 | | -YOLOE-26 uses the official prompt-free checkpoint vocabulary, embeds its 4,585 |
59 | | -labels with MobileCLIP during export, and writes a static ONNX model. MobileCLIP |
60 | | -is not needed at runtime. |
61 | | - |
62 | | -Export everything: |
| 40 | +Cutie: |
63 | 41 |
|
64 | 42 | ```bash |
65 | | -python scripts/export_yolo_seg_onnx.py --families yolov8 yolo11 yolo26 yoloe26 |
| 43 | +python cutie/scripts/export_cutie_quality_tiers.py |
66 | 44 | ``` |
67 | 45 |
|
68 | | -## Release Packages |
69 | | - |
70 | | -The exporter writes one self-contained zip per model under `releases/` and |
71 | | -updates `models.json`: |
72 | | - |
73 | | -```text |
74 | | -releases/yolo26n-seg.zip |
75 | | - model.onnx |
76 | | - classes.names |
77 | | -``` |
| 46 | +EfficientSAM: |
78 | 47 |
|
79 | | -The checked-in `models.json` intentionally stays small so OpenShot can populate |
80 | | -a compact dropdown such as `YOLO26: Nano`, `YOLOv11: Nano`, and `YOLOv8: Nano`. |
81 | | - |
82 | | -## Details |
83 | | - |
84 | | -All exports use: |
85 | | - |
86 | | -- `640x640` static input |
87 | | -- batch size `1` |
88 | | -- ONNX opset `17` |
89 | | -- `dynamic=False` |
90 | | -- `nms=False` |
91 | | -- `end2end=False` |
92 | | -- `simplify=True` |
93 | | - |
94 | | -The ONNX output is raw YOLO segmentation output. Consumers are responsible for |
95 | | -post-processing. |
96 | | - |
97 | | -Label files are shared instead of duplicated per model: |
98 | | - |
99 | | -```text |
100 | | -models/labels/coco80.names |
101 | | -models/labels/yoloe26-4585.names |
102 | | -models/labels/manifest.json |
103 | | -``` |
104 | | - |
105 | | -Release zips duplicate the required labels as `classes.names` so every download |
106 | | -is self-contained. |
107 | | - |
108 | | -## Examples |
109 | | - |
110 | | -```bash |
111 | | -python scripts/export_yolo_seg_onnx.py --sizes n |
112 | | -python scripts/export_yolo_seg_onnx.py --families yolo26 |
113 | | -python scripts/export_yolo_seg_onnx.py --families yoloe26 --sizes n |
114 | | -python scripts/export_yolo_seg_onnx.py --force-download |
115 | | -python scripts/export_yolo_seg_onnx.py --skip-opencv-validate |
116 | | -``` |
| 48 | +See [`efficient-sam/README.md`](efficient-sam/README.md). Its export/release |
| 49 | +tooling will live there as it is promoted from experiments. |
117 | 50 |
|
118 | 51 | ## Links |
119 | 52 |
|
120 | | -- [Ultralytics GitHub](https://github.com/ultralytics/ultralytics) |
121 | | -- [Ultralytics model assets](https://github.com/ultralytics/assets/releases) |
122 | | -- [YOLOv8 docs](https://docs.ultralytics.com/models/yolov8/) |
123 | | -- [YOLO11 docs](https://docs.ultralytics.com/models/yolo11/) |
124 | | -- [YOLO26 docs](https://docs.ultralytics.com/models/yolo26/) |
125 | | -- [YOLOE docs](https://docs.ultralytics.com/models/yoloe/) |
126 | | -- [Ultralytics license](https://www.ultralytics.com/license) |
127 | 53 | - [OpenShot](https://www.openshot.org/) |
128 | 54 | - [OpenShot GitHub](https://github.com/OpenShot/openshot-qt) |
129 | 55 | - [libopenshot](https://github.com/OpenShot/libopenshot) |
130 | 56 | - [OpenCV DNN](https://docs.opencv.org/4.x/d2/d58/tutorial_table_of_content_dnn.html) |
131 | 57 |
|
132 | 58 | ## Project Notes |
133 | 59 |
|
134 | | -This is an export utility, not an official Ultralytics or OpenShot project. |
135 | | -See [MODEL_ARTIFACTS.md](MODEL_ARTIFACTS.md) and [NOTICE.md](NOTICE.md) for |
| 60 | +This is an export utility, not an official upstream model project. See |
| 61 | +[`MODELS.md`](MODELS.md) and [`NOTICE.md`](NOTICE.md) for |
136 | 62 | artifact and licensing notes. The repository code is MIT licensed; upstream |
137 | | -model weights and generated ONNX files remain subject to Ultralytics licensing. |
| 63 | +model weights and generated ONNX files remain subject to their upstream terms. |
0 commit comments