Skip to main content

CloudSEN12 DOI:10.1038/s41597-022-01878-2 CloudSEN12+ DOI:10.1016/j.dib.2024.110852 PyPI PyPI - License HF HF docs

Logo CloudSEN12

This package contains minimum code to run the CloudSEN12 models☁️ proposed in Aybar et al. 2022 and Aybar et al. 2024.

pip install cloudsen12_models

Run:

# Read S2 image from Google Earth Engine
bands_gee = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'B9', 'B10', 'B11', 'B12']
img_local = ee_image.export_image('COPERNICUS/S2_HARMONIZED/20240417T064631_20240417T070110_T40RCN',
                                  crs='EPSG:32640',transform=Affine(*[10, 0, 300000, 0, -10, 2800020]),
                                  bands_gee=bands_gee,
                                  geometry=box(55.325, 25.225, 55.415, 25.28))

# Load model
modelv2 = cloudsen12.load_model_by_name(name="UNetMobV2_V2", weights_folder="cloudsen12_models")

# Compute cloud mask
cloudmaskv2 = modelv2.predict(img_local/10_000)

# Plot
fig, ax = plt.subplots(1,2,figsize=(14,5),sharey=True, tight_layout=True)
rgb = (img_local.isel({"band": [bands_gee.index(b) for b in ["B4","B3","B2"]]}) / 4_500.).clip(0,1)
plot.show(rgb,ax=ax[0])
cloudsen12.plot_cloudSEN12mask(cloudmaskv2,ax=ax[1])

Full example at: run_in_gee_image.ipynb.

models HF

With this package, the following models can be loaded: (with the function cloudsen12.load_model_by_name())

  • cloudsen12 Model trained on the 13 bands of Sentinel-2 L1C in the CloudSEN12 dataset.
  • cloudsen12l2a Model trained on the 12 bands of Sentinel-2 L2A in the CloudSEN12 dataset.
  • dtacs4bands Model trained on the NIR, RED, GREEN and BLUE bands of Sentinel-2 L1C in the CloudSEN12 dataset. Bands: ["B08", "B04", "B03", "B02"]
  • landsat30 Model trained on the common bands of Sentinel-2 L1C and Landsat 8 and 9 in the CloudSEN12 dataset. Bands: ['B01', 'B02', 'B03', 'B04', 'B08', 'B10', 'B11', 'B12'].
  • UNetMobV2_V1 Model trained on the 13 bands of Sentinel-2 L1C in the CloudSEN12 dataset. The cloud masks of this model are included in CloudSEN12+ dataset.
  • UNetMobV2_V2 Model trained on the 13 bands of Sentinel-2 L1C in the CloudSEN12+.

For examples about dataset use and training see cloudsen12.github.io.

Citation

If you find this code useful please cite:

@article{aybar_cloudsen12_2024,
	title = {{CloudSEN12}+: {The} largest dataset of expert-labeled pixels for cloud and cloud shadow detection in {Sentinel}-2},
	issn = {2352-3409},
	url = {https://www.sciencedirect.com/science/article/pii/S2352340924008163},
	doi = {10.1016/j.dib.2024.110852},
	journal = {Data in Brief},
	author = {Aybar, Cesar and Bautista, Lesly and Montero, David and Contreras, Julio and Ayala, Daryl and Prudencio, Fernando and Loja, Jhomira and Ysuhuaylas, Luis and Herrera, Fernando and Gonzales, Karen and Valladares, Jeanett and Flores, Lucy A. and Mamani, Evelin and Quiñonez, Maria and Fajardo, Rai and Espinoza, Wendy and Limas, Antonio and Yali, Roy and Alcántara, Alejandro and Leyva, Martin and Loayza-Muro, Raúl and Willems, Bram and Mateo-García, Gonzalo and Gómez-Chova, Luis},
	month = aug,
	year = {2024},
	pages = {110852},
}

@article{aybar_cloudsen12_2022,
	title = {{CloudSEN12}, a global dataset for semantic understanding of cloud and cloud shadow in {Sentinel}-2},
	volume = {9},
	issn = {2052-4463},
	url = {https://www.nature.com/articles/s41597-022-01878-2},
	doi = {10.1038/s41597-022-01878-2},
	number = {1},
	urldate = {2023-01-02},
	journal = {Scientific Data},
	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 Espinoza, Wendy and Prudencio, Fernando and Llactayo, Valeria and Montero, David and Sudmanns, Martin and Tiede, Dirk and Mateo-García, Gonzalo and Gómez-Chova, Luis},
	month = dec,
	year = {2022},
	pages = {782},
}

Acknowledgments

This research has been funded by the DEEPCLOUD project (PID2019-109026RB-I00) funded by the Spanish Ministry of Science and Innovation (MCIN/AEI/10.13039/501100011033) and the European Union (NextGenerationEU).

DEEPCLOUD project (PID2019-109026RB-I00, University of Valencia) funded by MCIN/AEI/10.13039/501100011033.

Metadata

Release files for cloudsen12_models 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudsen12_models 1.0.2
File Size Uploaded
cloudsen12_models-1.0.2.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloudsen12_models 1.0.2
File Interpreter ABI Platform
cloudsen12_models-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / cloudsen12_models-1.0.2.tar.gz

Download URL cloudsen12_models-1.0.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c44a024da2690d64e7b29ca6af6ae301880eecf90a5fc757969b93bc3181a6be
BLAKE2b-256 checksum
How to use checksums
47a6af232aa268dabef008003df90baa339ab60c45580f81fd0ff06cf0818a37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.17 Linux/5.15.0-58-generic

Release files / cloudsen12_models-1.0.2-py3-none-any.whl

Download URL cloudsen12_models-1.0.2-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06f541900621a11f64daf0ea09ee1ef34e744dfe2e022adda60dc342109bc75c
BLAKE2b-256 checksum
How to use checksums
cae4a2bfae896912b61c5b813931441eaac3d7701262a33b73f957977f676a0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.17 Linux/5.15.0-58-generic

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0

2 release files

0.5.1

2 release files

0.5

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page