Source-linked AI summary
RSPrompter: Learning to Prompt for Remote Sensing Instance Segmentation based on Visual Foundation Model
Keyan Chen, Chenyang Liu, Hao Chen, Haotian Zhang, Wenyuan Li, Zhengxia Zou, Zhenwei Shi
TL;DR
SAM’s category-agnostic design requires manual prompts, and its effectiveness for remote sensing instance segmentation is insufficiently established. RSPrompter learns semantic prompt generation for SAM, with experiments on WHU, NWPU, and SSDD supporting its effectiveness.
Problem
SAM requires manually crafted points, boxes, or masks and lacks established performance evidence for remote sensing instance segmentation.
Source: §I · pp. 1–2, §V · p. 15Method
RSPrompter learns category-related prompt embeddings or other prompts for SAM to autonomously generate semantic instance-level masks, using anchor- and query-based schemes.
Source: §I · p. 2, §V · p. 15Results
RSPrompter improves remote sensing instance segmentation across WHU, NWPU, and SSDD evaluations, reaching 72.5 APmask on WHU, 67.5 APmask on NWPU, and further improving performance on SSDD.
Source: 1) Quantitative Results on the WHU… · p. 9, 2) Quantitative Results on the NWPU… · p. 10, 3) Quantitative Results on the SSDD… · p. 10Takeaways & Limitations
Learning prompts adapts SAM to optical and SAR remote sensing imagery, while the frozen SAM backbone can still provide instance segmentation guidance.
Source: 1) Quantitative Results on the WHU… · p. 9, 3) Quantitative Results on the SSDD… · p. 10
Abstract
from arXiv · showhide
Leveraging the extensive training data from SA-1B, the Segment Anything Model (SAM) demonstrates remarkable generalization and zero-shot capabilities. However, as a category-agnostic instance segmentation method, SAM heavily relies on prior manual guidance, including points, boxes, and coarse-grained masks. Furthermore, its performance in remote sensing image segmentation tasks remains largely unexplored and unproven. In this paper, we aim to develop an automated instance segmentation approach for remote sensing images, based on the foundational SAM model and incorporating semantic category information. Drawing inspiration from prompt learning, we propose a method to learn the generation of appropriate prompts for SAM. This enables SAM to produce semantically discernible segmentation results for remote sensing images, a concept we have termed RSPrompter. We also propose several ongoing derivatives for instance segmentation tasks, drawing on recent advancements within the SAM community, and compare their performance with RSPrompter. Extensive experimental results, derived from the WHU building, NWPU VHR-10, and SSDD datasets, validate the effectiveness of our proposed method. The code for our method is publicly available at kychen.me/RSPrompter.
I. INTRODUCTION
Remote sensing instance segmentation supports semantic understanding of object location, category, and shape, but complex backgrounds and SAM’s dependence on manual prompts limit automated application. RSPrompter addresses this by learning semantic prompts for SAM and evaluating the approach across remote sensing datasets.
- Remote sensing instance segmentation provides object location, category, and shape information for applications including defense, surveying, disaster monitoring, and traffic planning.Source: §I · p. 1
- Complex remote sensing backgrounds challenge the generalization and adaptability of existing instance segmentation algorithms.Source: §I · p. 1
- SAM offers strong zero-shot generalization but requires manually supplied points, boxes, or masks and performs category-agnostic segmentation.Source: §I · pp. 1–2
- SAM’s remote sensing performance depends heavily on prompt type, location, and quantity, while background interference and unclear object edges further hinder segmentation.Source: Figure 1 · p. 1, §I · p. 2
- RSPrompter learns category-related prompts for SAM so its decoder can produce multiple instance-level masks with category labels.Source: §I · p. 2
- The method uses a lightweight feature enhancer and flexible prompt embeddings, and the study evaluates SAM extensions and RSPrompter on three diverse datasets.Source: §I · p. 2
A. Deep Learning based Instance Segmentation
Prompt learning reframes SAM adaptation for remote sensing instance segmentation by generating category-relevant prompts while preserving SAM’s encoder–prompt encoder–decoder framework. RSPrompter uses enhanced intermediate features and alternative prompting structures to produce instance masks automatically.
- Prompt learning redesigns downstream inputs to align with a model’s pre-training task, reducing semantic discrepancies and limiting head overfitting.Source: C. Prompt Learning · p. 3
A. A Revisit of SAM
- SAM encodes images and prompts separately, then uses mask-decoder cross-attention to generate masks conditioned on foreground/background points, boxes, or masks.Source: A. A Revisit of SAM · p. 3
C. Extensions on SAM for Instance Segmentation
- SAM-based remote sensing extensions include an added instance-segmentation head, classification of masks from “everything” mode, and detector-generated boxes used as prompts.Source: A. A Revisit of SAM · p. 4
- RSPrompter generates category-relevant prompt embeddings for instance segmentation while keeping designated model parameters frozen and training the prompting components.Source: A. A Revisit of SAM · p. 4, C. Extensions on SAM for Instance… · p. 6
2) Multi-scale Feature Enhancer:
- RSPrompter processes SAM intermediate features with a lightweight multi-scale enhancer before generating multiple prompt groups, each associated with semantic categories and instance masks.Source: 1) Overview · p. 4, 2) Multi-scale Feature Enhancer · pp. 4–5
3) Anchor-based Prompter:
- The anchor-based prompter uses semantic, localization, and prompt heads, with positional encoding added to preserve image-level spatial information during prompt generation.Source: 3) Anchor-based Prompter · p. 5
A. Experimental Dataset and Settings
The study evaluates RSPrompter on three remote sensing instance segmentation datasets differing in size, categories, and modalities, using dataset-specific imagery and train-test splits.
- The experiments use WHU building, NWPU VHR-10, and SSDD, covering datasets with different sizes, categories, and modalities.Source: A. Experimental Dataset and Settings · p. 7
WHU
- WHU provides 8188 non-overlapping 512×512 RGB aerial images for building instance segmentation.Source: A. Experimental Dataset and Settings · p. 7
NWPU VHR-10
- NWPU uses 80% of its data for training and 20% for testing, with instance annotations used for both training and evaluation.Source: A. Experimental Dataset and Settings · p. 8
SSDD
- SSDD contains 1160 SAR images spanning 1–15 meters in resolution and 2540 ship instances, split randomly into 80% training and 20% testing.Source: A. Experimental Dataset and Settings · p. 8
B. Evaluation Protocol and Metrics
Performance is evaluated with COCO mean average precision for box and mask predictions across IoU thresholds, with stricter thresholds indicating more demanding mask accuracy.
- The evaluation uses COCO mean average precision (mAP) to assess object detection and instance segmentation performance.Source: B. Evaluation Protocol and Metrics · p. 8
- A prediction is a true positive when its predicted box or mask exceeds the IoU threshold with ground truth and its category matches.Source: B. Evaluation Protocol and Metrics · p. 8
- AP is averaged across 10 IoU thresholds from 0.50 to 0.95 and across all categories, with larger values indicating more accurate instance masks.Source: B. Evaluation Protocol and Metrics · p. 8
- AP50 uses a 0.50 IoU threshold, whereas AP75 uses 0.75 and is stricter for evaluating mask accuracy.Source: B. Evaluation Protocol and Metrics · p. 8
C. Implementation Details
RSPrompter uses SAM with a frozen ViT-Huge image encoder, learned prompt embeddings, dataset-specific prompt-group counts, and standard augmentation and optimization settings.
- Unless otherwise specified, experiments use SAM’s ViT-Huge backbone.Source: C. Implementation Details · p. 8
- Each learned prompt produces one final instance mask by selecting SAM’s first output mask, with five prompt embeddings per group.Source: 1) Architecture Details · p. 8
- The number of learnable prompt tokens is set to 100, 70, and 30 for WHU, NWPU, and SSDD, respectively.Source: 1) Architecture Details · p. 8
- Training uses 1024 × 1024 images, horizontal flipping, large-scale jittering, a frozen image encoder, and testing of up to 100 masks per image.Source: 2) Training Details · p. 8
- RSPrompter is compared with multi-stage and single-stage instance segmentation methods, including Mask R-CNN, HTC, SOLOv2, CondInst, BoxInst, and Mask2Former.Source: D. Comparison with the State-of-the-Art · p. 8
1) Quantitative Results on the WHU Dataset:
On WHU building segmentation, RSPrompter-query achieves the strongest reported box and mask performance, outperforming the listed SAM-based and conventional comparisons.
- RSPrompter-query achieves APbox/APmask of 72.5/72.5 on the WHU building dataset, the strongest reported performance in the comparison.Source: 1) Quantitative Results on the WHU… · p. 9
- SAM-seg (Mask2Former) improves over original Mask2Former from 69.3/69.2 to 70.7/71.1 on APbox/APmask.Source: 1) Quantitative Results on the WHU… · p. 9
- SAM-seg (Mask R-CNN) improves over original Mask R-CNN from 66.4/65.6 to 70.3/70.1 on APbox/APmask.Source: 1) Quantitative Results on the WHU… · p. 9
- The results suggest that learning to prompt adapts SAM to optical remote sensing instance segmentation, including with a completely frozen SAM backbone.Source: 1) Quantitative Results on the WHU… · p. 9
2) Quantitative Results on the NWPU Dataset:
On the diverse, ten-category NWPU dataset, RSPrompter achieves the strongest reported box or mask results among the compared methods, while SAM-based approaches remain competitive.
- NWPU contains 10 remote-sensing object classes despite being smaller than WHU, testing generalization across more diverse categories.Source: 2) Quantitative Results on the NWPU… · p. 9
- 70.3 APbox is achieved by RSPrompter-anchor, surpassing the other methods in box prediction.Source: 2) Quantitative Results on the NWPU… · p. 10
- 67.5 APmask is achieved by RSPrompter-query, the strongest reported mask-prediction result on NWPU.Source: 2) Quantitative Results on the NWPU… · p. 10
3) Quantitative Results on the SSDD Dataset:
On SSDD, a single-category SAR ship dataset with a modality and training-domain shift from SAM, SAM-backbone variants provide only marginal gains, whereas RSPrompter improves performance further.
- SSDD is a single-category SAR ship instance-segmentation dataset with a modality that differs from the previously discussed datasets and training data from SAM.Source: 3) Quantitative Results on the SSDD… · p. 10
- RSPrompter-anchor and RSPrompter-query further improve performance beyond the SAM-backbone baselines on SSDD.The passage attributes this improvement to liberating the constrained prompt space.Source: 3) Quantitative Results on the SSDD… · p. 10
- 68.7/66.1 for SAM-seg (Mask R-CNN) marginally improves on 67.7/64.3 for Mask R-CNN.Source: 3) Quantitative Results on the SSDD… · p. 10
- 63.0/66.5 for SAM-seg (Mask2Former) marginally improves on 62.7/64.4 for Mask2Former.Source: 3) Quantitative Results on the SSDD… · p. 10
- Qualitatively, RSPrompter produces sharper edges, more defined contours, improved completeness, and closer ground-truth agreement across the evaluated datasets.Source: 4) Qualitative Visual Comparisons · p. 10
E. Ablation Study
The ablation studies examine encoder scale, feature aggregation, prompt counts and embeddings, sine regularization, decoder training, and multi-scale supervision for RSPrompter-query on NWPU.
Ablation Study
- RSPrompter-query is used for ablations because its design is straightforward and it is treated as the principal method for this study.Source: E. Ablation Study · p. 10
Encoder and features
- The ViT encoder version affects both inference speed and instance-segmentation performance.Source: 1) Impacts of Various Backbones in the… · p. 11, Table IV · p. 11
- Selecting hierarchical feature maps for the aggregator changes prompt-generation performance and efficiency.Source: 2) Impacts of Varied Multi-scale… · p. 11, Table V · p. 12
Feature aggregation
- Reducing aggregator feature channels to 32 does not cause a significant performance decrease despite lowering the original ViT-B, ViT-L, and ViT-H dimensions.Source: 3) Impacts of DownConv Dimension… · p. 12, Table VI · p. 12
- Residual connections materially affect segmentation efficacy, indicating that a wholly serial aggregator is unsuitable for disparate ViT-layer features.Source: 4) Impacts of Varied Architectural… · p. 12, Table VII · p. 13
Prompt design
- The best prompt configuration uses Np = 70 prompt sets and Kp = 5 prompts per set, with each set representing an instance mask.Source: 5) Impacts of Query Numbers and Prompt… · p. 12, RSPrompter · p. 13, Table VIII · p. 13
- Sine mapping reconciles the prompter’s smooth features with the SAM prompt encoder’s high-frequency embeddings.Source: 6) Impacts of Applying Sine… · p. 13, Table IX · p. 14
Decoder and supervision
- Excluding SAM’s mask decoder from training significantly reduces segmentation performance, supporting downstream decoder fine-tuning.Source: 7) Impacts of Freezing the Mask Decoder · p. 14, Table IX · p. 14
10) Analysis of the Low Performance on SAM-cls:
SAM-cls has sub-optimal instance-segmentation performance despite accurate classification, indicating that its weakness lies in SAM’s presegmentation rather than the classifier.
- SAM-cls remains sub-optimal for remote-sensing instance segmentation despite this classifier accuracy.Source: 10) Analysis of the Low Performance on… · p. 14
- 98.5% Top-1 classification accuracy shows that the classifier accurately categorizes the predicted masks’ classes.Source: 10) Analysis of the Low Performance on… · p. 14
- The analysis attributes SAM-cls’s low performance to SAM’s presegmentation under domain shift, not to classifier categorization.Source: 10) Analysis of the Low Performance on… · p. 14
- SAM-det also does not consistently produce robust segmentation even with accurate categories and precise annotated boxes.Source: 11) Oracle Experimentation on SAM-det · p. 14, Table XI · p. 14
F. Discussions
RSPrompter introduces a SAM-based prompt-learning methodology with anchor- and query-based implementations, while identifying computational and convergence issues for future improvement.
- The method is designed to extend beyond SAM to other foundation models.Source: F. Discussions · p. 14, §V · p. 15
- The mask decoder remains computationally demanding because it processes more than 64 × 64 input tokens and requires a forward calculation for each prompt group.For 100 instance targets in one image, this calculation is executed 100 times.Source: F. Discussions · p. 15
- RSPrompter-query converges more slowly than RSPrompter-anchor, despite having a simpler, lighter network structure and superior performance.The slower convergence is attributed to the absence of relatively explicit supervisory information.Source: F. Discussions · p. 15
- RSPrompter learns prompt inputs that enable SAM to autonomously produce semantic instance-level masks for remote sensing images.This replaces the manually crafted prompts required by the original SAM.Source: §V · p. 15
- RSPrompter-anchor uses preset anchors, whereas RSPrompter-query uses queries with optimal transport matching.The two schemes provide distinct implementation choices within the proposed prompt-learning design.Source: §V · p. 15
Related papers
This paper cites
- Attention Is All You Need2017
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2018
- Language Models are Few-Shot Learners2020
- Learning Transferable Visual Models From Natural Language Supervision2021
- Very Deep Convolutional Networks for Large-Scale Image Recognition2014
- Microsoft COCO: Common Objects in Context2014