[](https://doi.org/10.1038/s41597-022-01878-2) [](https://doi.org/10.1016/j.dib.2024.110852) [](https://pypi.org/project/cloudsen12_models/) [](https://github.com/spaceml-org/cloudsen12_models/blob/main/LICENSE) [](https://huggingface.co/datasets/isp-uv-es/CloudSEN12Plus) [](https://huggingface.co/isp-uv-es/cloudsen12_models)
<h1> <img src="https://raw.githubusercontent.com/IPL-UV/cloudsen12_models/main/notebooks/logo.webp" alt="Logo" width='5%'>
<a href="https://cloudsen12.github.io/"> CloudSEN12 </a>
</h1>
This package contains minimum code to run the CloudSEN12 modelsâïž proposed in [Aybar et al. 2022](https://www.nature.com/articles/s41597-022-01878-02) and [Aybar et al. 2024](https://www.sciencedirect.com/science/article/pii/S2352340924008163).
```
pip install cloudsen12_models
```
Run:
```python
# 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])
```
<img src="https://raw.githubusercontent.com/IPL-UV/cloudsen12_models/main/notebooks/example_flood_dubai_2024.png">
Full example at: [run_in_gee_image.ipynb](https://github.com/IPL-UV/cloudsen12_models/blob/main/notebooks/run_in_gee_image.ipynb).
## models [](https://huggingface.co/isp-uv-es/cloudsen12_models)
With this package, the following models can be loaded: (with the function [`cloudsen12.load_model_by_name()`](https://github.com/IPL-UV/cloudsen12_models/blob/main/cloudsen12_models/cloudsen12.py#L167))
* **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](https://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).
<img width="300" title="DEEPCLOUD project (PID2019-109026RB-I00, University of Valencia) funded by MCIN/AEI/10.13039/501100011033." alt="DEEPCLOUD project (PID2019-109026RB-I00, University of Valencia) funded by MCIN/AEI/10.13039/501100011033." src="https://www.uv.es/chovago/logos/logoMICIN.jpg">
Raw data
{
"_id": null,
"home_page": "https://github.com/IPL-UV/cloudsen12_models",
"name": "cloudsen12_models",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Gonzalo Mateo-Garc\u00eda",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9a/9f/df530161bd58828c6ae909a294c91d99d8705017e19aa8ca287925549c55/cloudsen12_models-0.5.tar.gz",
"platform": null,
"description": "[](https://doi.org/10.1038/s41597-022-01878-2) [](https://doi.org/10.1016/j.dib.2024.110852) [](https://pypi.org/project/cloudsen12_models/) [](https://github.com/spaceml-org/cloudsen12_models/blob/main/LICENSE) [](https://huggingface.co/datasets/isp-uv-es/CloudSEN12Plus) [](https://huggingface.co/isp-uv-es/cloudsen12_models)\n\n<h1> <img src=\"https://raw.githubusercontent.com/IPL-UV/cloudsen12_models/main/notebooks/logo.webp\" alt=\"Logo\" width='5%'> \n\t<a href=\"https://cloudsen12.github.io/\"> CloudSEN12 </a> \n</h1>\n\nThis package contains minimum code to run the CloudSEN12 models\u2601\ufe0f proposed in [Aybar et al. 2022](https://www.nature.com/articles/s41597-022-01878-02) and [Aybar et al. 2024](https://www.sciencedirect.com/science/article/pii/S2352340924008163). \n\n```\npip install cloudsen12_models\n```\n\nRun:\n```python\n# Read S2 image from Google Earth Engine\nbands_gee = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'B9', 'B10', 'B11', 'B12']\nimg_local = ee_image.export_image('COPERNICUS/S2_HARMONIZED/20240417T064631_20240417T070110_T40RCN',\n crs='EPSG:32640',transform=Affine(*[10, 0, 300000, 0, -10, 2800020]),\n bands_gee=bands_gee,\n geometry=box(55.325, 25.225, 55.415, 25.28))\n\n# Load model\nmodelv2 = cloudsen12.load_model_by_name(name=\"UNetMobV2_V2\", weights_folder=\"cloudsen12_models\")\n\n# Compute cloud mask\ncloudmaskv2 = modelv2.predict(img_local/10_000)\n\n# Plot\nfig, ax = plt.subplots(1,2,figsize=(14,5),sharey=True, tight_layout=True)\nrgb = (img_local.isel({\"band\": [bands_gee.index(b) for b in [\"B4\",\"B3\",\"B2\"]]}) / 4_500.).clip(0,1)\nplot.show(rgb,ax=ax[0])\ncloudsen12.plot_cloudSEN12mask(cloudmaskv2,ax=ax[1])\n```\n <img src=\"https://raw.githubusercontent.com/IPL-UV/cloudsen12_models/main/notebooks/example_flood_dubai_2024.png\">\n\nFull example at: [run_in_gee_image.ipynb](https://github.com/IPL-UV/cloudsen12_models/blob/main/notebooks/run_in_gee_image.ipynb).\n\n## models [](https://huggingface.co/isp-uv-es/cloudsen12_models)\nWith this package, the following models can be loaded: (with the function [`cloudsen12.load_model_by_name()`](https://github.com/IPL-UV/cloudsen12_models/blob/main/cloudsen12_models/cloudsen12.py#L167))\n\n* **cloudsen12** Model trained on the 13 bands of Sentinel-2 L1C in the CloudSEN12 dataset.\n* **cloudsen12l2a** Model trained on the 12 bands of Sentinel-2 L2A in the CloudSEN12 dataset.\n* **dtacs4bands** Model trained on the NIR, RED, GREEN and BLUE bands of Sentinel-2 L1C in the CloudSEN12 dataset. Bands: `[\"B08\", \"B04\", \"B03\", \"B02\"]`\n* **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']`.\n* **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.\n* **UNetMobV2_V2** Model trained on the 13 bands of Sentinel-2 L1C in the CloudSEN12+.\n\n\nFor examples about dataset use and training see [cloudsen12.github.io](https://cloudsen12.github.io/).\n\n## Citation\n\nIf you find this code useful please cite:\n\n```\n@article{aybar_cloudsen12_2024,\n\ttitle = {{CloudSEN12}+: {The} largest dataset of expert-labeled pixels for cloud and cloud shadow detection in {Sentinel}-2},\n\tissn = {2352-3409},\n\turl = {https://www.sciencedirect.com/science/article/pii/S2352340924008163},\n\tdoi = {10.1016/j.dib.2024.110852},\n\tjournal = {Data in Brief},\n\tauthor = {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\u00f1onez, Maria and Fajardo, Rai and Espinoza, Wendy and Limas, Antonio and Yali, Roy and Alc\u00e1ntara, Alejandro and Leyva, Martin and Loayza-Muro, Ra\u00fal and Willems, Bram and Mateo-Garc\u00eda, Gonzalo and G\u00f3mez-Chova, Luis},\n\tmonth = aug,\n\tyear = {2024},\n\tpages = {110852},\n}\n\n@article{aybar_cloudsen12_2022,\n\ttitle = {{CloudSEN12}, a global dataset for semantic understanding of cloud and cloud shadow in {Sentinel}-2},\n\tvolume = {9},\n\tissn = {2052-4463},\n\turl = {https://www.nature.com/articles/s41597-022-01878-2},\n\tdoi = {10.1038/s41597-022-01878-2},\n\tnumber = {1},\n\turldate = {2023-01-02},\n\tjournal = {Scientific Data},\n\tauthor = {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\u00eda, Gonzalo and G\u00f3mez-Chova, Luis},\n\tmonth = dec,\n\tyear = {2022},\n\tpages = {782},\n}\n\n```\n\n## Acknowledgments\n\nThis 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).\n\n<img width=\"300\" title=\"DEEPCLOUD project (PID2019-109026RB-I00, University of Valencia) funded by MCIN/AEI/10.13039/501100011033.\" alt=\"DEEPCLOUD project (PID2019-109026RB-I00, University of Valencia) funded by MCIN/AEI/10.13039/501100011033.\" src=\"https://www.uv.es/chovago/logos/logoMICIN.jpg\">\n\n",
"bugtrack_url": null,
"license": "\tLGPL-3.0",
"summary": "\ud83d\udef0\ufe0f CloudSEN12 models",
"version": "0.5",
"project_urls": {
"Documentation": "https://IPL-UV.github.io/cloudsen12_models/",
"Homepage": "https://github.com/IPL-UV/cloudsen12_models",
"Repository": "https://github.com/IPL-UV/cloudsen12_models"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e3a02ee7560970f54b891d781acbbb3a0079ce3a94e1dafbc2c427a24406f9c8",
"md5": "644fa7366b21510d5cff909ff894236c",
"sha256": "6cc437f55b4b4565cf9983bd8f45793e658b2e79942be9f61668629a59e2c922"
},
"downloads": -1,
"filename": "cloudsen12_models-0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "644fa7366b21510d5cff909ff894236c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 9627,
"upload_time": "2024-12-12T10:51:42",
"upload_time_iso_8601": "2024-12-12T10:51:42.239683Z",
"url": "https://files.pythonhosted.org/packages/e3/a0/2ee7560970f54b891d781acbbb3a0079ce3a94e1dafbc2c427a24406f9c8/cloudsen12_models-0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9a9fdf530161bd58828c6ae909a294c91d99d8705017e19aa8ca287925549c55",
"md5": "aa8535ab9715f59dc05ef403032f7ee5",
"sha256": "bcc72242c20f57eec656e0ddcf8fe1a1f1f3c318af8f1268089162e2ece861e7"
},
"downloads": -1,
"filename": "cloudsen12_models-0.5.tar.gz",
"has_sig": false,
"md5_digest": "aa8535ab9715f59dc05ef403032f7ee5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 9370,
"upload_time": "2024-12-12T10:51:44",
"upload_time_iso_8601": "2024-12-12T10:51:44.498821Z",
"url": "https://files.pythonhosted.org/packages/9a/9f/df530161bd58828c6ae909a294c91d99d8705017e19aa8ca287925549c55/cloudsen12_models-0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 10:51:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "IPL-UV",
"github_project": "cloudsen12_models",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cloudsen12_models"
}