NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AM-SAM: Automated Prompting and Mask Calibration for Segment Anything Model

Yuchen Li, Li Zhang, Youwei Liang, Pengtao XiearXiv 2024 · DOI

Abstract

The Segment Anything Model (SAM) has revolutionized computer vision but remains limited by its reliance on manual prompts. This paper introduces AM-SAM (Automated Prompting and Mask Calibration), a framework that automates SAM using a YOLOv8 detector for prompt generation and a novel mask calibration module. By employing bi-level optimization and Hadamard product-based feature fusion, AM-SAM achieves state-of-the-art results in few-shot segmentation, significantly outperforming existing methods like BLO-SAM on both human body and medical datasets.

Introduction

While SAM is a powerful foundation model, it faces two primary challenges: prompt dependency and inadequate feature representation in its mask decoder. Manual prompting is labor-intensive and unsuitable for real-time applications like autonomous driving. Additionally, SAM's reliance on simple dot-product operations often fails to capture the complex spatial correlations needed for precise boundaries, especially across different domains. AM-SAM addresses these bottlenecks to make SAM truly autonomous and more precise.

Methodology

AM-SAM introduces three key innovations to the SAM architecture:

  1. Automated Prompting via YOLOv8: A frozen YOLOv8 detector acts as a "prompt generation network," providing high-confidence bounding boxes that serve as initial spatial hints. This "warm start" allows the model to converge much faster than methods using random initializations.
  2. Bi-Level Optimization: To prevent overfitting in few-shot scenarios, AM-SAM uses a bi-level framework. Model weights are optimized via Low-Rank Adaptation (LoRA) on training data, while learnable prompt embeddings are optimized on a validation set.
  3. Mask Calibration (The Hadamard Branch): A parallel branch performs element-wise multiplication (Hadamard product) between upscaled image embeddings and mask tokens. This "calibrated" feature set is fused with the standard SAM output to refine mask edges.
Qualitative comparison at Epoch 5 showing AM-SAM's rapid convergence compared to BLO-SAM.

Experimental Results

The model was evaluated on the TikTok Human Body Segmentation, Vikram Shenoy Human Segmentation, and ISIC 2018 medical datasets.

Quantitative Performance

AM-SAM demonstrates exceptional robustness in few-shot settings:

  • TikTok Dataset: Achieved an 81.3% Dice score with only 4 training examples, outperforming BLO-SAM by 5%.
  • Medical Domain (ISIC 2018): Reached a 73.6% Dice score with 8 examples, a significant improvement over the 62.3% baseline.

Qualitative Analysis

Visual results confirm that AM-SAM produces significantly cleaner masks with fewer artifacts and more precise boundaries compared to other SAM-based fine-tuning methods.

Qualitative comparison at Epoch 10 demonstrating AM-SAM's superior mask clarity and detail.

Conclusion

AM-SAM successfully automates the Segment Anything Model while improving its precision through a novel calibration mechanism. While its performance is linked to the quality of the underlying object detector, its ability to produce high-quality segmentations with minimal data makes it a powerful tool for specialized domains like medical imaging. Future work will focus on multi-object scenarios and further computational optimizations.

Summary updated

BibTeX
@misc{li2024am,
  author = {Yuchen Li and Li Zhang and Youwei Liang and Pengtao Xie},
  title = {{AM-SAM: Automated Prompting and Mask Calibration for Segment Anything Model}},
  year = {2024},
  eprint = {2410.09714},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.09714},
}
Figure