SAM3: Passing visual prompt from one image to another #23968
Replies: 2 comments 1 reply
|
👋 Hello @diophantus7, thank you for your interest in Ultralytics 🚀! This is an automated response to help get your discussion moving, and an Ultralytics engineer will also assist you soon.
UpgradeUpgrade to the latest pip install -U ultralyticsEnvironmentsYOLO may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
Status
|
|
Hi @diophantus7, I recently ran into the exact same challenge. I needed to find a specific object across hundreds of independent images with SAM 3's pixel-level accuracy, and while YOLOE is great, it didn't quite give me the fine mask details that SAM 3 provides. While @glenn-jocher is completely right that the standard SAM 3 API natively only supports exemplar prompting on the same image, there is a very clever workaround to bypass this limitation without using the video tracker. It's called the "Shared Canvas" (Spatial Concatenation) strategy. The Core Idea:Instead of trying to pass features between different images, you can trick SAM 3 by putting both images into the same frame:
The Ready-to-Use Solution:You don't even need to write this pipeline from scratch. One of the authors/collaborators in the Ultralytics ecosystem, WongKinYiu (author of YOLOv7), actually built a dedicated wrapper around SAM 3 using this exact logic! It’s called FSS-SAM3 (Few-Shot Semantic Segmentation Meets SAM3). You can find the repository here: It handles the image concatenation, scaling, and negative/positive prompt mining out of the box, allowing you to use a single visual prompt across as many consecutive or independent images as you want, strictly using the SAM 3 engine. Hope this helps speed up your workflow! some wrapper on old implementation : i will write my own structures to do the same but in simpler term . ask me if you need a test code here. |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I have a series of images (with some overlap). I would like to annotate a single image with a (couple) visual prompt and find similar objects in the consecutive images. I tried the SAM3VideoPredictor but I do not want to have the tracking of the object. Can anyone point me to a solution or map out a possible way to solve this?
All reactions