Skip to content

New "Object Mask" Effect: Segment Anything / Track Anything#1078

Open
jonoomph wants to merge 6 commits into
developfrom
object-mask-effect
Open

New "Object Mask" Effect: Segment Anything / Track Anything#1078
jonoomph wants to merge 6 commits into
developfrom
object-mask-effect

Conversation

@jonoomph
Copy link
Copy Markdown
Member

Based on 2 outstanding open-source AI models:

Based on Positive / Negative points or rectangles, select the best Mask, and then propagate the mask through the entire video.

jonoomph added 5 commits May 18, 2026 16:28
- Add ObjectMask effect for rendering and exposing generated object masks
- Add EdgeSAM preprocessing path for prompt-based seed and reseed masks
- Add XMem ONNX propagation between seed frames for single-object tracking
- Support positive/negative points, positive rect prompts, and prompt keyframes
- Store generated masks in protobuf data for playback and downstream effects
- Add mask color/alpha plus stroke color/alpha/width effect controls
- Register ObjectMask with effect discovery and clip preprocessing jobs
- Add focused ObjectMask effect tests
- Use a single EfficientSAM ONNX model for ObjectMask seed mask generation
- Add EfficientSAM prompt preprocessing and mask candidate selection
- Keep seed-frame output as the raw EfficientSAM mask while still seeding XMem
- Add ClipProcessingJobs::PreviewObjectMask for single-frame interactive previews
- Accept EfficientSAM model JSON keys while preserving legacy encoder_model aliases
- Remove ObjectMask protobuf shutdown call that could destabilize Python teardown
- Add ObjectMask ONNX validation coverage
- Removing XMem as a backend for Object Mask effect (replacing with Cutie model)
- Detect Cutie model dimensions from selected model filenames instead of relying on a fixed propagation size.
- Support multiple Cutie quality tiers with matching encode/decode/readout dimensions.
- Add fallback mask threshold behavior for EfficientSAM when the default threshold produces an empty mask.
- Reduce Object Mask preview/export failures with larger Cutie model variants.
- Supports multiple positive rect prompts instead of only the first rect.
- Preserves negative rects as ranking filters instead of collapsing them to center points.
- Ranks EfficientSAM candidates with soft penalties for negative point hits and negative rect overlap.
- Unions separate EfficientSAM passes for multiple positive rects so multiple target objects can remain selected.
- Makes GPU_AUTO conservative:
    - CUDA if available
    - otherwise CPU
    - OpenCL only when explicitly requested with GPU_OPENCL
- Adds simple requested/selected DNN device logging for Object Detection, EfficientSAM, and Cutie.
@jonoomph
Copy link
Copy Markdown
Member Author

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 22.34401% with 921 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.82%. Comparing base (5dc3724) to head (da35707).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
src/CVObjectMask.cpp 0.86% 800 Missing ⚠️
src/effects/ObjectMask.cpp 66.81% 76 Missing ⚠️
src/CVObjectDetection.cpp 0.00% 22 Missing ⚠️
src/ClipProcessingJobs.cpp 0.00% 16 Missing ⚠️
tests/ObjectMask.cpp 97.14% 3 Missing ⚠️
src/CVObjectMask.h 0.00% 2 Missing ⚠️
src/EffectInfo.cpp 66.66% 1 Missing ⚠️
src/effects/ObjectMask.h 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1078      +/-   ##
===========================================
- Coverage    72.64%   70.82%   -1.82%     
===========================================
  Files          245      250       +5     
  Lines        30734    31916    +1182     
===========================================
+ Hits         22327    22606     +279     
- Misses        8407     9310     +903     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Preserve the first seeded Cutie memory frame as a permanent memory slot and
  use the remaining slots as rolling working memory. This keeps the initial
  prompted mask available during later propagation instead of evicting it from
  the FIFO window.
- Also letterbox frames and masks into the fixed Cutie ONNX input size instead
  of stretching them, unletterbox propagated masks back to source dimensions,
  and mark padded memory regions invalid for memory readout.
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.

1 participant