Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

TinySAM: Pushing the Envelope for Efficient Segment Anything Model

About

Recently segment anything model (SAM) has shown powerful segmentation capability and has drawn great attention in computer vision fields. Massive following works have developed various applications based on the pre-trained SAM and achieved impressive performance on downstream vision tasks. However, SAM consists of heavy architectures and requires massive computational capacity, which hinders the further application of SAM on computation constrained edge devices. To this end, in this paper we propose a framework to obtain a tiny segment anything model (TinySAM) while maintaining the strong zero-shot performance. We first propose a full-stage knowledge distillation method with hard prompt sampling and hard mask weighting strategy to distill a lightweight student model. We also adapt the post-training quantization to the prompt-based segmentation task and further reduce the computational cost. Moreover, a hierarchical segmenting everything strategy is proposed to accelerate the everything inference by $2\times$ with almost no performance degradation. With all these proposed methods, our TinySAM leads to orders of magnitude computational reduction and pushes the envelope for efficient segment anything task. Extensive experiments on various zero-shot transfer tasks demonstrate the significantly advantageous performance of our TinySAM against counterpart methods. Codes are available at https://github.com/xinghaochen/TinySAM and https://gitee.com/mindspore/models/tree/master/research/cv/TinySAM.

Han Shu, Wenshuo Li, Yehui Tang, Yiman Zhang, Yihao Chen, Houqiang Li, Yunhe Wang, Xinghao Chen• 2023

Related benchmarks

TaskDatasetResultRank
Instance SegmentationCOCO 2017 (val)--
1144
Medical Image SegmentationISIC
DICE83.2
64
Prostate SegmentationProstate
DSC (Avg)75.6
21
Medical Image SegmentationCHAOS
DSC88.3
14
Medical Image SegmentationNuclei
Dice Score62
12
Anatomical Structure SegmentationTotalSegmentator
Dice Coefficient (1pt)17.1
7
Brain Tumor SegmentationBraTS 2021
Dice (1pt)10.3
7
Computational EfficiencyVolumetric Data
Encoder Time (ms)609
7
Medical Image SegmentationFundus-OD
Dice91.7
7
Abdominal Organ SegmentationAMOS
Dice (1pt)4.9
7
Showing 10 of 13 rows

Other info

Follow for update