ChatPaper.aiChatPaper

Быстрее Segment Anything: В сторону облегченной SAM для мобильных приложений

Faster Segment Anything: Towards Lightweight SAM for Mobile Applications

June 25, 2023
Авторы: Chaoning Zhang, Dongshen Han, Yu Qiao, Jung Uk Kim, Sung-Ho Bae, Seungkyu Lee, Choong Seon Hong
cs.AI

Аннотация

Модель Segment Anything (SAM) представляет собой базовую модель компьютерного зрения, управляемую подсказками, для выделения объекта интереса из фона. С момента выпуска проекта SA командой исследователей Meta, SAM привлекла значительное внимание благодаря своей впечатляющей производительности в условиях нулевого переноса (zero-shot transfer) и высокой универсальности, позволяющей совместимость с другими моделями для продвинутых задач обработки изображений, таких как редактирование с точным контролем. Многие из таких сценариев использования требуют работы на устройствах с ограниченными ресурсами, например, в мобильных приложениях. В данной работе мы стремимся сделать SAM более подходящим для мобильных устройств, заменив тяжеловесный кодировщик изображений на облегченный. Наивный подход к обучению такой новой модели, как в оригинальной статье SAM, приводит к неудовлетворительной производительности, особенно при ограниченных ресурсах для обучения. Мы обнаружили, что это в основном вызвано совместной оптимизацией кодировщика изображений и декодера масок, что побудило нас предложить метод разделенного дистилляции. Конкретно, мы дистиллируем знания из кодировщика изображений ViT-H в оригинальном SAM в облегченный кодировщик, который автоматически совместим с декодером масок в оригинальном SAM. Обучение может быть завершено на одном GPU менее чем за день, а полученная облегченная модель SAM, названная MobileSAM, более чем в 60 раз меньше, но работает на уровне оригинального SAM. По скорости вывода MobileSAM обрабатывает изображение примерно за 10 мс: 8 мс на кодировщик изображений и 2 мс на декодер масок. Благодаря превосходной производительности и большей универсальности, наш MobileSAM в 7 раз меньше и в 4 раза быстрее, чем конкурирующая модель FastSAM, что делает его более подходящим для мобильных приложений. Код проекта MobileSAM доступен по адресу 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