InstructSAM: A Training-free Framework for Instruction-Oriented Remote Sensing Object Recognition

Yijie Zheng, Weijie Wu, Qingyun Li, Xuehui Wang, Xu Zhou, Aiai Ren, Jun Shen, Long Zhao, Guoqing Li, Xue Yang

Abstract

Remote sensing (RS) object recognition often requires specialized, closed-set models that struggle with complex, reasoning-heavy instructions. We present InstructSAM, a training-free framework that leverages the strengths of foundation models to perform instruction-driven object detection and segmentation. By reformulating detection as a counting-constrained matching problem solved via binary integer programming (BIP), InstructSAM achieves state-of-the-art performance in zero-shot scenarios while significantly reducing computational overhead compared to direct generative approaches.

Introduction

Analyzing satellite and aerial imagery presents unique challenges due to the "bird’s-eye view" perspective, varying spatial resolutions, and the vast domain gap between aerial data and natural images. Traditional models are typically limited to a fixed set of categories and require extensive labeled data. While open-vocabulary models have made strides, they often fail when faced with complex instructions that require reasoning, such as identifying all areas suitable for specific logistical operations or multi-class "sports field" identification.

The InstructSAM Framework

InstructSAM avoids the need for expensive retraining or fine-tuning by orchestrating three distinct foundation models in a synergistic pipeline:

  1. Instruction-Oriented Counting: A Large Vision-Language Model (LVLM), such as GPT-4o or Qwen2.5-VL, serves as the high-level reasoning engine. Given an image and a natural language instruction, it generates a list of target categories and their estimated counts.
  2. Class-Agnostic Mask Proposing: Simultaneously, Segment Anything Model 2 (SAM2) generates a dense set of high-quality, class-agnostic mask proposals. This step ensures precise localization of potential objects without requiring prior knowledge of their labels.
  3. Counting-Constrained Matching: This core innovation bridges the gap between the LVLM's counts and SAM2's masks. The framework calculates semantic similarity between masks and categories using GeoRSCLIP, a remote-sensing-specific CLIP model. A Binary Integer Programming (BIP) solver then optimally assigns labels to masks, ensuring the final output adheres to the global count constraints provided by the LVLM.

EarthInstruct: A New Benchmark

To evaluate this framework, the researchers introduced EarthInstruct, the first benchmark specifically designed for Instruction-Oriented Counting, Detection, and Segmentation (InstructCDS). Constructed from the NWPU-VHR-10 and DIOR datasets, EarthInstruct covers 20 categories and includes challenging "open-subclass" scenarios. The model's robustness was further validated on out-of-distribution (OOD) datasets like xBD for disaster assessment and the Aerial Maritime Drone Large dataset.

Key Insights and Results

The shift from simple threshold-based detection to a global counting constraint represents a significant paradigm shift. By using the count as a hard constraint, InstructSAM effectively mitigates common issues like hallucinations or missed detections prevalent in traditional zero-shot detectors.

Instruction-Driven Flexibility

The framework's ability to selectively identify objects based on specific user queries is a key differentiator. For instance, a user can request a specific subset of features, and the model will adapt its counting and matching logic to focus only on the relevant entities.

Performance and Efficiency

  • Accuracy: InstructSAM-GPT4o achieved an 83.0 Cnt F1 score on the NWPU-VHR-10 dataset, vastly outperforming generic models like Grounding DINO (14.9) and OWLv2 (39.4).
  • Computational Savings: By using the LVLM only for high-level counting rather than coordinate generation, InstructSAM reduced output tokens by 89% and cut runtime by over 32% compared to direct generative methods.
  • Stability: The framework's inference time remains nearly constant regardless of object density, making it highly suitable for large-scale urban monitoring.

Limitations and Future Work

Despite its success, InstructSAM faces challenges with extremely thin or non-compact geometries, such as the lines on a basketball court, where SAM2's proposals may be less precise. Additionally, while the framework excels with optical (RGB) data, extending its capabilities to Synthetic Aperture Radar (SAR) or multispectral imagery remains an area for future research. The team also aims to improve CLIP alignment for small object proposals by incorporating more semantically diverse remote sensing data.

Conclusion

InstructSAM demonstrates that complex remote sensing tasks can be solved efficiently without task-specific training. By combining the reasoning of LVLMs with the precise segmentation of SAM2 and the logical rigor of integer programming, it sets a new standard for flexible, instruction-driven aerial image analysis.

Summary updated

BibTeX
@inproceedings{zheng2025instructsam,
  author = {Yijie Zheng and Weijie Wu and Qingyun Li and Xuehui Wang and Xu Zhou and Aiai Ren and Jun Shen and Long Zhao and Guoqing Li and Xue Yang},
  title = {{InstructSAM: A Training-free Framework for Instruction-Oriented Remote Sensing Object Recognition}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=7yRwAEWxto},
}
Figure