高速化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 Model(SAM)は、プロンプト誘導型の視覚基盤モデルであり、対象物を背景から切り抜くことを目的としています。Metaの研究チームがSAプロジェクトを公開して以来、SAMはその驚異的なゼロショット転移性能と、画像編集のような高度な視覚アプリケーションにおける細かい制御を可能にする他のモデルとの高い互換性により、大きな注目を集めています。このようなユースケースの多くは、モバイルアプリのようなリソース制約のあるエッジデバイスで実行される必要があります。本研究では、重い画像エンコーダを軽量なものに置き換えることで、SAMをモバイルフレンドリーにすることを目指しています。元のSAM論文のように新しいSAMをナイーブにトレーニングする方法では、特にトレーニングリソースが限られている場合、満足のいく性能が得られません。この問題は、画像エンコーダとマスクデコーダの結合最適化が主な原因であることがわかり、これに動機づけられて、我々は分離蒸留を提案します。具体的には、元のSAMの画像エンコーダViT-Hから軽量な画像エンコーダに知識を蒸留し、元のSAMのマスクデコーダと自動的に互換性を持つようにします。トレーニングは1日以内に単一のGPUで完了し、結果として得られる軽量なSAMはMobileSAMと名付けられ、元のSAMと同等の性能を維持しながら60倍以上小さくなります。推論速度に関しては、MobileSAMは1画像あたり約10msで実行されます:画像エンコーダで8ms、マスクデコーダで2msです。優れた性能と高い汎用性を備えた我々のMobileSAMは、同時期に発表されたFastSAMよりも7倍小さく、4倍高速であり、モバイルアプリケーションにより適しています。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