ChatPaper.aiChatPaper

Segment Anything Plus Rapide : Vers un SAM Léger pour Applications Mobiles

Faster Segment Anything: Towards Lightweight SAM for Mobile Applications

June 25, 2023
Auteurs: Chaoning Zhang, Dongshen Han, Yu Qiao, Jung Uk Kim, Sung-Ho Bae, Seungkyu Lee, Choong Seon Hong
cs.AI

Résumé

Le modèle Segment Anything (SAM) est un modèle de vision fondamental guidé par des prompts pour extraire l'objet d'intérêt de son arrière-plan. Depuis que l'équipe de recherche de Meta a publié le projet SA, SAM a suscité une attention considérable en raison de ses performances impressionnantes en transfert zero-shot et de sa grande polyvalence, étant compatible avec d'autres modèles pour des applications de vision avancées comme l'édition d'images avec un contrôle granulaire. Nombre de ces cas d'utilisation doivent être exécutés sur des appareils périphériques à ressources limitées, comme les applications mobiles. Dans ce travail, nous visons à rendre SAM adapté aux mobiles en remplaçant l'encodeur d'images lourd par un encodeur léger. Une méthode naïve pour entraîner un tel nouveau SAM, comme dans l'article original, conduit à des performances insatisfaisantes, surtout lorsque les sources d'entraînement sont limitées. Nous constatons que cela est principalement dû à l'optimisation couplée de l'encodeur d'images et du décodeur de masques, ce qui nous motive à proposer une distillation découplée. Concrètement, nous distillons les connaissances de l'encodeur d'images ViT-H du SAM original vers un encodeur d'images léger, qui peut être automatiquement compatible avec le décodeur de masques du SAM original. L'entraînement peut être achevé sur un seul GPU en moins d'une journée, et le SAM léger résultant est appelé MobileSAM, qui est plus de 60 fois plus petit tout en offrant des performances comparables au SAM original. En termes de vitesse d'inférence, MobileSAM traite une image en environ 10 ms : 8 ms pour l'encodeur d'images et 2 ms pour le décodeur de masques. Avec des performances supérieures et une plus grande polyvalence, notre MobileSAM est 7 fois plus petit et 4 fois plus rapide que le FastSAM concurrent, le rendant plus adapté aux applications mobiles. Le code du projet MobileSAM est disponible à l'adresse https://github.com/ChaoningZhang/MobileSAM.
English
Segment anything model (SAM) is a prompt-guided vision foundation model for cutting out the object of interest from its background. Since Meta research team released the SA project, SAM has attracted significant attention due to its impressive zero-shot transfer performance and high versatility of being compatible with other models for advanced vision applications like image editing with fine-grained control. Many of such use cases need to be run on resource-constraint edge devices, like mobile Apps. In this work, we aim to make SAM mobile-friendly by replacing the heavyweight image encoder with a lightweight one. A naive way to train such a new SAM as in the original SAM paper leads to unsatisfactory performance, especially when limited training sources are available. We find that this is mainly caused by the coupled optimization of the image encoder and mask decoder, motivated by which we propose decoupled distillation. Concretely, we distill the knowledge from the image encoder ViT-H in the original SAM to a lightweight image encoder, which can be automatically compatible with the mask decoder in the original SAM. The training can be completed on a single GPU within less than one day, and the resulting lightweight SAM is termed MobileSAM which is more than 60 times smaller yet performs on par with the original SAM. For inference speed, MobileSAM runs around 10ms per image: 8ms on the image encoder and 2ms on the mask decoder. With superior performance and a higher versatility, our MobileSAM is 7 times smaller and 4 times faster than the concurrent FastSAM, making it more suitable for mobile applications. The code for MobileSAM project is provided at https://github.com/ChaoningZhang/MobileSAM
PDF151December 15, 2024