Datasets:
The dataset viewer is not available for this split.
Error code: StreamingRowsError Exception: UnidentifiedImageError Message: cannot identify image file <_io.BytesIO object at 0x7f174b5b9860> Traceback: Traceback (most recent call last): File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 322, in compute compute_first_rows_from_parquet_response( File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 88, in compute_first_rows_from_parquet_response rows_index = indexer.get_rows_index( File "/src/libs/libcommon/src/libcommon/parquet_utils.py", line 640, in get_rows_index return RowsIndex( File "/src/libs/libcommon/src/libcommon/parquet_utils.py", line 521, in __init__ self.parquet_index = self._init_parquet_index( File "/src/libs/libcommon/src/libcommon/parquet_utils.py", line 538, in _init_parquet_index response = get_previous_step_or_raise( File "/src/libs/libcommon/src/libcommon/simple_cache.py", line 591, in get_previous_step_or_raise raise CachedArtifactError( libcommon.simple_cache.CachedArtifactError: The previous step failed. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/src/services/worker/src/worker/utils.py", line 96, in get_rows_or_raise return get_rows( File "/src/libs/libcommon/src/libcommon/utils.py", line 197, in decorator return func(*args, **kwargs) File "/src/services/worker/src/worker/utils.py", line 73, in get_rows rows_plus_one = list(itertools.islice(ds, rows_max_number + 1)) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1393, in __iter__ example = _apply_feature_types_on_example( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1082, in _apply_feature_types_on_example decoded_example = features.decode_example(encoded_example, token_per_repo_id=token_per_repo_id) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1983, in decode_example return { File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1984, in <dictcomp> column_name: decode_nested_example(feature, value, token_per_repo_id=token_per_repo_id) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1349, in decode_nested_example return schema.decode_example(obj, token_per_repo_id=token_per_repo_id) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/image.py", line 187, in decode_example image = PIL.Image.open(BytesIO(bytes_)) File "/src/services/worker/.venv/lib/python3.9/site-packages/PIL/Image.py", line 3339, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f174b5b9860>
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
MMFlood
A Multimodal Dataset for Flood Delineation from Satellite Imagery.
Download
The dataset has been compacted into tarfiles and zipped, you will need to recompose it before working with it:
# clone the repository
$ git clone [email protected]:datasets/links-ads/mmflood
# rebuild and extract the files
$ cat activations.tar.*.gz.part > activations.tar.gz
$ tar -xvzf activations.tar.gz
Structure
The dataset is organized in directories, with a JSON file providing metadata and other information such as the split configuration we selected. Its internal structure is as follows:
activations/
ββ EMSR107-1/
ββ .../
ββ EMSR548-0/
β ββ DEM/
β β ββ EMSR548-0-0.tif
β β ββ EMSR548-0-1.tif
β β ββ ...
β ββ hydro/
β β ββ EMSR548-0-0.tif
β β ββ EMSR548-0-1.tif
β β ββ ...
β ββ mask/
β β ββ EMSR548-0-0.tif
β β ββ EMSR548-0-1.tif
β β ββ ...
β ββ s1_raw/
β β ββ EMSR548-0-0.tif
β β ββ EMSR548-0-1.tif
β β ββ ...
activations.json
Each folder is named after the Copernicus EMS code it refers to. Since most of them actually contain more than one area, an incremental counter is added to the name, e.g., EMSR458-0
, EMSR458-1
and so on.
Inside each EMSR folder there are four subfolders containing every available modality and the ground truth, in GeoTIFF format:
- DEM: contains the Digital Elevation Model
- hydro: contains the hydrography map for that region, if present
- s1_raw: contains the Sentinel-1 image in VV-VH format
- mask: contains the flood map, rasterized from EMS polygons
Every EMSR subregion contains a variable number of tiles. However, for the same area, each modality always contains the same amount of files with the same name. Names have the following format: <emsr_code>-<emsr_region>_<tile_count>
. For different reasons (retrieval, storage), areas larger than 2500x2500 pixels were divided in large tiles.
Note: Every modality is guaranteed to contain at least one image, except for the hydrography that may be missing.
Last, the activations.json
contains informations about each EMS activation, as extracted from the Copernicus Rapid Mapping site, as such:
{
"EMSR107": {
...
},
"EMSR548": {
"title": "Flood in Eastern Sicily, Italy",
"type": "Flood",
"country": "Italy",
"start": "2021-10-27T11:31:00",
"end": "2021-10-28T12:35:19",
"lat": 37.435056244442684,
"lon": 14.954437192250033,
"subset": "test",
"delineations": [
"EMSR548_AOI01_DEL_PRODUCT_r1_VECTORS_v1_vector.zip"
]
},
}
Data specifications
|Image | Description | Format | Bands |S1 raw | Sentinel-1 (IW GRD) | GeoTIFF | Float32 0: VV, 1: VH |DEM | MapZen Digital Elevation Model | GeoTIFF | Float32 0: elevation |Hydrogr. | Permanent water basins, OSM | GeoTIFF | Uint8 0: hydro |Mask | Ground truth label, CEMS | GeoTIFF | Uint8 0: gt
Image metadata
Every image also contains the following contextual information, as GDAL metadata tags:
<GDALMetadata>
<Item name="acquisition_date">2021-10-31T16:56:28</Item>
<Item name="code">EMSR548-0</Item>
<Item name="country">Italy</Item>
<Item name="event_date">2021-10-27T11:31:00</Item>
</GDALMetadata>
acquisition_date
refers to the acquisition timestamp of the Sentinel-1 imageevent_date
refers to official event start date reported by Copernicus EMS
Run experiments
You can find the associated code in the following repository:
git clone [email protected]:edornd/mmflood.git && cd mmflood
python3 -m venv .venv
pip install -r requirements.txt
Everything goes through the run command. Run python run.py --help for more information about commands and their arguments.
Data preparation
To prepare the raw data by tiling and preprocessing, you can run: python run.py prepare --data-source [PATH_TO_ACTIVATIONS] --data-processed [DESTINATION]
Training
Training uses HuggingFace accelerate to provide single-gpu and multi-gpu support. To launch on a single GPU:
CUDA_VISIBLE_DEVICES=... python run.py train [ARGS]
You can find an example script with parameters in the scripts folder.
Testing
Testing is run on non-tiled images (the preprocessing will format them without tiling). You can run the test on a single GPU using the test command. At the very least, you need to point the script to the output directory. If no checkpoint is provided, the best one (according to the monitored metric) will be selected automatically. You can also avoid storing outputs with --no-store-predictions
.
CUDA_VISIBLE_DEVICES=... python run.py test --data-root [PATH_TO_OUTPUT_DIR] [--checkpoint-path [PATH]]
Data Attribution and Licenses
For the realization of this project, the following data sources were used:
- Copernicus EMS
- Copernicus Sentinel-1
- MapZen/TileZen Elevation
- OpenStreetMap water layers
- Downloads last month
- 179