🌟 Summary
CoreML export gets a big upgrade: dynamic image shapes and multi-image batching now work end-to-end, making Apple deployments more flexible and production-friendly. 🚀
📊 Key Changes
- CoreML dynamic shapes and batching
- CoreML export now supports
dynamic=True
for variable image sizes and batch sizes. 🧩 - Export validates safe combos: disallows
dynamic
withnms
, and classification models can’t usedynamic
. - Runtime updated to handle dynamic CoreML inputs correctly in prediction.
- Tests expanded to cover dynamic CoreML scenarios and exclude invalid settings.
- Docs export table updated to list
dynamic
for CoreML.
- CoreML export now supports
- Developer experience
- Type hints added for lazily loaded classes (e.g.,
YOLO
,YOLOWorld
,YOLOE
,SAM
, etc.) viaTYPE_CHECKING
for better IDE autocomplete and static analysis. ✨ (@Y-T-G)
- Type hints added for lazily loaded classes (e.g.,
- Visualization robustness
plot_images
now gracefully handles 1-, 2-, 3-, and multi-channel inputs (auto-pads or crops to 3 channels), improving reliability for multispectral and non-RGB data. 🖼️ (@ambitious-octopus)
- Documentation quality and speed
- Many images migrated to Ultralytics-hosted AVIF for faster loads and fewer broken links; minor cleanup in Roboflow and integration guides. ⚡ (@glenn-jocher)
- Predict docs now include tabbed Python and CLI examples for easier onboarding. 🧭 (@banu4prasad)
- Fixed import path in Python docs to avoid confusion and errors. ✅ (@cdeil)
- Small mkdocs config tidy-up to remove a duplicated setting. 🧹
🎯 Purpose & Impact
- Flexible Apple deployments
- Run CoreML models with varying input sizes and multiple images per call, improving throughput and simplifying pipelines on macOS/iOS.
- Removes a top pain point where batch inference worked for PyTorch but not CoreML.
- Safer, clearer exports
- Better validation and warnings reduce misconfigurations (e.g.,
dynamic
+nms
) and save debugging time.
- Better validation and warnings reduce misconfigurations (e.g.,
- Smoother dev workflow
- Stronger type hints enhance editor support without changing runtime behavior.
- More robust training/previewing
- Reliable plotting for 2-channel and multispectral images avoids visualization crashes and streamlines dataset exploration.
- Faster, clearer docs
- AVIF assets speed up documentation; CLI snippets for predict reduce guesswork and help new users quickly run YOLO11.
Quick start examples:
# Export CoreML with dynamic shapes and set a max batch
yolo export format=coreml dynamic batch=16
# Batch inference with a CoreML package
yolo predict model=yolo11n.mlpackage batch=2
# Change image size on the fly (still batched)
yolo predict model=yolo11n.mlpackage imgsz=256 batch=2
Notes:
- For CoreML export: use
dynamic=True
forbatch > 1
. - Don’t combine
dynamic=True
withnms=True
. - Classification models don’t support
dynamic=True
on CoreML.
What's Changed
- Fix import typo in
python.md
Docs by @cdeil in #22285 GIF
toAVIF
conversion, smaller files size and same animation by @RizwanMunawar in #22293- Enable type hints for lazy loaded classes by @Y-T-G in #22297
- Update YOLOE Docs image by @glenn-jocher in #22299
- Optimize images and update docs by @glenn-jocher in #22301
- Optimize SAM2 and ONNX images and update docs by @glenn-jocher in #22302
- Fix 2 channel TIFF support for
plot_images
by @ambitious-octopus in #22282 - Fix duplicate
ignore_init_summary
in mkdocs.yml by @glenn-jocher in #22305 - Add Python and CLI Examples to Predict Docs by @banu4prasad in #22303
ultralytics 8.3.206
Support dynamic batch and image size with CoreML export by @Y-T-G in #22300
New Contributors
Full Changelog: v8.3.205...v8.3.206