ChatPaper.aiChatPaper

Segment Anything Mais Rápido: Rumo a um SAM Leve para Aplicações Móveis

Faster Segment Anything: Towards Lightweight SAM for Mobile Applications

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

Resumo

O Segment Anything Model (SAM) é um modelo de base de visão guiado por prompts para destacar o objeto de interesse de seu fundo. Desde que a equipe de pesquisa da Meta lançou o projeto SA, o SAM atraiu significativa atenção devido ao seu impressionante desempenho de transferência zero-shot e alta versatilidade, sendo compatível com outros modelos para aplicações avançadas de visão, como edição de imagens com controle refinado. Muitos desses casos de uso precisam ser executados em dispositivos de borda com recursos limitados, como aplicativos móveis. Neste trabalho, buscamos tornar o SAM amigável para dispositivos móveis substituindo o codificador de imagem pesado por um leve. Uma abordagem ingênua para treinar um novo SAM, como no artigo original, resulta em desempenho insatisfatório, especialmente quando há fontes de treinamento limitadas. Descobrimos que isso é causado principalmente pela otimização acoplada do codificador de imagem e do decodificador de máscara, o que nos motivou a propor a destilação desacoplada. Concretamente, destilamos o conhecimento do codificador de imagem ViT-H no SAM original para um codificador de imagem leve, que pode ser automaticamente compatível com o decodificador de máscara do SAM original. O treinamento pode ser concluído em uma única GPU em menos de um dia, e o SAM leve resultante é denominado MobileSAM, que é mais de 60 vezes menor, mas com desempenho equivalente ao SAM original. Em termos de velocidade de inferência, o MobileSAM processa cerca de 10ms por imagem: 8ms no codificador de imagem e 2ms no decodificador de máscara. Com desempenho superior e maior versatilidade, nosso MobileSAM é 7 vezes menor e 4 vezes mais rápido que o FastSAM concorrente, tornando-o mais adequado para aplicações móveis. O código do projeto MobileSAM está disponível em 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
PDF161March 23, 2026