🌟 Summary
ultralytics 8.3.240 is a stability-focused release that makes SAM 2/3 video segmentation more reliable (especially on Apple Silicon), tightens GPU memory usage, and polishes exports and documentation for smoother day‑to‑day workflows. 🚀
📊 Key Changes
-
🔧 SAM3 on Apple Silicon (MPS) now runs reliably
- Fixes a bug in SAM rotary encoding on Apple MPS by avoiding
repeat()on complex tensors. - Uses
torch.view_as_real()/torch.view_as_complex()for an MPS-safe path while keeping existing behavior on CUDA/CPU.
- Fixes a bug in SAM rotary encoding on Apple MPS by avoiding
-
🧠 SAM2/SAM3 video memory usage is now bounded
- Adds
_prune_non_cond_memory()in SAM2 video predictors to periodically clear “non-conditioning” frame outputs. - Pruning is driven by model settings (
num_maskmem,memory_temporal_stride_for_eval) and runs automatically during video inference.
- Adds
-
🎥 SAM3 semantic video tracking is faster and cleaner
- Unmatched objects are now removed, not “suppressed but still tracked”.
- Increases default track keep-alive windows (
init_trk_keep_aliveandmax_trk_keep_aliveto 30) while decreasing keep-alive when masks are empty. - Fixes result label naming to align with the number of boxes instead of masks for more consistent IDs.
-
📦 ONNX export environments are more complete
- Adds
onnxslim>=0.1.80to theexportextra inpyproject.toml, sopip install ultralytics[export]pulls inonnxslimautomatically.
- Adds
-
📥 Clearer setup for SAM 3 model weights
- SAM 3 docs now point to the gated SAM 3 Hugging Face model page and provide a direct
sam3.ptdownload link.
- SAM 3 docs now point to the gated SAM 3 Hugging Face model page and provide a direct
-
💬 Docs chat widget is now easier to extend
- Stores the
UltralyticsChatinstance in a variable (const ultralyticsChat = ...) so future scripts can programmatically control the widget.
- Stores the
-
🖼️ Cleaner docs for color previews & Markdown-heavy pages
docs/build_reference.pynow preserves Markdown structures (tables, admonitions, code blocks, headings, lists) instead of collapsing lines.- Reorders the
Colorsclass docstring so the Markdown table reads cleanly, with “Attributes” and “Examples” sections following it.
-
🔁 Branding & integration docs refresh for Comet
- Updates the Comet integration guide to use “Comet” (formerly “Comet ML”) throughout, including headings, alt text, and FAQ sections.
- Keeps references to “Comet ML” only where helpful for context or search.
🎯 Purpose & Impact
-
🍎 Better Apple Silicon experience
- SAM3 users on M1/M2/M3 Macs running with MPS should see fewer runtime errors and more stable segmentation inference with no config changes needed.
-
🧹 More stable long video runs
- Automatic pruning of non-essential SAM2/SAM3 video memory reduces VRAM growth over long videos, helping prevent out‑of‑memory crashes and making multi-video processing safer.
-
🎯 More predictable tracking behavior
- Removing unmatched objects instead of silently suppressing them simplifies mental models for users: if an object stops being matched, it is actually removed, not half-alive in the background.
- Longer but better-managed keep-alive windows help tracking remain robust during brief occlusions without bloating state indefinitely.
-
🛠️ Smoother export and deployment workflows
- Including
onnxslimin the export extras reduces “missing dependency” surprises for users who export to ONNX and then run post‑processing or optimization.
- Including
-
📚 Easier SAM 3 onboarding
- Clear, accurate instructions for requesting and downloading
sam3.ptfrom Hugging Face mean fewer setup issues and less guesswork for new SAM 3 users.
- Clear, accurate instructions for requesting and downloading
-
📘 More maintainable and readable documentation
- Preserved Markdown structure avoids broken tables, squashed code blocks, and messy formatting in the API/reference docs.
- Comet branding updates and a controllable docs chat widget make the docs feel more polished and easier to evolve over time.
What's Changed
- Fix Docs search by @glenn-jocher in #22972
- Fix Docs
utils.plotting.Colors()previews by @glenn-jocher in #22973 - Prune SAM3 tracker memory to prevent VRAM leak by @Y-T-G in #22969
- Fix
SAM3SemanticVideoPredictorspeed issue by removing unmatched objects by @Laughing-q in #22976 - Add direct link for SAM 3 model weight by @Y-T-G in #22979
- Replace 'Comet ML' references with 'Comet' by @jshakes in #22975
- Add onnxslim dependency for compatibility by @inisis in #22966
ultralytics 8.3.240SAM3 Apple MPS tensorrepeat()fixes by @Y-T-G in #22968
New Contributors
Full Changelog: v8.3.239...v8.3.240