Skip to main content
QUICK REVIEW

[Paper Review] EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anything

Yunyang Xiong, Bala Varadarajan|arXiv (Cornell University)|Dec 1, 2023
Advanced Neural Network ApplicationsComputer Science15 citations
TL;DR

EfficientSAM introduces SAMI, a masked image pretraining approach that trains lightweight ViT encoders to reconstruct features from the SAM image encoder, yielding efficient SAM variants that perform competitively on segmentation tasks while dramatically reducing compute and parameter counts.

ABSTRACT

Segment Anything Model (SAM) has emerged as a powerful tool for numerous vision applications. A key component that drives the impressive performance for zero-shot transfer and high versatility is a super large Transformer model trained on the extensive high-quality SA-1B dataset. While beneficial, the huge computation cost of SAM model has limited its applications to wider real-world applications. To address this limitation, we propose EfficientSAMs, light-weight SAM models that exhibits decent performance with largely reduced complexity. Our idea is based on leveraging masked image pretraining, SAMI, which learns to reconstruct features from SAM image encoder for effective visual representation learning. Further, we take SAMI-pretrained light-weight image encoders and mask decoder to build EfficientSAMs, and finetune the models on SA-1B for segment anything task. We perform evaluations on multiple vision tasks including image classification, object detection, instance segmentation, and semantic object detection, and find that our proposed pretraining method, SAMI, consistently outperforms other masked image pretraining methods. On segment anything task such as zero-shot instance segmentation, our EfficientSAMs with SAMI-pretrained lightweight image encoders perform favorably with a significant gain (e.g., ~4 AP on COCO/LVIS) over other fast SAM models.

Motivation & Objective

  • Reduce the computational and memory burden of Segment Anything Models (SAM) without sacrificing segmentation performance.
  • Propose a SAM-leveraged masked image pretraining (SAMI) framework that uses SAM features as reconstruction targets for lightweight encoders.
  • Demonstrate that SAMI-pretrained backbones generalize well across image classification, object detection, semantic segmentation, and segment-anything tasks.
  • Show that EfficientSAMs (lightweight encoders + SAM decoder) achieve favorable quality-efficiency trade-offs for zero-shot and promptable segmentation.

Proposed method

  • Adapt Masked Autoencoder (MAE) pretraining to reconstruct latent features from the SAM ViT-H encoder as the supervision target.
  • Use a cross-attention decoder where queries come from masked tokens and keys/values come from encoder outputs and masked features.
  • Merge decoder outputs of masked tokens with encoder outputs to form MAE outputs, then apply a linear projection head to align with SAM features.
  • Pretrain on ImageNet-1K (224x224) with a 75% masking ratio and 400 epochs, using MSE loss to minimize reconstruction error between SAM features and MAE outputs.
  • Fine-tune the SAMI-pretrained lightweight encoders (e.g., ViT-Tiny/Small) with SAM’s default decoder on SA-1B for Segment Anything tasks.
  • After pretraining, discard the MAE decoder and use the SAMI-pretrained encoder as the image backbone for downstream tasks (classification, detection, segmentation).

Experimental results

Research questions

  • RQ1Can SAMI pretraining improve the representation quality of lightweight ViT encoders compared to standard MAE and other pretraining baselines?
  • RQ2Do SAMI-pretrained backbones generalize across image classification, object detection, semantic segmentation, and segment-anything tasks?
  • RQ3How do EfficientSAMs (lightweight encoders + SAM decoder) perform on zero-shot and interactive segmentation compared to SAM, MobileSAM, and FastSAM?
  • RQ4What are the effects of reconstruction target, loss, masking ratio, and finetuning steps on downstream performance?
  • RQ5Is there a favorable trade-off between model size, speed, and segmentation quality for EfficientSAMs in practical deployment?

Key findings

  • SAMI improves ImageNet-1K top-1 accuracy over MAE and several baselines for ViT-Tiny/Small/Base (e.g., SAMI-B achieves 84.8% vs 83.6% for MAE-B).
  • On COCO object detection and instance segmentation, SAMI backbones achieve higher AP/bbox and AP/mask than MAE counterparts (e.g., SAMI-B 52.5/46.5 vs MAE-B 51.6/45.9).
  • On ADE20K semantic segmentation, SAMI backbones yield higher mIoU than MAE backbones (e.g., SAMI-B 51.8 vs MAE-B 49.3).
  • EfficientSAM-Ti and EfficientSAM-S achieve competitive zero-shot instance segmentation on COCO/LVIS, with EfficientSAM-S reaching 60.1 AP for COCO and 62.3 AP for LVIS in the 1-2-3 click regime, and up to 76.9 mIoU in zero-shot single-point evaluation.
  • EfficientSAM-S (9.8M parameters) approaches SAM performance with only ~2 AP drop in zero-shot instance segmentation, and EfficientSAM-Ti outperforms MobileSAM and FastSAM in several prompts.
  • Ablations show MSE reconstruction loss outperforms cosine loss, high mask ratio (~75%) is beneficial, and using SAM features as anchors aids masked token reconstruction.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.