MobileSAM2: Lightweight Segment Anything for Spatial Intelligence
Paper

MobileSAM2: Lightweight Segment Anything for Spatial Intelligence

Yufei Wang
2026.07.20
·Arxiv·by Homin.Lee
#Computer Vision#Knowledge Distillation#Lightweight Model#MobileSAM2#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.

  1. 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 ϵ\epsilon-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 HH, minimizing:
LTHKD=∥HtPa−HsPa∥F+∥HtIns−HsIns∥FL_{THKD} = \|H^{P a}_{t} - H^{P a}_{s} \|_{F} + \|H^{Ins}_{t} - H^{Ins}_{s}\|_{F}
where HtH_{t} and HsH_{s} are the incidence matrices for teacher and student models.

  1. 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:
LGHKD=∥HtGran−HsGran∥FL_{GHKD} = \|H^{Gran}_{t} - H^{Gran}_{s}\|_{F}

The total training objective combines these distillation losses with standard feature-based alignment:
Loss=∥zIt−zIs∥1+α⋅LTHKD+β⋅LGHKDLoss = \|zI_{t} - zI_{s} \|_{1} + \alpha \cdot L_{THKD} + \beta \cdot L_{GHKD}

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:
  • ΓEmb\Gamma_{Emb}: Embedding dimension.
  • ΓBlk\Gamma_{Blk}: Depth (number of blocks per stage).
  • ΓWinSiz\Gamma_{WinSiz}: Window size for attention.
  • ΓHExp\Gamma_{HExp}: 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.