pypi ultralytics 8.3.206
v8.3.206 - `ultralytics 8.3.206` Support dynamic batch and image size with CoreML export (#22300)

14 hours ago

🌟 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 with nms, and classification models can’t use dynamic.
    • 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.
  • Developer experience
    • Type hints added for lazily loaded classes (e.g., YOLO, YOLOWorld, YOLOE, SAM, etc.) via TYPE_CHECKING for better IDE autocomplete and static analysis. ✨ (@Y-T-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.
  • 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 for batch > 1.
  • Don’t combine dynamic=True with nms=True.
  • Classification models don’t support dynamic=True on CoreML.

What's Changed

New Contributors

Full Changelog: v8.3.205...v8.3.206

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.