Skip to content

restore SAM3 interactive fast path for repeated clicks#2480

Merged
grzegorz-roboflow merged 3 commits into
mainfrom
fix/sam3-caching
Jun 18, 2026
Merged

restore SAM3 interactive fast path for repeated clicks#2480
grzegorz-roboflow merged 3 commits into
mainfrom
fix/sam3-caching

Conversation

@grzegorz-roboflow

Copy link
Copy Markdown
Collaborator

What does this PR do?

This change restores the SAM3 interactive fast path for repeated clicks. When
image_id is provided, the adapter now tries cached embeddings before decoding/
preprocessing the image, falling back to image input only on cache miss.

It also keeps SAM3 interactive embedding/logit caches on GPU to match legacy click
latency behavior, and adds unit coverage for cache hit, cache miss fallback, error
propagation, and cache placement.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • I have tested this change

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have updated the documentation accordingly (if applicable)

Additional Context

@grzegorz-roboflow grzegorz-roboflow changed the title Add test asserting for cache to be used when SAM3 interactive adapter segment_image is called restore SAM3 interactive fast path for repeated clicks Jun 18, 2026
self.task_type = "unsupervised-segmentation"

# Keep interactive embeddings/logits on GPU to match legacy click latency;
# make CPU spill configurable if memory pressure shows up.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

voting for making this env-variable based with default True and adjusted on serving

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@grzegorz-roboflow grzegorz-roboflow merged commit 2c55d51 into main Jun 18, 2026
49 checks passed
@grzegorz-roboflow grzegorz-roboflow deleted the fix/sam3-caching branch June 18, 2026 10:50
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