File size: 2,772 Bytes
fb3cc07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!-- Tracked in the CamStack repository as hf/camstack-models/source/README.md; edit it there, not on the Hub. The scripts beside it are copied by hf/camstack-models/upload.sh from scripts/ and packages/addon-model-studio/python/. -->

# Source: how the CamStack YOLO builds are made

This folder is the **Corresponding Source** under the GNU AGPL-3.0 for the
Ultralytics-derived weights in this mirror (`objectDetection/yolo26`,
`objectDetection/yolov9`, `segmentation/yolo26-seg`, `plateDetection/yolov8-plate`).
The full source offer, including what these scripts do not reproduce yet, is in
[`THIRD_PARTY_MODELS.md`](../THIRD_PARTY_MODELS.md#source-offer-for-the-agpl-30-weights).

| File | What it is |
| --- | --- |
| `build-camstack-models.py` | Builds the `camstack-*` YOLO set from the upstream Ultralytics checkpoints: ONNX with a dynamic batch axis, CoreML (FP16, flexible batch 1..16), OpenVINO IR FP32 and FP16, and OpenVINO NNCF INT8 when calibration images are present. |
| `convert_lib.py` | The converter `build-camstack-models.py` imports: ONNX to OpenVINO IR (`ov.convert_model`), NNCF INT8 post-training quantisation, ONNX to CoreML, and validation of every IR. It is the same file CamStack's Model Studio runs at runtime. |
| `requirements.txt` | Python dependencies of `convert_lib.py`, with per-platform markers (OpenVINO/NNCF off macOS, coremltools/torch on macOS). |
| `export-models.py` | The older bulk exporter (Ultralytics `export()` to ONNX, CoreML, OpenVINO, TFLite) for the YOLOv8, YOLOv9 and YOLO11 ids. Self-contained. |

## Rebuilding

```bash
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt ultralytics
# optional, for the INT8 builds: a folder of calibration images (e.g. a COCO val subset)
export CAMSTACK_CALIB_DIR=./calibration-images
python build-camstack-models.py
```

The script downloads each upstream checkpoint (`yolo26n.pt`, `yolov9t.pt`, ...)
from Ultralytics on first use, finds `convert_lib.py` next to itself, and writes
the results to `./exported-models/`. The model list and input sizes are the
`MODELS` table at the top of the script; the other hosted sizes are the same
calls with a different model id or `imgsz`. CoreML export needs macOS; the
OpenVINO steps need Linux or Windows on x86.

## Licences

- **These scripts** (`build-camstack-models.py`, `convert_lib.py`,
  `export-models.py`, `requirements.txt`) are CamStack's own code and are
  offered under the **MIT** licence.
- **The weights they produce keep their upstream licence.** The Ultralytics
  checkpoints are AGPL-3.0 ([`LICENSES/AGPL-3.0.txt`](../LICENSES/AGPL-3.0.txt)),
  and so is every file derived from them in this mirror. Nothing here is
  relicensed; see [`LICENSE`](../LICENSE) and each folder's `README.md`.