Datasets:

License:
File size: 6,013 Bytes
07e4247
 
 
fbb72c8
79e9346
 
 
 
 
 
 
 
 
 
 
 
fbb72c8
8b6827b
fbb72c8
 
 
 
 
0a2727f
 
 
 
 
 
 
 
fbb72c8
e7cc0c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fbb72c8
e9f5a3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708a34a
 
 
 
 
e9f5a3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
02a7656
 
 
 
e9f5a3d
 
 
 
02a7656
e9f5a3d
02a7656
 
 
 
 
e9f5a3d
 
 
 
3853f20
e9f5a3d
e7cc0c9
 
 
79e9346
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-4.0
---

# 🚨 New Dataset Version Released!  

## We are excited to announce the release of **Version [2.0]** of our dataset!  
## This update includes:  
- **[More data]**.
- **[Harmonization model retrained with more data]**.
- **[Temporal support]**.
- **[Check the data without downloading (Cloud-optimized properties)]**.

# 📥 Go to: https://huggingface.co/datasets/tacofoundation/SEN2NAIPv2 and follow the instructions in colab


<center>
  <img src="demo/logo.png" width=95%>
</center>


# SEN2NAIP

The increasing demand for high spatial resolution in remote sensing imagery has led to the necessity of super-resolution (SR) algorithms that 
convert low-resolution (LR) images into high-resolution (HR) ones. To address this need, we introduce SEN2NAIP, a large remote sensing dataset
designed to support conventional and reference-based SR model training. SEN2NAIP is structured into two components to provide a broad spectrum
of research and application needs. The first component comprises a cross-sensor dataset of 2,851 pairs of LR images from Sentinel-2 L2A and HR
images from the National Agriculture Imagery Program (NAIP). Leveraging this dataset, we developed a degradation model capable of converting NAIP
images to match the characteristics of Sentinel-2 imagery (S2like). Subsequently, this degradation model was utilized to create the second component,
a synthetic dataset comprising 17,657 NAIP and S2like image pairs. With the SEN2NAIP dataset, we aim to provide a valuable resource that facilitates
the exploration of new techniques for enhancing the spatial resolution of Sentinel-2 satellite imagery.

# DOWNLOAD DATASET

```
from huggingface_hub import hf_hub_download

# Donwload cross-sensor dataset
hf_hub_download(
    repo_id="isp-uv-es/SEN2NAIP",
    repo_type="dataset",
    filename="cross-sensor/cross-sensor.zip"
)

# Donwload synthetic dataset
for i in range(1, 19):
    hf_hub_download(
        repo_id="isp-uv-es/SEN2NAIP",
        repo_type="dataset",
        filename="synthetic/synthetic_%02d.zip" % i
    )
```



# REPRODUCIBLE EXAMPLES

## Load cross-sensor dataset

```{python}
import rioxarray
import torch

DEMO_PATH = "https://huggingface.co/datasets/isp-uv-es/SEN2NAIP/resolve/main/demo/"

cross_sensor_path = DEMO_PATH + "cross-sensor/ROI_0000/"
hr_data = rioxarray.open_rasterio(cross_sensor_path + "hr.tif")
lr_data = rioxarray.open_rasterio(cross_sensor_path + "lr.tif")
hr_torch = torch.from_numpy(hr_data.to_numpy()) / 255
lr_torch = torch.from_numpy(lr_data.to_numpy()) / 10000
```


## Load Synthetic dataset

Available methods: **vae_histogram_matching**, **vae_histogram_matching**, **gamma_multivariate_normal_90**, **gamma_multivariate_normal_75**, **gamma_multivariate_normal_50**,
**gamma_multivariate_normal_25**, **gamma_multivariate_normal_10**.



```{python}
import opensr_degradation
import rioxarray
import datasets
import requests
import tempfile
import torch
import json


def load_metadata(metadata_path: str) -> dict:
    tmpfile = tempfile.NamedTemporaryFile(suffix=".json")
    with requests.get(metadata_path) as response:
        with open(tmpfile.name, "wb") as file:
            file.write(response.content)
        metadata_json = json.load(open(tmpfile.name, "r"))
    return metadata_json

DEMO_PATH = "https://huggingface.co/datasets/isp-uv-es/SEN2NAIP/resolve/main/demo/"

# Synthetic LR and HR data ------------------------------
synthetic_path = DEMO_PATH + "synthetic/ROI_0001/"

hr_early_data = rioxarray.open_rasterio(synthetic_path + "early/01__m_4506807_nw_19_1_20110818.tif")
hr_early_torch = torch.from_numpy(hr_early_data.to_numpy()) / 255
hr_early_metadata = load_metadata(synthetic_path + "late/metadata.json")
lr_hat, hr_hat = opensr_degradation.main.get_s2like(
    image=hr_early_torch,
    table=hr_early_metadata["sim_histograms"],
    model="gamma_multivariate_normal_50"
)


import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 3, figsize=(10, 5))
ax[0].imshow(hr_early_torch[[3, 1, 2]].permute(1, 2, 0))
ax[0].set_title("NAIP")
ax[1].imshow(hr_hat[[3, 1, 2]].permute(1, 2, 0)*3)
ax[1].set_title("NAIPhat")
ax[2].imshow(lr_hat[[3, 1, 2]].permute(1, 2, 0)*3)
ax[2].set_title("S2like")
plt.show()
```

<center>
  <img src="https://github.com/ESAOpenSR/opensr-degradation/assets/16768318/c88fa16e-bbe7-4072-b518-5ab3b7278893" width=100%>
</center>

# CITATION


```
@article{aybar2025sen2naipv2,
  author    = {Aybar, Cesar and Montero, David and Contreras, Julio and Donike, Simon and Kalaitzis, Freddie and Gómez-Chova, Luis},
  title     = {SEN2NAIP: A large-scale dataset for Sentinel-2 Image Super-Resolution},
  journal   = {Scientific Data},
  year      = {2024},
  volume    = {11},
  number    = {1},
  pages     = {1389},
  doi       = {10.1038/s41597-024-04214-y},
  url       = {https://doi.org/10.1038/s41597-024-04214-y},
  abstract  = {The increasing demand for high spatial resolution in remote sensing has underscored the need for super-resolution (SR) algorithms that can upscale low-resolution (LR) images to high-resolution (HR) ones. To address this, we present SEN2NAIP, a novel and extensive dataset explicitly developed to support SR model training. SEN2NAIP comprises two main components. The first is a set of 2,851 LR-HR image pairs, each covering 1.46 square kilometers. These pairs are produced using LR images from Sentinel-2 (S2) and corresponding HR images from the National Agriculture Imagery Program (NAIP). Using this cross-sensor dataset, we developed a degradation model capable of converting NAIP images to match the characteristics of S2 imagery ($S_{2-like}$). This led to the creation of a second subset, consisting of 35,314 NAIP images and their corresponding $S_{2-like}$ counterparts, generated using the degradation model. With the SEN2NAIP dataset, we aim to provide a valuable resource that facilitates the exploration of new techniques for enhancing the spatial resolution of Sentinel-2 imagery.},
  issn      = {2052-4463}
}
```