pypi ultralytics 8.4.139
v8.4.139 - Reduce validation dataloader memory with prefetch 2 per worker (#26057)

2 hours ago

🌟 Summary

v8.4.139 improves training efficiency and reliability—especially by reducing validation memory usage—while refreshing model statistics, dataset handling, optimizer performance, and documentation. 🚀

📊 Key Changes

  • Lower validation dataloader memory usage by @glenn-jocher:

    • Validation workers now prefetch 2 batches instead of 4.
    • Training loaders continue using a prefetch factor of 4.
    • This reduces queued validation data and shared-memory usage without slowing validation startup. 💾
  • Faster Muon/MuSGD optimizer updates:

    • Updates are now grouped by column count and flattened according to their memory layout.
    • This avoids unnecessary tensor copies for channels-last convolution weights and preserves fused parameter updates.
    • The standalone Muon optimizer and related dead code were removed; MuSGD remains available. ⚡
  • More reliable EMA checkpoints:

    • EMA attributes such as class names, class counts, strides, and class weights are now copied from the unwrapped model.
    • This fixes missing or stale metadata when using distributed training or torch.compile.
    • EMA is initialized after class weights are calculated, improving checkpoint consistency. ✅
  • Correct semantic segmentation dataset detection:

    • A default masks/ directory is now recognized as PNG-mask semantic segmentation when no masks_dir entry is specified.
    • Prevents incorrect class counts and phantom background classes in affected datasets. 🎯
  • Improved FP16 behavior documentation:

    • Documentation now clearly warns that quantize=16 can cast a retained PyTorch model in place.
    • A later FP32 call on the same model object may therefore use FP16-rounded weights.
    • This clarification applies to prediction and validation, including shared model objects. ⚠️
  • Refreshed FLOPs and parameter reporting:

    • Published model statistics were synchronized with the current profiler.
    • Updated values cover YOLO26, YOLO11, YOLO12, YOLOv8, YOLOv5u, and other documented models.
    • Accuracy and speed benchmark values were not changed. 📊
  • More robust and maintainable internals:

    • Batch-normalization fusion now uses PyTorch’s official fusion utilities.
    • SAM positional embeddings avoid nondeterministic cumulative-sum operations.
    • Temporary module aliases are now thread-safe and restore modified attributes correctly.
    • NumPy-to-tensor conversion can share CPU memory and perform a single device transfer.
    • ONNX export opset selection was simplified and made more compatible with current runtimes.
  • Expanded task visibility and documentation:

    • Depth estimation is now listed consistently across the README, package description, docstrings, tutorials, and task detection messages.
    • Documentation validation now requires Zensical 0.0.58 or newer.
    • Several model benchmark tables and page frontmatter entries were corrected. 📚

🎯 Purpose & Impact

  • Users training with limited system or shared memory should see fewer validation-memory spikes, particularly with many dataloader workers or large images. 🧠
  • Training performance may improve for the default CUDA channels-last path because Muon updates avoid repeated copies and retain fused optimizer operations.
  • Distributed and compiled training runs should produce more complete and dependable checkpoints through improved EMA metadata handling.
  • Semantic segmentation workflows using a conventional root-level masks/ folder now behave as documented, avoiding incorrect output channels and class definitions.
  • FP16 users should be aware that prediction or validation may modify a PyTorch model object in place; keeping separate model instances is recommended when switching between FP16 and FP32.
  • Benchmark comparisons are more trustworthy because FLOPs and parameter counts now reflect current profiler behavior, although these corrected statistics may differ from earlier documentation.
  • Depth estimation is easier to discover for new users, while existing model APIs and task support remain compatible. 🌊

What's Changed

  • Document that a predict-time FP16 request casts the caller's PyTorch model in place by @raimbekovm in #26037
  • Republish FLOPs measured with the current profiler by @raimbekovm in #26036
  • Bucket Muon matrices by column count and flatten updates in memory order by @Y-T-G in #26035
  • Fix semantic nc for the default masks/ folder by @laodouya in #26034
  • Fix Zensical 0.0.58 docs validation by @glenn-jocher in #26041
  • Replace hand-rolled torch helpers with their torch owners and drop dead code by @glenn-jocher in #26043
  • Refresh EMA attributes from the unwrapped model by @glenn-jocher in #26047
  • Add depth estimation to README intro paragraph by @raimbekovm in #26055
  • Add depth estimation to task lists across README, docstrings and package description by @raimbekovm in #26056
  • Reduce validation dataloader memory with prefetch 2 per worker by @glenn-jocher in #26057

Full Changelog: v8.4.138...v8.4.139

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.