edornd commited on
Commit
fbad2a3
β€’
1 Parent(s): e6cbff5

Add README

Browse files
Files changed (1) hide show
  1. README.md +147 -0
README.md CHANGED
@@ -1,3 +1,150 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ task_categories:
4
+ - image-segmentation
5
+ language:
6
+ - en
7
+ tags:
8
+ - semantic segmentation
9
+ - remote sensing
10
+ - sentinel-1
11
+ - flood
12
+ pretty_name: MMFlood
13
+ size_categories:
14
+ - 1K<n<10K
15
  ---
16
+
17
+ ## Download
18
+
19
+ The dataset has been compacted into tarfiles and zipped, you will need to recompose it before working with it:
20
+
21
+ ```bash
22
+ # clone the repository
23
+ $ git clone git@hf.co:datasets/links-ads/mmflood
24
+ # rebuild and extract the files
25
+ $ cat activations.tar.*.gz.part > activations.tar.gz
26
+ $ tar -xvzf activations.tar.gz
27
+ ```
28
+
29
+ ## Structure
30
+ 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:
31
+
32
+ ```
33
+ activations/
34
+ β”œβ”€ EMSR107-1/
35
+ β”œβ”€ .../
36
+ β”œβ”€ EMSR548-0/
37
+ β”‚ β”œβ”€ DEM/
38
+ β”‚ β”‚ β”œβ”€ EMSR548-0-0.tif
39
+ β”‚ β”‚ β”œβ”€ EMSR548-0-1.tif
40
+ β”‚ β”‚ β”œβ”€ ...
41
+ β”‚ β”œβ”€ hydro/
42
+ β”‚ β”‚ β”œβ”€ EMSR548-0-0.tif
43
+ β”‚ β”‚ β”œβ”€ EMSR548-0-1.tif
44
+ β”‚ β”‚ β”œβ”€ ...
45
+ β”‚ β”œβ”€ mask/
46
+ β”‚ β”‚ β”œβ”€ EMSR548-0-0.tif
47
+ β”‚ β”‚ β”œβ”€ EMSR548-0-1.tif
48
+ β”‚ β”‚ β”œβ”€ ...
49
+ β”‚ β”œβ”€ s1_raw/
50
+ β”‚ β”‚ β”œβ”€ EMSR548-0-0.tif
51
+ β”‚ β”‚ β”œβ”€ EMSR548-0-1.tif
52
+ β”‚ β”‚ β”œβ”€ ...
53
+ activations.json
54
+ ```
55
+
56
+ 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.
57
+ Inside each EMSR folder there are four subfolders containing every available modality and the ground truth, in GeoTIFF format:
58
+
59
+ - DEM: contains the Digital Elevation Model
60
+ - hydro: contains the hydrography map for that region, if present
61
+ - s1_raw: contains the Sentinel-1 image in VV-VH format
62
+ - mask: contains the flood map, rasterized from EMS polygons
63
+
64
+ 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.
65
+
66
+ > **Note:** Every modality is guaranteed to contain at least one image, except for the hydrography that may be missing.
67
+
68
+ Last, the `activations.json` contains informations about each EMS activation, as extracted from the Copernicus Rapid Mapping site, as such:
69
+
70
+ ```json
71
+ {
72
+ "EMSR107": {
73
+ ...
74
+ },
75
+ "EMSR548": {
76
+ "title": "Flood in Eastern Sicily, Italy",
77
+ "type": "Flood",
78
+ "country": "Italy",
79
+ "start": "2021-10-27T11:31:00",
80
+ "end": "2021-10-28T12:35:19",
81
+ "lat": 37.435056244442684,
82
+ "lon": 14.954437192250033,
83
+ "subset": "test",
84
+ "delineations": [
85
+ "EMSR548_AOI01_DEL_PRODUCT_r1_VECTORS_v1_vector.zip"
86
+ ]
87
+ },
88
+ }
89
+ ```
90
+
91
+ ## Data specifications
92
+ |Image | Description | Format | Bands
93
+ |S1 raw | Sentinel-1 (IW GRD) | GeoTIFF | Float32 0: VV, 1: VH
94
+ |DEM | MapZen Digital Elevation Model | GeoTIFF | Float32 0: elevation
95
+ |Hydrogr. | Permanent water basins, OSM | GeoTIFF | Uint8 0: hydro
96
+ |Mask | Ground truth label, CEMS | GeoTIFF | Uint8 0: gt
97
+
98
+ ### Image metadata
99
+
100
+ Every image also contains the following contextual information, as GDAL metadata tags:
101
+
102
+ ```xml
103
+ <GDALMetadata>
104
+ <Item name="acquisition_date">2021-10-31T16:56:28</Item>
105
+ <Item name="code">EMSR548-0</Item>
106
+ <Item name="country">Italy</Item>
107
+ <Item name="event_date">2021-10-27T11:31:00</Item>
108
+ </GDALMetadata>
109
+ ```
110
+
111
+ - `acquisition_date` refers to the acquisition timestamp of the Sentinel-1 image
112
+ - `event_date` refers to official event start date reported by Copernicus EMS
113
+
114
+ ## Run experiments
115
+
116
+ You can find the associated code in the following repository:
117
+ ```console
118
+ git clone git@github.com:edornd/mmflood.git && cd mmflood
119
+ python3 -m venv .venv
120
+ pip install -r requirements.txt
121
+ ```
122
+
123
+ Everything goes through the run command. Run python run.py --help for more information about commands and their arguments.
124
+
125
+ ### Data preparation
126
+ To prepare the raw data by tiling and preprocessing, you can run: `python run.py prepare --data-source [PATH_TO_ACTIVATIONS] --data-processed [DESTINATION]`
127
+
128
+ ### Training
129
+ Training uses HuggingFace accelerate to provide single-gpu and multi-gpu support. To launch on a single GPU:
130
+
131
+ ```console
132
+ CUDA_VISIBLE_DEVICES=... python run.py train [ARGS]
133
+ ```
134
+
135
+ You can find an example script with parameters in the scripts folder.
136
+
137
+ ### Testing
138
+ 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`.
139
+
140
+ ```console
141
+ CUDA_VISIBLE_DEVICES=... python run.py test --data-root [PATH_TO_OUTPUT_DIR] [--checkpoint-path [PATH]]
142
+ ```
143
+
144
+ ## Data Attribution and Licenses
145
+ For the realization of this project, the following data sources were used:
146
+
147
+ - Copernicus EMS
148
+ - Copernicus Sentinel-1
149
+ - MapZen/TileZen Elevation
150
+ - OpenStreetMap water layers