RemoteCLIP
Model Introduction
RemoteCLIP is a vision-language foundation model for remote sensing. It learns semantically rich visual representations by aligning remote sensing images with text descriptions and supports image-text retrieval, zero-shot classification, few-shot classification, linear probing, k-NN classification, and remote sensing object counting.
Paper: RemoteCLIP: A Vision Language Foundation Model for Remote Sensing
https://arxiv.org/abs/2306.11029
Model Description
RemoteCLIP was proposed by researchers from Hohai University, the Hong Kong University of Science and Technology, Nanjing Forestry University, the Chinese Academy of Forestry, and Griffith University. It is continually pretrained on RSITMD, RSICD, UCM-Captions, and remote sensing detection, segmentation, and UAV imagery converted into image-text pairs through B2C and M2B, and is suitable for remote sensing image-text retrieval and open-vocabulary recognition.
Use Cases
| Scenario | Description |
|---|---|
| Remote sensing image-text contrastive training | Train RemoteCLIP with paired remote sensing images and text descriptions. |
| Remote sensing image-text retrieval | Retrieve text from images or remote sensing images from text queries. |
| Local quick validation | Use synthetic image-text pairs to validate training, inference, evaluation, and visualization. |
| Hugging Face / OneCode execution | Download the standalone model package, install dependencies, and run the scripts directly. |
| Multi-GPU training | Launch distributed multi-process training with torchrun. |
Usage Guide
1. OneCode Usage
Experience intelligent one-click AI4S programming through the OneCode online environment:
Click to Experience Intelligent One-Click AI4S Programming
2. Manual Installation and Usage
Hardware Requirements
- A GPU or DCU is recommended.
- CPU can be used for import and small-scale connectivity verification; full training and inference will be slow.
- DCU users must install DTK in advance. DTK 25.04.2 or above, or the OneScience recommended version matching the cluster, is recommended.
Download the Model Package
hf download OneScience-Group/RemoteCLIP --local-dir ./RemoteCLIP
cd RemoteCLIP
Install the Runtime Environment
DCU Environment
# Please activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is supported
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
GPU Environment
# Please activate CONDA first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# uv installation is supported
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
Training Data Introduction
The paper unifies three groups of heterogeneous remote sensing datasets into paired image-text data. RET-3 contains RSITMD, RSICD, and UCM-Captions; DET-10 contains satellite and UAV object detection datasets; SEG-4 contains the iSAID, LoveDA, Potsdam, and Vaihingen semantic segmentation datasets. Detection annotations are converted into descriptions through Box-to-Caption, while segmentation masks are converted to boxes through Mask-to-Box before caption generation. The resulting pretraining collection is approximately 12 times larger than the original remote sensing image-text datasets combined.
The paper datasets remain subject to their respective download and usage licenses. The authors' official code and model resources are available at:
https://github.com/ChenDelong1999/RemoteCLIP
The complete paper pretraining dataset is not included in this model repository. Generate compact synthetic data for local validation with:
python scripts/fake_data.py
This command creates 32 training pairs and 8 test pairs in data/remoteclip.npz. Synthetic data only validates image and text encoding, bidirectional InfoNCE training, checkpoint loading, retrieval inference, evaluation, and similarity-matrix visualization. The complete synthetic pipeline has been verified successfully, but synthetic training values are not reported as model performance.
For real-data training, organize remote sensing images and text descriptions into paired samples following the paper or the official repository and convert them to data/remoteclip.npz. Do not run scripts/fake_data.py for real-data training. Set data.protocol in conf/config.yaml to real_remoteclip and update the image size, vocabulary size, context length, and training parameters for the converted dataset.
Training
Generate synthetic data before local quick validation:
python scripts/fake_data.py
Single GPU or CPU:
python scripts/train.py
Multi-GPU:
torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py
Training outputs:
result/checkpoints/remoteclip.pt
result/training/metrics.json
Training Weights
Pretrained weights based on paired remote sensing image-text data will be provided under weight/. The weight file will be uploaded in a future update. Checkpoints produced from synthetic data validate the pipeline only and do not provide real remote sensing image-text retrieval capability.
Inference
python scripts/inference.py
Inference extracts image features, text features, and the cross-modal similarity matrix from the test pairs.
Prediction output:
result/output/retrieval.npz
Evaluation and Visualization
python scripts/result.py
Evaluation outputs:
result/evaluation/metrics.json
result/evaluation/similarity_matrix.png
The evaluation script computes image-to-text and text-to-image R@1, R@5, and mean recall, and renders the image-text similarity matrix. Synthetic data is used only to confirm that evaluation and visualization outputs can be generated successfully; its numerical values are not reported as model performance.
Official OneScience Resources
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- This repository is a reproduction of the original RemoteCLIP paper.
- The reproduction code is released under Apache License 2.0. The original datasets and official model weights remain subject to their respective source licenses.
- Downloads last month
- -