Documentation

From data.yaml to Core ML.

The CLI and the Python SDK share the same internals. Application code loads CoreYOLO files only.

Quickstart

Install CoreYOLO, then train a nano model on Roboflow YOLO labels.

pip install coreyolo
from coreyolo import Detector

model = Detector("n")              # GELAN n; also "s" / "m" / "l"
# model = Detector("s")
# model = Detector("n", family="e2e")
model.train(data="data.yaml", epochs=100, imgsz=640)
model.save("weights/app.coreyolo")
results = model.predict("photo.jpg", classes="person")
model.export(imgsz=640)           # ReLU: palettes+ANE; SiLU: dense FP16 GPU

Detector("n") builds an untrained GELAN nano graph. Pass "s", "m", or "l" for the larger tables, or family="e2e" for the NMS-free graph. Detector("weights/app.coreyolo") or a .mlpackage loads a trained artifact. Do not pass v9-t.pt or yolov9t.pt into Detector() — those layouts are rejected. from coreyolo import YOLO still works as an alias.

Python SDK

from coreyolo import Detector, Result. Methods: train, val, predict, export, save, info, dummy_data. Webcam: model.predict(0) on a Mac. That is not the iPhone runtime. YOLO is a compatibility alias; YOLO is a trademark of its owners.

Native checkpoints are tagged format: "coreyolo" with stem.* / head.* tensors. Suffix may be .coreyolo or .pt.

CLI

coreyolo train | val | predict | export | convert | coco | dummy-data

Device: --device gpu (default) is PyTorch MPS / Core ML CPU_AND_GPU. auto tries Neural Engine first on a .mlpackage. Also ane, all, cpu.

Graph: --family gelan (default, YOLOv9 GELAN; n / s / m / l = v9-t / s / m / c), --family dfl (C2f + host NMS), --family e2e (C3k2 + C2PSA, NMS-free), or --family rfdetr (set prediction, n/s/m/l, FP16 on the Neural Engine). Old 9 / 8 / 26 flags still load.

Activation: --act relu (default, ANE). silu is only for converted YOLOv9 tensors — do not swap it on those checkpoints. Also star (StarReLU), gelu, hardswish.

GELAN, DFL, E2E, and RF-DETR

GELAN is the default detect graph: ELAN1 / RepNCSPELAN4 / SPPELAN, Distribution Focal Loss, decoded xywh, class-aware NMS on the host. Scales n / s / m / l match public v9-t / s / m / c. Core ML layout (1, 4+nc, N). This graph never had YOLOv9 PGI aux nodes; export is the main branch only.

DFL is the older C2f + SPPF graph with the same DFL head.

E2E is C3k2 + C2PSA with a dual TAL head and NMS-free top-300 at inference. Core ML layout (1, 300, 6) as xyxy, conf, cls. Export drops the one-to-many train head. Train from scratch: --family e2e or --recipe coco-n-e2e.

RF-DETR follows LibreYOLO's Core ML contract for this family: one fixed RGB image, ImageNet normalization inside the graph, set prediction, no NMS, eval layout (1, Q, 6). Scales n / s / m / l use 384 / 512 / 576 / 704. LibreYOLO defaults that export to FP32 and compute_units=all. CoreYOLO pins FP16 and the Neural Engine, and uses dense cross-attention so the graph does not need deformable grid_sample. Train with --family rfdetr or --recipe coco-n-rfdetr at lr0=1e-4. Weights you train are MIT. Upstream Roboflow Nano–Large files stay Apache-2.0 and are not remapped. XLarge and 2XLarge (PML 1.0) are refused.

Export

coreyolo export --weights weights/app.coreyolo --imgsz 640
coreyolo export --weights weights/app.coreyolo --imgsz 640 --no-palette
coreyolo export --weights weights/app.coreyolo --imgsz 640 --int8

Default export is an FP16 ML Program (iOS 16 / macOS 13): fused Conv–BN, inference branch only (no train-time aux heads), cached static DFL grids (no meshgrid / arange in the package), host NMS, MIL cleanup passes. ReLU, ReLU6, StarReLU, and HardSwish convert with CPU_AND_NE so the graph stays ANE-legal, then 8-bit k-means palettize. Converted SiLU YOLOv9 packages stay dense FP16 on GPU. Palettes are ANE-oriented, so RF-DETR skips them and ships FP16 on the Neural Engine. --int8 is linear weight quant instead of palettes. Train ReLU from scratch for Neural Engine.

Python: model.export(imgsz=640) or palettize=False. Package metadata records optimize (palettize8 / fp16 / int8) and preferred_compute (ane or gpu).

Labels

Roboflow YOLO export: data.yaml plus train|valid/{images,labels}. Each detect line is normalized class xc yc w h. Segmentation uses polygons. The loader accepts list or dict names, val or valid.

Segmentation

coreyolo dummy-data --out datasets/dummy-seg --segment
coreyolo train --data datasets/dummy-seg/data.yaml --model n --task segment --epochs 20 --imgsz 320

GELAN (DFL head) is the supported seg graph. E2E can train a proto head too. Mosaic is off so polygons stay valid. Core ML writes three outputs: detections, mask coefficients, proto. NMS and mask assembly stay on the host.

COCO

coreyolo coco --out datasets/coco --download
coreyolo coco --out datasets/coco --splits val --max-images 512 --no-download
coreyolo train --recipe coco-n-fast
coreyolo train --recipe coco-s
coreyolo train --recipe coco-m
coreyolo train --recipe coco-n-e2e

Optional bootstrap, once, not in the app. Converted v9-*.pt files are MIT:

coreyolo convert --weights v9-t.pt --out weights/coreyolo-n-coco.coreyolo
coreyolo convert --weights v9-s.pt --out weights/coreyolo-s-coco.coreyolo
coreyolo convert --weights v9-m.pt --out weights/coreyolo-m-coco.coreyolo
coreyolo convert --weights v9-c.pt --out weights/coreyolo-l-coco.coreyolo

License

CoreYOLO carries two separately licensed things: its own code, and pretrained checkpoints. They are often not the same license. Choosing a model means choosing its license.

Own code: MIT. Use it in a commercial or closed-source product; keep the copyright line and the license text with any copy you redistribute.

GELAN COCO weights: MIT. A model you train yourself is yours.

RF-DETR you train: MIT. The graph follows LibreYOLO’s Core ML contract and does not load LibreYOLO or Roboflow checkpoints. Upstream Nano–Large files stay Apache-2.0. XLarge and 2XLarge (Platform Model License 1.0) are refused.

This is a description of the licenses involved, not legal advice. Full write-up: docs/licenses.md, weights/LICENSE_NOTICE.txt.