ChatPaper.aiChatPaper

Schnelleres Segment Anything: Auf dem Weg zu einem schlanken SAM für mobile Anwendungen

Faster Segment Anything: Towards Lightweight SAM for Mobile Applications

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

Zusammenfassung

Das Segment Anything Model (SAM) ist ein prompt-gesteuertes Vision-Foundation-Modell, das dazu dient, das Objekt von Interesse von seinem Hintergrund zu trennen. Seit das Meta-Forschungsteam das SA-Projekt veröffentlicht hat, hat SAM aufgrund seiner beeindruckenden Zero-Shot-Transfer-Leistung und seiner hohen Vielseitigkeit, die eine Kompatibilität mit anderen Modellen für fortgeschrittene Vision-Anwendungen wie die Bildbearbeitung mit fein abgestufter Kontrolle ermöglicht, erhebliche Aufmerksamkeit erregt. Viele dieser Anwendungsfälle müssen auf ressourcenbeschränkten Edge-Geräten, wie mobilen Apps, ausgeführt werden. In dieser Arbeit zielen wir darauf ab, SAM mobilfreundlich zu machen, indem wir den schwergewichtigen Bild-Encoder durch einen leichtgewichtigen ersetzen. Ein naiver Ansatz, ein solches neues SAM wie im ursprünglichen SAM-Papier zu trainieren, führt zu unbefriedigenden Ergebnissen, insbesondere wenn nur begrenzte Trainingsressourcen verfügbar sind. Wir stellen fest, dass dies hauptsächlich auf die gekoppelte Optimierung des Bild-Encoders und des Mask-Decoders zurückzuführen ist, was uns dazu motiviert, die entkoppelte Destillation vorzuschlagen. Konkret destillieren wir das Wissen aus dem Bild-Encoder ViT-H im ursprünglichen SAM in einen leichtgewichtigen Bild-Encoder, der automatisch mit dem Mask-Decoder im ursprünglichen SAM kompatibel ist. Das Training kann auf einer einzelnen GPU in weniger als einem Tag abgeschlossen werden, und das resultierende leichtgewichtige SAM wird als MobileSAM bezeichnet, das mehr als 60 Mal kleiner ist, aber eine vergleichbare Leistung wie das ursprüngliche SAM erzielt. In Bezug auf die Inferenzgeschwindigkeit benötigt MobileSAM etwa 10 ms pro Bild: 8 ms für den Bild-Encoder und 2 ms für den Mask-Decoder. Mit überlegener Leistung und höherer Vielseitigkeit ist unser MobileSAM 7 Mal kleiner und 4 Mal schneller als das gleichzeitige FastSAM, was es besser für mobile Anwendungen geeignet macht. Der Code für das MobileSAM-Projekt ist unter https://github.com/ChaoningZhang/MobileSAM verfügbar.
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