Skip to content

Improve save_video speed and object tracking#441

Merged
giswqs merged 2 commits intomainfrom
tracking
Dec 5, 2025
Merged

Improve save_video speed and object tracking#441
giswqs merged 2 commits intomainfrom
tracking

Conversation

@giswqs
Copy link
Member

@giswqs giswqs commented Dec 5, 2025

Customize object names.

players_segmented.mp4

Copilot AI review requested due to automatic review settings December 5, 2025 03:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes video rendering performance and enhances object tracking capabilities in SAM3 video segmentation. The main improvements include replacing matplotlib-based rendering with faster OpenCV/numpy operations for the save_video method, adding support for custom object labels, and enabling batch removal of multiple tracked objects. The changes improve both performance (significantly faster video generation) and usability (custom labels and multi-object removal).

  • Optimized _save_blended_frames by replacing matplotlib rendering with OpenCV/numpy array operations for ~10x speed improvement
  • Extended remove_object to accept lists of object IDs for batch removal
  • Added support for custom object labels via dictionary mapping in visualization methods

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
samgeo/samgeo3.py Optimized video frame rendering with OpenCV, added list support to remove_object(), and extended show_ids parameter to support custom label dictionaries across visualization methods
mkdocs.yml Added reference to new object tracking example notebook
docs/examples/sam3_video_segmentation.ipynb Removed redundant show_video() call after saving
docs/examples/sam3_object_tracking.ipynb New comprehensive example demonstrating video segmentation, object tracking, custom labels, and batch object removal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

@giswqs giswqs merged commit f1dda44 into main Dec 5, 2025
9 checks passed
@giswqs giswqs deleted the tracking branch December 5, 2025 03:52
@github-actions github-actions bot temporarily deployed to pull request December 5, 2025 03:54 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants