pypi ultralytics 8.3.208
v8.3.208 - `ultralytics 8.3.208` Expand FP16 export support (#22316)

11 hours ago

🌟 Summary

Expands safe FP16 (half-precision) export support across ONNX and TorchScript, improves NCNN export reliability by switching to the ONNX pipeline, and delivers faster RT-DETR inference via anchor caching β€” plus clearer docs and smoother dependency handling. πŸš€

πŸ“Š Key Changes

  • FP16 export behavior (PR #22316)

    • Extends FP16 handling to both ONNX and TorchScript exports.
    • Enforces GPU-only rule for FP16; if half=True on CPU, it now warns and automatically uses half=False.
    • Expands tests to cover ONNX FP16 combinations for higher reliability.
    • Docs updated to clearly state FP16 constraints (not compatible with INT8 or CPU-only export). ⚠️
  • NCNN export pipeline update (PR #22315)

    • NCNN export now uses ONNX β†’ PNNX instead of TorchScript β†’ PNNX for better compatibility and stability.
    • Automatically triggers ONNX when format='ncnn'. TorchScript is only produced if explicitly requested. πŸ”„
  • RT-DETR performance optimization (PR #22318)

    • Caches decoder anchors and masks; regenerates only if shapes change or dynamic=True.
    • Reduces redundant computation to speed up training/inference. ⚑
  • Smarter dependency checks with interchangeable packages (PR #22321)

    • check_requirements() supports alternatives like ("onnxruntime", "onnxruntime-gpu"), making installs more flexible. βœ…
    • Internal usage updated (e.g., ONNX benchmarking) to accept either CPU or GPU variants.
  • Validation docs clarity (PR #22319)

    • Clarifies that validation uses model.names (the model’s class set), not the dataset YAML classes. πŸ“
  • Better examples for check_requirements usage (PR #22317)

    • Shows passing custom pip args (e.g., PyTorch CPU index) and updates version constraints. 🧰
  • CI and maintenance improvements

    • Use missing_ok=True when cleaning INT8 TensorRT cache files in tests to avoid edge-case errors (PR #22320).
    • Bump astral-sh/setup-uv from v6 to v7 for GitHub Actions (PR #22327).
    • Tidy Dependabot config and labels; remove deprecated reviewer field (PR #22322). 🧹

🎯 Purpose & Impact

  • Safer, clearer FP16 exports on GPU only

    • Prevents confusing or invalid CPU FP16 exports by auto-correcting and warning.
    • Users get predictable, faster FP16 ONNX/TorchScript exports on supported hardware. πŸ’¨
  • More reliable NCNN exports

    • ONNX-based NCNN conversion reduces TorchScript-related issues and simplifies the export path.
    • Improves portability and success rate across platforms. πŸ“¦
  • Faster RT-DETR workflows

    • Anchor/mask caching trims unnecessary computation, accelerating common inference loops. βš™οΈ
  • Smoother installs and environment setup

    • Interchangeable package support (e.g., onnxruntime vs onnxruntime-gpu) reduces friction across CPU/GPU setups.
    • Updated examples help users configure installs for their hardware quickly. πŸ§‘β€πŸ’»
  • Reduced test flakes and cleaner maintenance

    • More robust tests and streamlined CI/dependency settings lower maintenance noise without user-facing changes. βœ…

Quick examples:

  • Export ONNX in FP16 on GPU:
from ultralytics import YOLO

YOLO("yolo11n.pt").export(format="onnx", half=True, device=0)  # βœ… GPU FP16
  • Attempting FP16 export on CPU will auto-disable FP16 and warn:
YOLO("yolo11n.pt").export(format="onnx", half=True, device="cpu")  # ℹ️ Will warn and use half=False
  • Check requirements with interchangeable packages:
from ultralytics.utils.checks import check_requirements

check_requirements([("onnxruntime", "onnxruntime-gpu"), "numpy"])

What's Changed

New Contributors

Full Changelog: v8.3.207...v8.3.208

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.