RS-OOD: A Vision-Language Augmented Framework for Out-of-Distribution Detection in Remote Sensing

Chenhao Wang, Yingrui Ji, Meng Yu, Yunjian Zhang, Yao Zhu · DOI

Abstract

Accurate building footprint extraction from remote sensing imagery is often hindered by pixel-level noise and the multi-scale nature of urban environments. We introduce SOPSeg, a framework that adapts the Segment Anything Model (SAM) for high-fidelity building profile extraction. SOPSeg utilizes region-adaptive magnification and oriented prompts to enhance feature representation for small and arbitrarily oriented objects. A specialized geometric refinement pipeline, incorporating Douglas-Peucker simplification and Total Least Squares fitting, is employed to convert noisy raster outputs into geometrically consistent vector polygons. Evaluated on the NWPU and SAT-MTB datasets, SOPSeg demonstrates superior performance over existing methods, particularly in boundary quality, providing a robust solution for automated urban mapping.

Introduction

Extracting building footprints from aerial or satellite imagery typically involves converting raster pixel grids into vector outlines. However, this process often suffers from "digital original sin"—the resulting vectors are filled with high-frequency noise, jagged edges, and "burrs" that reflect the discrete pixel grid rather than the straight lines and sharp corners of human architecture. Furthermore, generic foundational models like the Segment Anything Model (SAM) struggle with small objects in remote sensing due to low contrast and arbitrary orientations. SOPSeg addresses these challenges by enhancing SAM with remote-sensing-specific adaptations and a robust geometric refinement pipeline.

Methodology: The SOPSeg Framework

SOPSeg introduces several key innovations to bridge the gap between foundation models and the specific requirements of remote sensing building extraction.

The SOPSeg architecture integrates region-adaptive magnification and oriented prompts to enhance SAM for remote sensing tasks.

Region-Adaptive Magnification (RAM) & Interpolation

To handle small objects, the system extracts and magnifies them before processing. Since SAM's positional embeddings are tied to a fixed 1024x1024 resolution, SOPSeg uses Position Embedding Interpolation (PEI) via bilinear interpolation. This preserves spatial patterns and fine details without requiring retraining of the core encoder.

Oriented Prompt Mechanism

The framework encodes object orientation through point positions rather than explicit rotation parameters. This achieves robust orientation-aware segmentation without adding new learnable components, maintaining the efficiency of the underlying SAM architecture.

Geometric Refinement Pipeline

Once the initial boundary is extracted, a multi-step "data purification" process is applied to ensure structural integrity:

  1. Douglas-Peucker Algorithm: Simplifies the contour by removing redundant vertices based on a tolerance distance that represents the maximum allowable real-world deviation.
  2. Burr/Spike Removal: A heuristic algorithm identifies and excises microscopic noise (e.g., sharp angles under 30°) and smoothly restitches the boundary.
  3. Total Least Squares (TLS) Fitting: The system assumes vertices are imperfect samples of a perfect line. TLS calculates the ideal linear equation that minimizes orthogonal distance, enforcing true geometric straightness.

Key Insights

  • Geometric Intention Inference: The goal of building extraction is to infer the intended geometry. A jittery wall of hundreds of vertices contains mostly redundant data; the algorithm deduces the mathematically perfect linear equation that likely generated those imperfect pixel samples.
  • Perspective Disturbance Augmentation: To improve adaptability, the framework utilizes projection perturbation to simulate geometric distortions caused by sensor tilt, which is crucial for extracting contours in dense urban areas.

Experimental Evaluation

The framework was evaluated on two prominent remote sensing datasets: NWPU and SAT-MTB. Performance was measured using standard Intersection over Union (IoU) and Boundary IoU (BIoU), the latter being particularly sensitive to the quality of the extracted contours.

Quantitative comparison of SOPSeg against state-of-the-art methods on NWPU and SAT-MTB datasets.

As shown in the results, SOPSeg demonstrates significant improvements over baseline models. On the NWPU dataset, it achieved an 86.55% IoU and 80.49% BIoU, substantially outperforming vanilla SAM and SAM2. The gains are even more pronounced on the SAT-MTB dataset, where SOPSeg reached 73.38% IoU, a nearly 20% improvement over vanilla SAM, highlighting its robustness in complex environments.

Conclusion

SOPSeg successfully adapts the Segment Anything Model for the rigorous requirements of building profile extraction in remote sensing. By combining spatial-semantic enhancements with geometric refinement, the framework produces vector polygons that are not only accurate at the pixel level but also structurally logical. This approach paves the way for more reliable automated urban planning and mapping applications.

Summary updated

BibTeX
@misc{wang2025rs,
  author = {Chenhao Wang and Yingrui Ji and Meng Yu and Yunjian Zhang and Yao Zhu},
  title = {{RS-OOD: A Vision-Language Augmented Framework for Out-of-Distribution Detection in Remote Sensing}},
  year = {2025},
  eprint = {2509.02273},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.02273},
}
Figure