TinySAM: Spingere i limiti per un modello Efficient Segment Anything
TinySAM: Pushing the Envelope for Efficient Segment Anything Model
December 21, 2023
Autori: Han Shu, Wenshuo Li, Yehui Tang, Yiman Zhang, Yihao Chen, Houqiang Li, Yunhe Wang, Xinghao Chen
cs.AI
Abstract
Recentemente, il modello Segment Anything (SAM) ha dimostrato una potente capacità di segmentazione e ha attirato grande attenzione nel campo della visione artificiale. Numerosi lavori successivi hanno sviluppato varie applicazioni basate sul SAM pre-addestrato, ottenendo prestazioni impressionanti in compiti di visione downstream. Tuttavia, SAM è composto da architetture pesanti e richiede una capacità computazionale massiccia, il che ostacola l'ulteriore applicazione di SAM su dispositivi edge con risorse computazionali limitate. A tal fine, in questo articolo proponiamo un framework per ottenere un modello Tiny Segment Anything (TinySAM) mantenendo una forte performance zero-shot. In primo luogo, proponiamo un metodo di distillazione della conoscenza a pieno stadio con una strategia di campionamento hard prompt online per distillare un modello studente leggero. Adattiamo inoltre la quantizzazione post-addestramento al compito di segmentazione promptable, riducendo ulteriormente il costo computazionale. Inoltre, viene proposta una strategia gerarchica di segmentazione di tutto per accelerare l'inferenza di tutto di 2 volte con quasi nessuna degradazione delle prestazioni. Con tutti questi metodi proposti, il nostro TinySAM porta a una riduzione computazionale di ordini di grandezza e spinge i limiti per il compito efficiente di segmentazione di tutto. Esperimenti estesi su vari compiti di trasferimento zero-shot dimostrano la performance significativamente vantaggiosa del nostro TinySAM rispetto ai metodi concorrenti. Modelli pre-addestrati e codici saranno disponibili su https://github.com/xinghaochen/TinySAM e https://gitee.com/mindspore/models/tree/master/research/cv/TinySAM.
English
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 pretrained 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
online hard prompt sampling strategy to distill a lightweight student model. We
also adapt the post-training quantization to the promptable segmentation task
and further reduce the computational cost. Moreover, a hierarchical segmenting
everything strategy is proposed to accelerate the everything inference by
2times 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. Pre-trained models and
codes will be available at https://github.com/xinghaochen/TinySAM and
https://gitee.com/mindspore/models/tree/master/research/cv/TinySAM.