TinySAM : Repousser les limites pour un modèle Segment Anything efficace
TinySAM: Pushing the Envelope for Efficient Segment Anything Model
December 21, 2023
Auteurs: Han Shu, Wenshuo Li, Yehui Tang, Yiman Zhang, Yihao Chen, Houqiang Li, Yunhe Wang, Xinghao Chen
cs.AI
Résumé
Récemment, le modèle Segment Anything (SAM) a démontré une puissante capacité de segmentation et a suscité une grande attention dans le domaine de la vision par ordinateur. De nombreux travaux ultérieurs ont développé diverses applications basées sur le modèle SAM pré-entraîné, obtenant des performances impressionnantes sur des tâches de vision en aval. Cependant, SAM est composé d'architectures lourdes et nécessite une capacité de calcul massive, ce qui entrave son application sur des dispositifs périphériques à ressources limitées. Pour pallier cela, nous proposons dans cet article un cadre pour obtenir un modèle Segment Anything miniature (TinySAM) tout en conservant une forte performance en zero-shot. Nous proposons d'abord une méthode de distillation de connaissances en plusieurs étapes avec une stratégie d'échantillonnage de prompts difficiles en ligne pour distiller un modèle étudiant léger. Nous adaptons également la quantification post-entraînement à la tâche de segmentation promptable, réduisant ainsi davantage le coût computationnel. De plus, une stratégie hiérarchique de segmentation globale est proposée pour accélérer l'inférence globale par un facteur de 2, avec une dégradation de performance quasi nulle. Grâce à ces méthodes, notre TinySAM permet une réduction computationnelle de plusieurs ordres de grandeur et repousse les limites pour une tâche de segmentation efficiente. Des expériences approfondies sur diverses tâches de transfert zero-shot démontrent la performance significativement avantageuse de notre TinySAM par rapport aux méthodes concurrentes. Les modèles pré-entraînés et les codes seront disponibles à l'adresse https://github.com/xinghaochen/TinySAM et 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.