
MobileSAM2: Lightweight Segment Anything for Spatial Intelligence
Key Points
- 1MobileSAM2 is a lightweight family of segment anything models developed by distilling the heavyweight SAM2 foundation model into more efficient architectures for resource-constrained devices.
- 2The authors introduce Hypergraphical Knowledge Distill (HyperKD), a novel method that constructs temporal and granularity hypergraphs to explicitly transfer SAM2’s complex video segmentation knowledge to smaller student models.
- 3Experimental results demonstrate that MobileSAM2 successfully balances efficiency and performance, achieving competitive generalization across multiple benchmarks compared to existing distillation techniques.
MobileSAM2 is a lightweight model family designed to adapt the powerful video segmentation capabilities of SAM2 for resource-constrained edge devices. Recognizing that SAM2’s success stems from its ability to capture large-scale temporal correlations and multi-granular visual hierarchies, the authors introduce Hypergraphical Knowledge Distillation (HyperKD) to transfer this complex knowledge into compact student architectures.
Core Methodology: HyperKD
HyperKD overcomes the limitation of traditional distillation by explicitly modeling the implicit knowledge of the teacher (SAM2) through hypergraphs, which can represent high-order semantic relationships that standard pairwise graphs cannot capture.- Temporal HyperKD: This component addresses the need for robust segmentation across video frames. It constructs two types of hypergraphs: Patch-wise and Instance-wise. By treating embeddings as nodes, it forms hyperedges using an -ball distance threshold, linking nodes that represent related spatial-temporal concepts across frames. The student model is trained to match the teacher's incidence matrix , minimizing:
where and are the incidence matrices for teacher and student models.
- Granularity HyperKD: This component captures hierarchical object-part-subpart relationships. Nodes represent segments at different granularity levels, and hyperedges connect these levels to enforce consistent coarse-to-fine understanding. It minimizes:
The total training objective combines these distillation losses with standard feature-based alignment:
Architecture: Progressive Contraction
To achieve efficiency, the authors introduce a new lightweight model family by searching for optimal architectures using a progressive model contraction strategy. Starting from a Hiera-based backbone, they scale down critical factors:- : Embedding dimension.
- : Depth (number of blocks per stage).
- : Window size for attention.
- : Expansion ratio of attention heads.
By identifying the best-performing architectures within this search space, the authors developed models ranging from 5.8M to 23.7M parameters. Experimental results on datasets including MOSE, DAVIS 2017, and SA-V demonstrate that MobileSAM2 significantly outperforms baseline distillation approaches (like FitNet and FAKD) in terms of Jaccard and F-measure metrics, successfully enabling high-performance, real-time spatial intelligence on mobile and embedded hardware.