Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About SAM2 Prompt #1

Closed
ShuoShenDe opened this issue Aug 3, 2024 · 4 comments
Closed

About SAM2 Prompt #1

ShuoShenDe opened this issue Aug 3, 2024 · 4 comments

Comments

@ShuoShenDe
Copy link
Contributor

ShuoShenDe commented Aug 3, 2024

Dear IDEA-Research Team,

It is not strictly correct to say that SAM2 only supports points as prompts. Based on my review of the SAM2 source code yesterday, it also supports masks as prompts. To verify this, I created Grounded-SAM2-Tracking (https://github.com/ShuoShenDe/Grounded-Sam2-Tracking.git) as an example, which validated the feasibility of using grounded-sam plus SAM2 for video tracking. Additionally, I have implemented continuous segmentation and tracking using Grounded-Segment-Anything and SAM2, ensuring the stability of object IDs.

As the code for this project is still being modified, do not hesitate to contact me if you have any concerns or feedback.

Best regards,
Shuo Shen

@rentainhe
Copy link
Collaborator

Dear Shuo Shen:

Thank you very much for correcting my mistakes. We previously overlooked SAM's video segmentation with its ability to support mask prompts. I have just carefully read your code, and I must say it's very well-implemented. It includes segmentation, determining new object IDs across all segment images (ensuring consistent IDs), as well as data dumping and visualization. Everything is done very nicely. If you don't mind, would it be possible for us to reference your code in our README? We would like to sincerely invite you to collaborate with us and see if you have time to implement a similar idea in this repository. If your schedule doesn't allow it, we would also like to update our code following a similar approach in the future.

Best regards,

Tianhe Ren

@ShuoShenDe
Copy link
Contributor Author

Dear Tianhe Ren,

Thank you for your kind words and the invitation to collaborate. I am honored that you wish to reference my code in your README. Please feel free to do so.

I would be delighted to contribute as a collaborator and add to this project. For further details on our collaboration, please feel free to reach out to me via email at [email protected].

Best regards,
Shuo Shen

@rentainhe
Copy link
Collaborator

rentainhe commented Aug 5, 2024

Dear Shuo Shen

Thank you very much for your willingness to collaborate with us. We would be delighted to have you merge your code implementation into this repository. Feel free to submit a pull request if you have the time, and we will merge your code as soon as possible.

Best regards,

Tianhe Ren

@ronghanghu
Copy link

ronghanghu commented Aug 7, 2024

Hi @rentainhe, thanks for the great work! Chiming in to provide more details regarding SAM 2 prompting:

Regarding mask prompts in SAM 2:

  • SAM 2 also supports using masks as a prompt -- We have an interface add_new_mask for it in the video predictor class SAM2VideoPredictor

Regarding box prompts in SAM 2:

Maybe we could directly use the box prompt or mask prompt instead of Uniform Point Sampling in this case?

rentainhe pushed a commit that referenced this issue Aug 14, 2024
fixed typo in class name and in example notebooks
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

No branches or pull requests

3 participants