ChaoningZhang /MobileSAM
This is the official code for MobileSAM project that makes SAM lightweight for mobile applications and beyond!
★ 5,907⑂ 590👁 46⑃ 30● 142▤ 0
5,907
stars
+0+2+21
590
forks
46
watchers
30
prs
142
issues
0
releases
–
discussions
README
Faster Segment Anything (MobileSAM) and Everything (MobileSAMv2) :pushpin: MobileSAMv2, available at ResearchGate and arXiv, replaces the grid-search prompt sampling in SAM with object-aware prompt sampling for faster segment everything(SegEvery). :pushpin: MobileSAM, available at ResearchGate and arXiv, replaces the heavyweight image encoder in SAM with a lightweight image encoder for faster segment anything(SegAny). Support for ONNX model export. Feel free to test it on your devices and share your results with us. A demo of MobileSAM running on CPU is open at hugging face demo. On our own Mac i5 CPU, it takes around 3s. On the hugging face demo, the interface and inferior CPUs make it slower but still works fine. Stayed tuned for a new version with more features! You can also run a demo of MobileSAM on your local PC. :grapes: Media coverage and Projects that adapt from SAM to MobileSAM (Thank you all!) 2023/07/03: joliGEN supports MobileSAM for faster and lightweight mask refinement for image inpainting with Diffusion and GAN. 2023/07/03: MobileSAM-in-the-Browser shows a demo of running MobileSAM on the browser of your local PC or Mobile phone. 2023/07/02: Inpaint-Anything supports MobileSAM for faster and lightweight Inpaint Anything 2023/07/02: Personalize-SAM supports MobileSAM for faster and lightweight Personalize Segment Anything with 1 Shot 2023/07/01: MobileSAM-in-the-Browser makes an example implementation of MobileSAM in the browser. 2023/06/30: SegmentAnythingin3D supports MobileSAM to segment anything in 3D efficiently. 2023/06/30: MobileSAM has been featured by AK for the second time, see the link AK's MobileSAM tweet. Welcome to retweet. 2023/06/29: AnyLabeling supports MobileSAM for auto-labeling. 2023/06/29: SonarSAM supports MobileSAM for Image encoder full-finetuing. 2023/06/29: Stable Diffusion WebUIv supports MobileSAM. 2023/06/28: Grounding-SAM supports MobileSAM with Grounded-MobileSAM. 2023/06/27: MobileSAM has been featured by AK, see the link AK's MobileSAM tweet. Welcome to retweet. !MobileSAM :star: How is MobileSAM trained? MobileSAM is trained on a single GPU with 100k datasets (1% of the original images) for less than a day. The training code will be available soon. :star: How to Adapt from SAM to MobileSAM? Since MobileSAM keeps exactly the same pipeline as the original SAM, we inherit pre-processing, post-processing, and all other interfaces from the original SAM. Therefore, by assuming everything is exactly the same except for a smaller image encoder, those who use the original SAM for their projects can adapt to MobileSAM with almost zero effort. :star: MobileSAM performs on par with the original SAM (at least visually) and keeps exactly the same pipeline as the original SAM except for a change on the image encoder. Specifically, we replace the original heavyweight ViT-H encoder (632M) with a much smaller Tiny-ViT (5M). On a single GPU, MobileSAM runs around 12ms per image: 8ms on th