File size: 5,544 Bytes
b589012
 
ef75cbd
 
 
 
06a9110
 
 
 
 
 
 
 
 
b589012
 
1618c27
b589012
 
 
2ca7972
b589012
2ca7972
 
 
13fc469
2ca7972
 
 
 
4d6bcaa
 
 
 
 
 
2ca7972
 
 
 
 
 
 
 
 
13fc469
2ca7972
13fc469
2ca7972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13fc469
2ca7972
 
 
13fc469
2ca7972
 
 
13fc469
 
 
 
2ca7972
13fc469
 
 
2ca7972
b589012
2ca7972
 
 
 
b589012
 
 
8d770c9
2ca7972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b589012
2ca7972
b589012
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
license: cc-by-nc-4.0
task_categories:
- image-segmentation
language:
- en
tags:
- Cloud Detection
- Cloud Segmentation
- Remote Sensing Images
- Satellite Images
- HRC-WHU
- CloudSEN12-High
- GF12MS-WHU
- L8-Biome
---

# Cloud-Adapter-Datasets

This dataset card aims to describe the datasets used in the Cloud-Adapter, a collection of high-resolution satellite images and semantic segmentation masks for cloud detection and related tasks.

## Install

```bash
pip install huggingface-hub
```

## Usage

```bash
# Step 1: Download datasets
huggingface-cli download --repo-type dataset XavierJiezou/cloud-adapter-datasets --local-dir data --include hrc_whu.zip 
huggingface-cli download --repo-type dataset XavierJiezou/cloud-adapter-datasets --local-dir data --include gf12ms_whu_gf1.zip
huggingface-cli download --repo-type dataset XavierJiezou/cloud-adapter-datasets --local-dir data --include gf12ms_whu_gf2.zip
huggingface-cli download --repo-type dataset XavierJiezou/cloud-adapter-datasets --local-dir data --include cloudsen12_high_l1c.zip
huggingface-cli download --repo-type dataset XavierJiezou/cloud-adapter-datasets --local-dir data --include cloudsen12_high_l2a.zip
huggingface-cli download --repo-type dataset XavierJiezou/cloud-adapter-datasets --local-dir data --include l8_biome.zip

# Step 2: Extract datasets
unzip hrc_whu.zip -d hrc_whu
unzip gf12ms_whu_gf1.zip -d gf12ms_whu_gf1
unzip gf12ms_whu_gf2.zip -d gf12ms_whu_gf2
unzip cloudsen12_high_l1c.zip -d cloudsen12_high_l1c
unzip cloudsen12_high_l2a.zip -d cloudsen12_high_l2a
unzip l8_biome.zip -d l8_biome
```

## Example

```python
import os
import zipfile
from huggingface_hub import hf_hub_download

# Define the dataset repository
repo_id = "XavierJiezou/Cloud-Adapter"
# Select the zip file of the dataset to download
zip_files = [
    "hrc_whu.zip",
    # "gf12ms_whu_gf1.zip",
    # "gf12ms_whu_gf2.zip",
    # "cloudsen12_high_l1c.zip",
    # "cloudsen12_high_l2a.zip",
    # "l8_biome.zip",
]

# Define a directory to extract the datasets
output_dir = "cloud_adapter_paper_data"

# Ensure the output directory exists
os.makedirs(output_dir, exist_ok=True)

# Step 1: Download and extract each ZIP file
for zip_file in zip_files:
    print(f"Downloading {zip_file}...")
    # Download the ZIP file from Hugging Face Hub
    zip_path = hf_hub_download(repo_id=repo_id, filename=zip_file, repo_type="dataset")
    
    # Extract the ZIP file
    extract_path = os.path.join(output_dir, zip_file.replace(".zip", ""))
    with zipfile.ZipFile(zip_path, "r") as zip_ref:
        print(f"Extracting {zip_file} to {extract_path}...")
        zip_ref.extractall(extract_path)

# Step 2: Explore the extracted datasets
# Example: Load and display the contents of the "hrc_whu" dataset
dataset_path = os.path.join(output_dir, "hrc_whu")
train_images_path = os.path.join(dataset_path, "img_dir", "train")
train_annotations_path = os.path.join(dataset_path, "ann_dir", "train")

# Display some files in the training set
print("Training Images:", os.listdir(train_images_path)[:5])
print("Training Annotations:", os.listdir(train_annotations_path)[:5])

# Example: Load and display an image and its annotation
from PIL import Image

# Load an example image and annotation
image_path = os.path.join(train_images_path, os.listdir(train_images_path)[0])
annotation_path = os.path.join(train_annotations_path, os.listdir(train_annotations_path)[0])

# Open and display the image
image = Image.open(image_path)
annotation = Image.open(annotation_path)

print("Displaying the image...")
image.show()

print("Displaying the annotation...")
annotation.show()
```

## Source Data

- hrc_whu: https://github.com/dr-lizhiwei/HRC_WHU
- gf12ms_whu: https://github.com/whu-ZSC/GF1-GF2MS-WHU
- cloudsen12_high: https://huggingface.co/datasets/csaybar/CloudSEN12-high
- l8_biome: https://landsat.usgs.gov/landsat-8-cloud-cover-assessment-validation-data

## Citation

```bib
@article{hrc_whu,
title = {Deep learning based cloud detection for medium and high resolution remote sensing images of different sensors},
journal = {ISPRS Journal of Photogrammetry and Remote Sensing},
volume = {150},
pages = {197-212},
year = {2019},
author = {Zhiwei Li and Huanfeng Shen and Qing Cheng and Yuhao Liu and Shucheng You and Zongyi He},
}

@article{gf12ms_whu,
  author={Zhu, Shaocong and Li, Zhiwei and Shen, Huanfeng},
  journal={IEEE Transactions on Geoscience and Remote Sensing}, 
  title={Transferring Deep Models for Cloud Detection in Multisensor Images via Weakly Supervised Learning}, 
  year={2024},
  volume={62},
  pages={1-18},
}

@article{cloudsen12_high,
  title={CloudSEN12, a global dataset for semantic understanding of cloud and cloud shadow in Sentinel-2},
  author={Aybar, Cesar and Ysuhuaylas, Luis and Loja, Jhomira and Gonzales, Karen and Herrera, Fernando and Bautista, Lesly and Yali, Roy and Flores, Angie and Diaz, Lissette and Cuenca, Nicole and others},
  journal={Scientific data},
  volume={9},
  number={1},
  pages={782},
  year={2022},
}

@article{l8_biome,
    title = {Cloud detection algorithm comparison and validation for operational Landsat data products},
    journal = {Remote Sensing of Environment},
    volume = {194},
    pages = {379-390},
    year = {2017},
    author = {Steve Foga and Pat L. Scaramuzza and Song Guo and Zhe Zhu and Ronald D. Dilley and Tim Beckmann and Gail L. Schmidt and John L. Dwyer and M. {Joseph Hughes} and Brady Laue}
}
```

## Contact

For questions, please contact Xavier Jiezou at xuechaozou (at) foxmail (dot) com.