zhangrenchao commited on
Commit
c45cfe7
·
verified ·
1 Parent(s): 2ca760b

Update English model card

Browse files
Files changed (1) hide show
  1. README.md +39 -55
README.md CHANGED
@@ -1,22 +1,19 @@
1
  ---
2
- frameworks: PyTorch
3
  language:
4
  - en
5
- license: apache-2.0
6
  tags:
7
  - OneScience
8
  - Earth Science
9
- - Remote Sensing
10
  - Vision-Language Model
11
- - Image-Text Retrieval
12
- - RemoteCLIP
13
- - arxiv:2306.11029
14
- tasks: []
15
  datasets:
16
  - RSITMD
17
  - RSICD
18
  - UCM-Captions
19
  ---
 
20
  <p align="center">
21
  <strong>
22
  <span style="font-size: 30px;">RemoteCLIP</span>
@@ -25,50 +22,48 @@ datasets:
25
 
26
  # Model Introduction
27
 
28
- 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.
29
-
30
- Paper: RemoteCLIP: A Vision Language Foundation Model for Remote Sensing
31
 
 
32
  https://arxiv.org/abs/2306.11029
33
 
34
  # Model Description
35
 
36
- 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.
37
 
38
  # Use Cases
39
 
40
  | Scenario | Description |
41
  | :---: | :--- |
42
- | Remote sensing image-text contrastive training | Train RemoteCLIP with paired remote sensing images and text descriptions. |
43
- | Remote sensing image-text retrieval | Retrieve text from images or remote sensing images from text queries. |
44
- | Local quick validation | Use synthetic image-text pairs to validate training, inference, evaluation, and visualization. |
45
- | Hugging Face / OneCode execution | Download the standalone model package, install dependencies, and run the scripts directly. |
46
- | Multi-GPU training | Launch distributed multi-process training with `torchrun`. |
 
47
 
48
  # Usage Guide
49
 
50
- ## 1. OneCode Usage
51
 
52
  Experience intelligent one-click AI4S programming through the OneCode online environment:
53
 
