Upload folder using huggingface_hub
Browse files- README.md +88 -0
- config.json +24 -0
- model.safetensors +3 -0
- preprocessor_config.json +23 -0
- special_tokens_map.json +23 -0
- spiece.model +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +33 -0
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- Vision
|
| 5 |
+
- Multi-model
|
| 6 |
+
- Vision-Language
|
| 7 |
+
- Remote-sensing
|
| 8 |
+
widget:
|
| 9 |
+
- src: >-
|
| 10 |
+
https://huggingface.co/datasets/mishig/sample_images/resolve/main/cat-dog-music.png
|
| 11 |
+
candidate_labels: playing music, playing sports
|
| 12 |
+
example_title: Cat & Dog
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Git-RSCLIP
|
| 16 |
+
|
| 17 |
+
Git-RSCLIP model is pre-trained on the Git-10M dataset (a global-scale remote sensing image-text pair dataset, consisting of 10 million image-text pairs) at size 256x256, first released in [this repository](https://github.com/chen-yang-liu/Text2Earth). It employs a similar structure to the [SigLIP](https://arxiv.org/abs/2303.15343) from Google.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
## Intended uses & limitations
|
| 21 |
+
|
| 22 |
+
You can use the raw model for tasks like zero-shot image classification and image-text retrieval.
|
| 23 |
+
|
| 24 |
+
### How to use
|
| 25 |
+
|
| 26 |
+
Here is how to use this model to perform zero-shot image classification:
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
from PIL import Image
|
| 30 |
+
import requests
|
| 31 |
+
from transformers import AutoProcessor, AutoModel
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
model = AutoModel.from_pretrained("lcybuaa/Git-RSCLIP")
|
| 35 |
+
processor = AutoProcessor.from_pretrained("lcybuaa/Git-RSCLIP")
|
| 36 |
+
|
| 37 |
+
url = "https://github.com/Chen-Yang-Liu/PromptCC/blob/main/Example/B/train_000051.png?raw=true"
|
| 38 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 39 |
+
|
| 40 |
+
texts = ["a remote sensing image of river", "a remote sensing image of houses and roads"]
|
| 41 |
+
inputs = processor(text=texts, images=image, padding="max_length", return_tensors="pt")
|
| 42 |
+
|
| 43 |
+
with torch.no_grad():
|
| 44 |
+
outputs = model(**inputs)
|
| 45 |
+
|
| 46 |
+
logits_per_image = outputs.logits_per_image
|
| 47 |
+
probs = torch.sigmoid(logits_per_image) # these are the probabilities
|
| 48 |
+
top5_indices = torch.argsort(probs, descending=True)[:, :5].cpu().numpy()
|
| 49 |
+
top1_indices = top5_indices[:, 0]
|
| 50 |
+
print(f"the image 0 is '{top1_indices[0]}'")
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
For more code examples, we refer to the [documentation](https://huggingface.co/transformers/main/model_doc/siglip.html#).
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
## Training procedure
|
| 57 |
+
|
| 58 |
+
### Training data
|
| 59 |
+
|
| 60 |
+
Git-RSCLIP is pre-trained on the Git-10M dataset (a global-scale remote sensing image-text pair dataset, consisting of 10 million image-text pairs) [(Liu et al., 2024)](https://github.com/chen-yang-liu/Text2Earth).
|
| 61 |
+
|
| 62 |
+
### Preprocessing
|
| 63 |
+
|
| 64 |
+
Images are resized/rescaled to the same resolution (256x256) and normalized across the RGB channels with mean (0.5, 0.5, 0.5) and standard deviation (0.5, 0.5, 0.5).
|
| 65 |
+
|
| 66 |
+
Texts are tokenized and padded to the same length (64 tokens).
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
## Evaluation results
|
| 70 |
+
|
| 71 |
+
Evaluation of Git-RSCLIP compared to other CLIP is shown below (taken from the paper).
|
| 72 |
+
|
| 73 |
+
<img src="https://huggingface.co/lcybuaa/Git-RSCLIP/resolve/main/Git-RSCLIP.png"
|
| 74 |
+
alt="drawing" width="600"/>
|
| 75 |
+
|
| 76 |
+
### BibTeX entry and citation info
|
| 77 |
+
|
| 78 |
+
```bibtex
|
| 79 |
+
@misc{liu2025text2earthunlockingtextdrivenremote,
|
| 80 |
+
title={Text2Earth: Unlocking Text-driven Remote Sensing Image Generation with a Global-Scale Dataset and a Foundation Model},
|
| 81 |
+
author={Chenyang Liu and Keyan Chen and Rui Zhao and Zhengxia Zou and Zhenwei Shi},
|
| 82 |
+
year={2025},
|
| 83 |
+
eprint={2501.00895},
|
| 84 |
+
archivePrefix={arXiv},
|
| 85 |
+
primaryClass={cs.CV},
|
| 86 |
+
url={https://arxiv.org/abs/2501.00895},
|
| 87 |
+
}
|
| 88 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"SiglipModel"
|
| 4 |
+
],
|
| 5 |
+
"initializer_factor": 1.0,
|
| 6 |
+
"model_type": "siglip",
|
| 7 |
+
"text_config": {
|
| 8 |
+
"hidden_size": 1024,
|
| 9 |
+
"intermediate_size": 4096,
|
| 10 |
+
"model_type": "siglip_text_model",
|
| 11 |
+
"num_attention_heads": 16,
|
| 12 |
+
"num_hidden_layers": 24
|
| 13 |
+
},
|
| 14 |
+
"torch_dtype": "float32",
|
| 15 |
+
"transformers_version": "4.37.0.dev0",
|
| 16 |
+
"vision_config": {
|
| 17 |
+
"hidden_size": 1024,
|
| 18 |
+
"image_size": 256,
|
| 19 |
+
"intermediate_size": 4096,
|
| 20 |
+
"model_type": "siglip_vision_model",
|
| 21 |
+
"num_attention_heads": 16,
|
| 22 |
+
"num_hidden_layers": 24
|
| 23 |
+
}
|
| 24 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3cfce8058d573fa2dae91e0b872e2af724ae9337a923ff8b674a2aed4bd92750
|
| 3 |
+
size 1304397540
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_normalize": true,
|
| 3 |
+
"do_rescale": true,
|
| 4 |
+
"do_resize": true,
|
| 5 |
+
"image_mean": [
|
| 6 |
+
0.5,
|
| 7 |
+
0.5,
|
| 8 |
+
0.5
|
| 9 |
+
],
|
| 10 |
+
"image_processor_type": "SiglipImageProcessor",
|
| 11 |
+
"image_std": [
|
| 12 |
+
0.5,
|
| 13 |
+
0.5,
|
| 14 |
+
0.5
|
| 15 |
+
],
|
| 16 |
+
"processor_class": "SiglipProcessor",
|
| 17 |
+
"resample": 3,
|
| 18 |
+
"rescale_factor": 0.00392156862745098,
|
| 19 |
+
"size": {
|
| 20 |
+
"height": 256,
|
| 21 |
+
"width": 256
|
| 22 |
+
}
|
| 23 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eos_token": {
|
| 3 |
+
"content": "</s>",
|
| 4 |
+
"lstrip": true,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": true,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"pad_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": true,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": true,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"unk_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": true,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": true,
|
| 21 |
+
"single_word": false
|
| 22 |
+
}
|
| 23 |
+
}
|
spiece.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e5036bed065526c3c212dfbe288752391797c4bb1a284aa18c9a0b23fcaf8ec
|
| 3 |
+
size 798330
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"1": {
|
| 4 |
+
"content": "</s>",
|
| 5 |
+
"lstrip": true,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": true,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"2": {
|
| 12 |
+
"content": "<unk>",
|
| 13 |
+
"lstrip": true,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": true,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"additional_special_tokens": [],
|
| 21 |
+
"clean_up_tokenization_spaces": true,
|
| 22 |
+
"do_lower_case": true,
|
| 23 |
+
"eos_token": "</s>",
|
| 24 |
+
"model_input_names": [
|
| 25 |
+
"input_ids"
|
| 26 |
+
],
|
| 27 |
+
"model_max_length": 64,
|
| 28 |
+
"pad_token": "</s>",
|
| 29 |
+
"processor_class": "SiglipProcessor",
|
| 30 |
+
"sp_model_kwargs": {},
|
| 31 |
+
"tokenizer_class": "SiglipTokenizer",
|
| 32 |
+
"unk_token": "<unk>"
|
| 33 |
+
}
|