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

Investigate faster SAM implementations and consider changing the default model #186

Open
GenevieveBuckley opened this issue Sep 11, 2023 · 10 comments
Assignees

Comments

@GenevieveBuckley
Copy link
Collaborator

GenevieveBuckley commented Sep 11, 2023

I know there are a whole bunch of projects that popped up after segment-anything was released, but another one we might like to look at and potentially include is FastSAM: https://github.com/CASIA-IVA-Lab/FastSAM

The model checkpoints are linked from the README here: https://github.com/CASIA-IVA-Lab/FastSAM#model-checkpoints

Cross-reference: #174

@constantinpape
Copy link
Contributor

Thanks for the pointer! We're aware of that one already and it's on the list for looking into faster SAM implementations ;).
I just went ahead with the vit_t in #174 because it is so easy to integrate.

@constantinpape constantinpape changed the title Investigate FastSAM? Investigate faster SAM implementations and consider changing the default model Sep 22, 2023
@constantinpape
Copy link
Contributor

I changed the title to indicate the broader scope. As mentioned, a student will start to work on this mid of October, and @anwai98 and me are already working on better benchmarks for the models (that reflect interactive segmentation quality).
See this doc for an overview of our (preliminary) plans for evaluating the faster models.

@GenevieveBuckley
Copy link
Collaborator Author

Just came across another potentially interesting project: https://github.com/SysCV/sam-hq

I haven't looked at this yet, but it might be worth figuring out if it could be useful for microscopy datasets (which are often high resolution images with a lot of fine-grained detail).

@constantinpape
Copy link
Contributor

@constantinpape
Copy link
Contributor

Another candidate: https://arxiv.org/pdf/2312.13789.pdf (similar to MobileSAM, but claims better performance).

@constantinpape
Copy link
Contributor

I tried TinySAM (the method from my previous reply), but it does not work for our data; the bounding box prompt is somehow broken.

image

However, we now have MobileSAM, which also uses a vit_tiny backbone, integrated nicely. Will summarize this soon.

@constantinpape
Copy link
Contributor

Just as a follow up here:

  • We investigated different vit-tiny implementations, including all the ones from the links above. It turns out the original one from the mobile sam publication works best for our use-cases.
  • We looked into FastSAM (using a conv backbone), but integrating their code would be a bit more difficult, so we will not do this in the short term.
  • We also did much more thorough investigations regarding different models (both the original models and our finetuned ones).

Based on this I think the best strategy is:

  • Setting vit_l as the default model. (It's faster than vit_h without any penalty in performance, or even slightly better performance).
  • Giving a concise recommendation for the best model for a given situation (i.e. when to use our finetuned models).
  • We will go ahead with this for 0.5 (goal is to get this out within the next 2 weeks), but it's also pending modelzoo integration (because we will upload our finetuned models there), see Bioimageio Model Creation #227

@constantinpape constantinpape removed this from the 0.5.0 milestone Apr 12, 2024
@constantinpape
Copy link
Contributor

For the next release we will go with the strategy outlined above, so I removed this issue from the milestone.
Will leave it open though for future discussions.

@psobolewskiPhD
Copy link

For 3D, SAM2 seems promising:
https://https//arxiv.org/abs/2408.00756

@constantinpape
Copy link
Contributor

Thanks @psobolewskiPhD , we are already looking into SAM2 :).

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

4 participants