Introduction
The Segment Anything Model (SAM) has established a new paradigm in computer vision by demonstrating zero-shot generalization across diverse image domains. However, its practical deployment is often hindered by its reliance on prompts—such as points or bounding boxes—to generate masks. In fully automated pipelines, users typically rely on either Automatic Mask Generation (AMG), which uses a computationally expensive grid-search approach, or external object detectors (OAS), which introduce significant memory overhead.
AoP-SAM (Automation of Prompts for SAM) addresses these inefficiencies by introducing a lightweight, native prompt predictor and a smart filtering mechanism. This approach enables high-quality segmentation that is both faster and more resource-efficient, particularly for edge computing environments.
The Prompting Bottleneck
To automate SAM, two primary strategies are currently used, both of which possess inherent flaws:
- Automatic Mask Generation (AMG): SAM’s default mode places points in a rigid grid. A sparse grid often misses small objects, while a dense grid generates thousands of redundant masks, creating massive computational waste.
- External Detectors (OAS): This method utilizes separate models like YOLO to identify objects before passing them to SAM. While accurate, these models are "heavy," adding latency and memory demands that are often prohibitive for edge devices like robots or industrial sensors.
AoP-SAM seeks to eliminate this trade-off by providing a "native" automation method that is lightweight and avoids the redundancy of grid-based searching.
Methodology
AoP-SAM introduces two primary components designed to streamline the prompting process:
1. Lightweight Prompt Predictor
Instead of relying on a standalone external detector, the authors developed a lightweight CNN-based module. To maintain efficiency, this module reuses the image embeddings already calculated by SAM’s encoder. By integrating the raw image with these high-level features, the predictor generates a Prompt Confidence Map (PCM)—a heatmap indicating the most likely locations for "segmentable" entities.
2. Adaptive Sampling and Filtering (ASF)
To further refine the process, AoP-SAM employs a "coarse-to-fine" strategy during inference. The system samples high-confidence points from the PCM to generate initial masks. It then utilizes a Prompt Elimination Map to identify which remaining candidate points would likely result in duplicate masks. By filtering these points before they reach SAM’s decoder, the model drastically reduces redundant computations.
Experimental Results
The model was evaluated on three major benchmarks: SA-1B (11 million images), COCO, and LVIS (focused on long-tail object distributions). The results demonstrate that AoP-SAM consistently outperforms existing automation methods in both accuracy and efficiency.
Accuracy and Latency
On the SA-1B dataset using a ViT-H encoder, AoP-SAM achieved a 70.6 mIoU, surpassing both OAS (68.3) and the standard AMG_D (66.8). Furthermore, it reduced inference latency to 0.122s, compared to 0.154s for the central-point OAS method.
Edge Performance
The authors specifically validated the model on the Nvidia Jetson Orin Nano to test its viability for edge AI. In these tests, AoP-SAM required only 0.042 GB of peak memory for prompt automation, whereas the OAS method required 0.78 GB—representing a nearly 18x reduction in memory footprint. This makes SAM viable for hardware with strictly limited power and memory resources.
Key Insights
- Feature Reuse: By "plugging into" SAM’s existing encoder outputs, the Prompt Predictor achieves high accuracy with a fraction of the cost of standalone detectors.
- Redundancy Elimination: The ASF mechanism treats previously generated masks as references. By calculating the cosine similarity between a mask's features and the rest of the image, the model predicts which areas are already "covered," preventing the system from segmenting the same object multiple times.
Limitations and Future Work
While highly efficient, the authors note a minor trade-off: the "full" configuration (using both ASF and the predictor) provides the highest accuracy but introduces a small amount of latency compared to the predictor-only version. Future research may focus on optimizing the ASF loop for even greater speed or extending this native prompting approach to video segmentation, where maintaining temporal consistency across frames adds further complexity.
Summary updated