pypi ultralytics 8.3.187
v8.3.187 - `ultralytics 8.3.187` SAM2: Add `SAM2DynamicInteractivePredictor` support few-shot inference (#21232)

latest releases: 8.3.193, 8.3.192, 8.3.191...
8 days ago

🌟 Summary

SAM 2 gets a powerful, training‑free upgrade for interactive, few‑shot multi-object segmentation and tracking, while Ultralytics switches core data operations to Polars for faster, lighter analytics. 🚀

📊 Key Changes

  • SAM2DynamicInteractivePredictor (new, priority)

    • Adds dynamic, interactive few-shot segmentation/tracking across images and video-like sequences.
    • Supports prompts via boxes, points, and masks with real-time memory updates and per-object IDs.
    • Enables continual learning: refine existing objects over time without retraining. 🎯
    • Integrates seamlessly with existing SAM2 models.
    • Docs include examples, API reference, and use cases. See the SAM 2 docs page.
  • Data layer refactor: Pandas ➜ Polars

    • to_df() now returns a Polars DataFrame; CSV/JSON exports use Polars.
    • Removed export helpers: XML, HTML, SQL (and related tests/docs).
    • Training/benchmarks/plotting reading results now use Polars.
    • Dependencies updated: added polars, removed pandas and pandas-stubs.
    • See refactor PR details.
  • Visualization and UX

    • labels.jpg now shows instance counts on class bars for small-class datasets. 📊
    • plot_tune_results() gains consistent Matplotlib styling via @plt_settings() for headless and notebook runs.
    • README/docs banners updated for the YOLOvision event (correct sizing + tracking). 🖼️
  • Documentation improvements

    • SAM 2 docs: detailed guide for dynamic interactive segment-and-track with examples and API reference.
    • OBB task docs: clarify YOLO11 OBB angles must be in [0, 90). 🧭
    • MobileSAM docs: corrected comparison—MobileSAM is “7× smaller, 5× faster” than FastSAM.
    • Docs build reliability improved via mkdocs-ultralytics-plugin>=0.1.29.

🎯 Purpose & Impact

  • Interactive, few-shot segmentation/tracking (SAM2DynamicInteractivePredictor)

    • Purpose: Let users add/track multiple objects over time, refine them interactively, and share memory across frames or independent images—no additional training needed.
    • Impact: Faster video annotation, interactive editing, surveillance, medical/time-series use cases, and semi-automatic dataset labeling with improved consistency. ✨
    • Minimal example:
      from ultralytics.models.sam import SAM2DynamicInteractivePredictor
      
      overrides = dict(model="sam2_t.pt", task="segment", mode="predict", imgsz=1024, conf=0.01, save=False)
      predictor = SAM2DynamicInteractivePredictor(overrides=overrides, max_obj_num=10)
      
      # Add an object with a box prompt and store in memory
      predictor.inference(img="image1.jpg", bboxes=[[100, 100, 200, 200]], obj_ids=[1], update_memory=True)
      
      # Track it in a new image
      results = predictor(source="image2.jpg")
      
      # Add another object later
      predictor.inference(img="image3.jpg", bboxes=[[300, 300, 400, 400]], obj_ids=[2], update_memory=True)
      
      # Continue inference
      results = predictor(source="image4.jpg")
  • Faster, lighter data workflows with Polars

    • Purpose: Improve performance and reduce dependencies across training, validation, benchmarking, and logging.
    • Impact: Quicker data exports and plotting; smaller dependency footprint. Breaking change: code expecting Pandas DataFrames from to_df() must adapt to Polars (e.g., df.to_pandas() if needed). Removed XML/HTML/SQL export helpers—use CSV/JSON or Polars I/O instead.
  • Better plots and docs

    • Purpose: Enhance clarity and reliability of visual outputs and documentation accuracy.
    • Impact: Easier result interpretation (bar labels), more robust plotting in CI/headless environments, clearer OBB labeling constraints, and corrected MobileSAM claims. No changes to training/inference APIs.

Useful links:

  • Read the SAM 2 dynamic interactive docs with examples
  • See the Polars refactor PR
  • Learn about the OBB angle clarification
  • Check the labels.jpg improvement PR
  • Follow the YOLOvision event updates

What's Changed

New Contributors

Full Changelog: v8.3.186...v8.3.187

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.