Skip to content

Commit 6bf7403

Browse files
committed
Organize ONNX model export tooling
- Restructure the repo around model families, moving YOLO assets under yolo/ and adding first-class Cutie and EfficientSAM export directories. - Add Cutie scripts for exporting OpenCV-compatible quality tiers and probes for validating model loading/forward passes. Add EfficientSAM packaging for Tiny and Small seed-mask variants, including OpenCV validation and static Small export conversion.
1 parent 365f7e3 commit 6bf7403

26 files changed

Lines changed: 2294 additions & 130 deletions

.gitignore

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,23 @@ __pycache__/
88
.vscode/
99

1010
# Generated model artifacts. Keep these local or publish via Git LFS/releases.
11-
models/pt/*.pt
12-
models/onnx/*.onnx
13-
models/text/*.ts
14-
models/**/*.tmp
15-
releases/
11+
yolo/models/pt/*.pt
12+
yolo/models/onnx/*.onnx
13+
yolo/models/text/*.ts
14+
yolo/models/**/*.tmp
15+
yolo/releases/
16+
17+
# Generated EfficientSAM assets
18+
efficient-sam/models/
19+
efficient-sam/build/
20+
efficient-sam/releases/
21+
22+
# Generated Cutie assets and local upstream checkout
23+
cutie/vendor/
24+
cutie/weights/
25+
cutie/models/
26+
cutie/build/
27+
cutie/releases/
1628

1729
# OS/local noise
1830
.DS_Store

MODEL_ARTIFACTS.md renamed to MODELS.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22

33
Generated model files are intentionally ignored by Git:
44

5-
- `models/pt/*.pt`
6-
- `models/onnx/*.onnx`
7-
- `models/text/*.ts`
8-
- `releases/*.zip`
5+
- `yolo/models/pt/*.pt`
6+
- `yolo/models/onnx/*.onnx`
7+
- `yolo/models/text/*.ts`
8+
- `yolo/releases/*.zip`
9+
- `efficient-sam/models/*.onnx`
10+
- `efficient-sam/releases/*.zip`
11+
- `cutie/weights/*.pth`
12+
- `cutie/models/*.onnx`
13+
- `cutie/releases/*.zip`
914

1015
The ONNX files are reproducible with:
1116

1217
```bash
13-
python scripts/export_yolo_seg_onnx.py
18+
python yolo/scripts/export_yolo_seg_onnx.py
19+
python cutie/scripts/export_cutie_quality_tiers.py
1420
```
1521

1622
They are not committed by default because pretrained YOLO checkpoints and
17-
derived ONNX exports are licensed by Ultralytics, and some generated files are
18-
large enough to require Git LFS or GitHub Releases instead of normal Git
19-
storage.
23+
derived ONNX exports are licensed by Ultralytics, Cutie checkpoints and derived
24+
ONNX exports are governed by upstream Cutie terms, and some generated files are
25+
large enough to require Git LFS or GitHub Releases instead of normal Git storage.
2026

2127
The exporter code in this repository is MIT licensed. That license does not
2228
change the license terms of Ultralytics checkpoints, MobileCLIP weights, or
23-
derived model artifacts.
29+
Cutie weights, or derived model artifacts.
2430

2531
Supported outputs:
2632

@@ -35,9 +41,9 @@ If you want to publish generated ONNX files with a GitHub repository, use Git
3541
LFS or attach them to a GitHub Release after reviewing Ultralytics licensing
3642
requirements for your intended use.
3743

38-
Class labels are not duplicated per model. Shared label sets live in
39-
`models/labels/`, and `models/labels/manifest.json` maps each ONNX filename to
40-
the correct label file and output width.
44+
YOLO class labels are not duplicated per model. Shared label sets live in
45+
`yolo/models/labels/`, and `yolo/models/labels/manifest.json` maps each ONNX
46+
filename to the correct label file and output width.
4147

4248
Release packages duplicate the required label file inside each zip as
4349
`classes.names`:
@@ -48,7 +54,12 @@ yolo26n-seg.zip
4854
classes.names
4955
```
5056

51-
The root `models.json` file is the consumer-facing release catalog. It stays
52-
small on purpose: friendly dropdown names, zip asset filenames, and release
53-
download information. The exporter refreshes zip checksums when release packages
54-
are generated.
57+
The `yolo/models.json` file is the YOLO consumer-facing release catalog. It
58+
stays small on purpose: friendly dropdown names, zip asset filenames, and
59+
release download information. The exporter refreshes zip checksums when release
60+
packages are generated.
61+
62+
Cutie release packages are generated under `cutie/releases/` and contain the
63+
four ONNX slices needed by libopenshot's Cutie Object Mask backend. The Cutie
64+
exporter also writes `cutie/releases/cutie-models.json` with asset names,
65+
dimensions, and checksums.

NOTICE.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Copyright (c) 2026 OpenShot Studios, LLC
44

55
This repository contains helper scripts and documentation for downloading
6-
official Ultralytics YOLO segmentation checkpoints and exporting them to ONNX
7-
for OpenCV DNN consumers.
6+
official Ultralytics YOLO segmentation checkpoints, EfficientSAM checkpoints,
7+
and Cutie video object segmentation checkpoints, then exporting them to ONNX for
8+
OpenCV DNN consumers.
89

910
The repository code and documentation are licensed under the MIT License. See
1011
[LICENSE](LICENSE).
@@ -16,3 +17,17 @@ weights, derived ONNX exports, or using them in commercial products:
1617
- https://github.com/ultralytics/ultralytics
1718
- https://github.com/ultralytics/assets
1819
- https://www.ultralytics.com/license
20+
21+
Cutie source code and pretrained model weights are provided by the Cutie
22+
authors. Review upstream Cutie licensing and release notes before
23+
redistributing weights or derived ONNX exports:
24+
25+
- https://github.com/hkchengrex/Cutie
26+
- https://github.com/hkchengrex/Cutie/releases
27+
- https://github.com/hkchengrex/Cutie/blob/main/LICENSE
28+
29+
EfficientSAM source code and pretrained model weights are provided by the
30+
EfficientSAM authors. Review upstream licensing and release notes before
31+
redistributing weights or derived ONNX exports:
32+
33+
- https://github.com/yformer/EfficientSAM

README.md

Lines changed: 31 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,63 @@
1-
# YOLO ONNX Exports for OpenShot
1+
# OpenShot ONNX Exports
22

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.
57

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
99

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/) |
1115

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.
1518

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
1920

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.
2223

23-
Default output goes here:
24+
Common outputs:
2425

2526
```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
4430
```
4531

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
5133

52-
Optional broad-vocabulary YOLOE export:
34+
YOLO:
5335

5436
```bash
55-
python scripts/export_yolo_seg_onnx.py --families yoloe26
37+
python yolo/scripts/export_yolo_seg_onnx.py
5638
```
5739

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:
6341

6442
```bash
65-
python scripts/export_yolo_seg_onnx.py --families yolov8 yolo11 yolo26 yoloe26
43+
python cutie/scripts/export_cutie_quality_tiers.py
6644
```
6745

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:
7847

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.
11750

11851
## Links
11952

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)
12753
- [OpenShot](https://www.openshot.org/)
12854
- [OpenShot GitHub](https://github.com/OpenShot/openshot-qt)
12955
- [libopenshot](https://github.com/OpenShot/libopenshot)
13056
- [OpenCV DNN](https://docs.opencv.org/4.x/d2/d58/tutorial_table_of_content_dnn.html)
13157

13258
## Project Notes
13359

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
13662
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

Comments
 (0)