54
  [Click to Experience Intelligent One-Click AI4S Programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
55
 
56
- ## 2. Manual Installation and Usage
57
-
58
- **Hardware Requirements**
59
-
60
- - A GPU or DCU is recommended.
61
- - CPU can be used for import and small-scale connectivity verification; full training and inference will be slow.
62
- - DCU users must install DTK in advance. DTK 25.04.2 or above, or the OneScience recommended version matching the cluster, is recommended.
63
-
64
- ### Download the Model Package
65
 
66
  ```bash
67
  hf download OneScience-Group/RemoteCLIP --local-dir ./RemoteCLIP
68
  cd RemoteCLIP
69
  ```
70
 
71
- ### Install the Runtime Environment
 
 
 
 
 
 
72
 
73
  **DCU Environment**
74
 
@@ -92,45 +87,37 @@ pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simp
92
 
93
  ### Training Data Introduction
94
 
95
- 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.
 
 
96
 
97
- The paper datasets remain subject to their respective download and usage licenses. The authors' official code and model resources are available at:
98
 
99
  ```text
100
- https://github.com/ChenDelong1999/RemoteCLIP
 
 
101
  ```
102
 
103
- The complete paper pretraining dataset is not included in this model repository. Generate compact synthetic data for local validation with:
104
 
105
  ```bash
106
  python scripts/fake_data.py
107
  ```
108
 
109
- 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.
110
-
111
- 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.
112
-
113
  ### Training
114
 
115
- Generate synthetic data before local quick validation:
116
-
117
- ```bash
118
- python scripts/fake_data.py
119
- ```
120
-
121
- Single GPU or CPU:
122
-
123
  ```bash
124
  python scripts/train.py
125
  ```
126
 
127
- Multi-GPU:
128
 
129
  ```bash
130
- 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
131
  ```
132
 
133
- Training outputs:
134
 
135
  ```text
136
  result/checkpoints/remoteclip.pt
@@ -139,7 +126,7 @@ result/training/metrics.json
139
 
140
  ### Training Weights
141
 
142
- 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.
143
 
144
  ### Inference
145
 
@@ -147,9 +134,7 @@ Pretrained weights based on paired remote sensing image-text data will be provid
147
  python scripts/inference.py
148
  ```
149
 
150
- Inference extracts image features, text features, and the cross-modal similarity matrix from the test pairs.
151
-
152
- Prediction output:
153
 
154
  ```text
155
  result/output/retrieval.npz
@@ -161,15 +146,13 @@ result/output/retrieval.npz
161
  python scripts/result.py
162
  ```
163
 
164
- Evaluation outputs:
165
 
166
  ```text
167
  result/evaluation/metrics.json
168
  result/evaluation/similarity_matrix.png
169
  ```
170
 
171
- 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.
172
-
173
  # Official OneScience Resources
174
 
175
  | Platform | OneScience Main Repository | Skills Repository |
@@ -179,5 +162,6 @@ The evaluation script computes image-to-text and text-to-image R@1, R@5, and mea
179
 
180
  # Citation and License
181
 
182
- - This repository is a reproduction of the original RemoteCLIP paper.
183
- - The reproduction code is released under Apache License 2.0. The original datasets and official model weights remain subject to their respective source licenses.
 
 
1
  ---
2
+ license: apache-2.0
3
  language:
4
  - en
 
5
  tags:
6
  - OneScience
7
  - Earth Science
8
+ - Remote Sensing Image-Text Retrieval
9
  - Vision-Language Model
10
+ frameworks: PyTorch
 
 
 
11
  datasets:
12
  - RSITMD
13
  - RSICD
14
  - UCM-Captions
15
  ---
16
+
17
  <p align="center">
18
  <strong>
19
  <span style="font-size: 30px;">RemoteCLIP</span>
 
22
 
23
  # Model Introduction
24
 
25
+ RemoteCLIP is a vision-language foundation model for remote sensing imagery and text. It aligns remote sensing visual semantics with natural-language descriptions through CLIP dual encoders and bidirectional contrastive learning, supporting cross-modal retrieval and transfer to downstream remote sensing tasks.
 
 
26
 
27
+ Paper: RemoteCLIP: A Vision Language Foundation Model for Remote Sensing
28
  https://arxiv.org/abs/2306.11029
29
 
30
  # Model Description
31
 
32
+ RemoteCLIP was proposed by a research team from the National University of Defense Technology and other institutions. The model performs continual pretraining with RSITMD, RSICD, UCM-Captions, and remote sensing image-text data constructed by converting task datasets. It is suitable for remote sensing image-text retrieval, zero-shot classification, and vision-language representation learning.
33
 
34
  # Use Cases
35
 
36
  | Scenario | Description |
37
  | :---: | :--- |
38
+ | Remote sensing image-text retrieval | Compute cross-modal similarities between image and text features. |
39
+ | Multi-positive contrastive learning | Use `pair_ids` to express positive relationships such as one image paired with multiple texts. |
40
+ | Zero-shot scene classification | Match natural-language class prompts with image features to recognize remote sensing scenes without training an additional classification head. |
41
+ | Few-shot visual recognition | Transfer vision-language representations and perform few-shot fine-tuning or linear probing for remote sensing classification with limited labels. |
42
+ | Local engineering validation | Use a small amount of synthetic data to check the training, inference, and evaluation workflows. |
43
+ | Multi-GPU training | Launch distributed training with `torchrun`. |
44
 
45
  # Usage Guide
46
 
47
+ ## 1. OneCode
48
 
49
  Experience intelligent one-click AI4S programming through the OneCode online environment:
50
 
51
  [Click to Experience Intelligent One-Click AI4S Programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
52
 
53
+ ## 2. Download and Installation
 
 
 
 
 
 
 
 
54
 
55
  ```bash
56
  hf download OneScience-Group/RemoteCLIP --local-dir ./RemoteCLIP
57
  cd RemoteCLIP
58
  ```
59
 
60
+ ### Environment Dependencies
61
+
62
+ **Hardware Requirements**
63
+
64
+ - A GPU or DCU is recommended.
65
+ - CPU can be used for small-configuration connectivity validation; full training and inference will be slow.
66
+ - DCU users must install DTK in advance. DTK 25.04.2 or above, or the OneScience recommended version matching the current cluster, is recommended.
67
 
68
  **DCU Environment**
69
 
 
87
 
88
  ### Training Data Introduction
89
 
90
+ By default, 8 training and 4 test synthetic image-text samples are used to validate the engineering workflow. They are saved as `data/train.npz` and `data/test.npz`, respectively. Tokens follow the OpenAI CLIP BPE vocabulary of 49,408 entries and the SOT, EOT, and padding sequence constraints.
91
+
92
+ The synthetic data preserves the official model input specifications of 3-channel `224x224` images and CLIP text sequences of length 77.
93
 
94
+ Real data must be preprocessed and converted to the following NPZ training protocol. This protocol is consistent with the model input specification but is not the download format of the original datasets.
95
 
96
  ```text
97
+ images: float32 [N,3,224,224]
98
+ tokens: int64 [N,77]
99
+ pair_ids: int64 [N]
100
  ```
101
 
102
+ `fake_data.py` automatically writes the `protocol` and `data_source` protocol metadata. These fields must be retained when using real data.
103
 
104
  ```bash
105
  python scripts/fake_data.py
106
  ```
107
 
 
 
 
 
108
  ### Training
109
 
 
 
 
 
 
 
 
 
110
  ```bash
111
  python scripts/train.py
112
  ```
113
 
114
+ For multi-GPU training, use:
115
 
116
  ```bash
117
+ torchrun --nproc_per_node=8 scripts/train.py
118
  ```
119
 
120
+ Training optimizes the image and text dual encoders with a multi-positive bidirectional contrastive objective and saves a checkpoint and aggregate training metrics. The default configuration is intended for quick workflow validation. Formal experiments should use the image-text data scale, model configuration, and training duration corresponding to the paper.
121
 
122
  ```text
123
  result/checkpoints/remoteclip.pt
 
126
 
127
  ### Training Weights
128
 
129
+ This repository will provide RemoteCLIP training weights in the `weight/` folder. The weight files will be uploaded soon and are expected to be available in the near future.
130
 
131
  ### Inference
132
 
 
134
  python scripts/inference.py
135
  ```
136
 
137
+ Inference loads the training checkpoint, computes test-set image and text features and their similarities, and saves the results to:
 
 
138
 
139
  ```text
140
  result/output/retrieval.npz
 
146
  python scripts/result.py
147
  ```
148
 
149
+ Using `pair_ids`, evaluation reports bidirectional retrieval R@1, R@5, R@10, and mean recall, and generates a similarity heatmap. Results on synthetic data are only for engineering workflow validation and do not represent full-paper performance.
150
 
151
  ```text
152
  result/evaluation/metrics.json
153
  result/evaluation/similarity_matrix.png
154
  ```
155
 
 
 
156
  # Official OneScience Resources
157
 
158
  | Platform | OneScience Main Repository | Skills Repository |
 
162
 
163
  # Citation and License
164
 
165
+ This repository is a reproduction of the original RemoteCLIP paper.
166
+
167
+ Use of the code and data in this repository remains subject to the licenses and terms of use of their respective projects.