The Segment Anything Model (SAM) for remote sensing applications: From zero to one shot

Lucas Prado Osco, Qiusheng Wu, Eduardo Lopes de Lemos, Wesley Nunes Gonçalves, Ana Paula Marques Ramos, Jonathan Li, José Marcato Junior

Introduction

Image segmentation—the process of partitioning an image into meaningful, discrete segments—is a foundational task in remote sensing. It underpins critical applications ranging from urban planning and agricultural monitoring to disaster management. Historically, high-performing segmentation models have been "data-hungry," requiring thousands of manually annotated examples to achieve accuracy on specific geospatial tasks. This "annotation bottleneck" has long limited the scalability of deep learning in Earth observation.

Meta AI’s Segment Anything Model (SAM) recently introduced a paradigm shift with its zero-shot learning capabilities, demonstrating an ability to segment objects without prior task-specific training. However, the unique characteristics of remote sensing—including top-down perspectives, varying spatial resolutions, and complex hierarchical structures—present challenges that general-purpose models often struggle to overcome. This paper evaluates SAM’s performance in the geospatial domain and proposes a novel, automated "one-shot" approach to bridge the gap between general computer vision and specialized remote sensing needs.

Methodological Framework

The research evaluates SAM across two distinct operational paradigms designed to minimize or eliminate manual labeling:

1. Zero-Shot Prompting

The study first assesses SAM’s baseline performance using various prompt types: bounding boxes, individual points, and text descriptors. To facilitate text-based segmentation, the researchers integrated Grounding DINO, an open-set object detector. This pipeline allows a user to input a text prompt (e.g., "building"), which Grounding DINO converts into a bounding box that SAM then uses to generate a precise mask.

2. Automated One-Shot Learning (PerSAM-F)

To address the limitations of zero-shot performance, the authors implemented PerSAM-F (Personalized SAM with Fine-tuning). While traditional one-shot learning requires a human to provide a single labeled example, this study innovates by automating the process. The system uses the highest-confidence detection from a text-prompted zero-shot pass to serve as the "one shot." The model then undergoes a rapid fine-tuning process—adjusting only two learnable weights for approximately 10 seconds—allowing SAM to "personalize" its weights to the specific visual characteristics of the target dataset.

Experimental Setup and Datasets

The model was tested across a diverse array of platforms and spatial resolutions to determine the limits of its applicability:

  • UAV (Unmanned Aerial Vehicle): Very high-resolution imagery (0.01m to 0.09m) featuring individual trees, houses, and plantation crops.
  • Airborne: Medium-resolution imagery (0.20m to 0.45m) focusing on vehicles and lakes.
  • Satellite: Lower-resolution imagery (0.30m to 0.50m) utilizing the LoveDA and SkySat ESA archives for complex urban and rural multi-class segmentation.

Key Findings and Discussion

The Resolution Threshold

A critical insight from the study is SAM’s sensitivity to spatial resolution. The model’s accuracy declines significantly when pixel size exceeds 30cm. At lower resolutions, SAM struggles with boundary definition, often failing to distinguish between contiguous objects of different classes, such as a road adjacent to a forest canopy.

Prompting Strategies

While bounding boxes are the standard in many computer vision tasks, the authors found that point prompts were surprisingly robust for satellite imagery. At lower resolutions, bounding boxes often "overshot" object boundaries, leading to increased false positives. In contrast, well-placed central points provided more stable anchors for the segmentation decoder.

Overcoming Hierarchical Ambiguity

One of the primary advantages of the automated one-shot (PerSAM-F) approach is its ability to resolve hierarchical structures. In zero-shot mode, SAM often faces ambiguity—for instance, failing to distinguish whether it should segment a single tree, a car parked beneath it, or the entire forest patch. The one-shot fine-tuning helps the model "lock in" on the specific scale and semantic level of the target object defined by the initial high-confidence sample.

Results and Performance

The automated one-shot approach (Text PerSAM-F) consistently outperformed zero-shot baselines across various metrics:

  • Accuracy Gains: In UAV-based tree segmentation, the Dice coefficient improved from 0.922 to 0.950 through automated fine-tuning.
  • High-Precision Agriculture: In 0.01m resolution plantation datasets, the model achieved a Dice score of 0.958, demonstrating its readiness for precision agricultural monitoring.
  • Satellite Limitations: Multi-class segmentation on satellite data remains a significant challenge. Dice scores in these environments ranged from 0.54 to 0.82, suggesting that while SAM is a powerful tool, it is not yet a total replacement for specialized models in complex, low-resolution urban environments.

Conclusion and Future Work

While SAM represents a major step toward "foundation models" for Earth observation, several hurdles remain. Currently, SAM is optimized for RGB imagery, whereas remote sensing frequently utilizes multispectral data (e.g., Near-Infrared). Furthermore, the model occasionally struggles with shadows, misidentifying them as part of the physical structure of trees or buildings. Finally, the computational weight of the image encoder remains a barrier for processing large-scale satellite orthomosaics.

To support further research, the authors have released the samgeo Python package, providing the community with tools to implement these zero-to-one-shot workflows in their own geospatial pipelines.

Summary updated

BibTeX
@article{osco2023segment,
  author = {Lucas Prado Osco and Qiusheng Wu and Eduardo Lopes de Lemos and Wesley Nunes Gonçalves and Ana Paula Marques Ramos and Jonathan Li and José Marcato Junior},
  title = {{The Segment Anything Model (SAM) for remote sensing applications: From zero to one shot}},
  journal = {Int. J. Appl. Earth Obs. Geoinformation},
  year = {2023},
  doi = {10.1016/j.jag.2023.103540},
}
Figure