TinySAM: Расширение границ эффективности модели для сегментации любых объектов
TinySAM: Pushing the Envelope for Efficient Segment Anything Model
December 21, 2023
Авторы: Han Shu, Wenshuo Li, Yehui Tang, Yiman Zhang, Yihao Chen, Houqiang Li, Yunhe Wang, Xinghao Chen
cs.AI
Аннотация
Недавно модель Segment Anything Model (SAM) продемонстрировала мощные возможности сегментации и привлекла большое внимание в области компьютерного зрения. Многочисленные последующие работы разработали различные приложения на основе предобученной SAM и достигли впечатляющих результатов в задачах обработки изображений. Однако SAM состоит из сложных архитектур и требует значительных вычислительных ресурсов, что ограничивает её применение на устройствах с ограниченными вычислительными возможностями, таких как периферийные устройства. В связи с этим, в данной статье мы предлагаем фреймворк для создания компактной модели TinySAM, сохраняя при этом высокую производительность в задачах zero-shot. Мы предлагаем метод полного цикла дистилляции знаний с использованием стратегии онлайн-выбора сложных промптов для обучения облегчённой модели-студента. Также мы адаптируем посттренировочное квантование для задач сегментации с использованием промптов, что дополнительно снижает вычислительные затраты. Кроме того, предлагается иерархическая стратегия сегментации всего изображения, которая ускоряет процесс вывода в 2 раза практически без потери производительности. Благодаря всем предложенным методам, наша TinySAM обеспечивает значительное снижение вычислительных затрат и устанавливает новые стандарты эффективности в задачах сегментации. Эксперименты на различных задачах zero-shot переноса демонстрируют существенное преимущество TinySAM по сравнению с альтернативными методами. Предобученные модели и код будут доступны по ссылкам: https://github.com/xinghaochen/TinySAM и 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.