lperretesri commited on
Commit
74b58c2
·
1 Parent(s): 966abed

Initial commit: FLAIR-INC with Esri-compatible JSON and renamed weights for transformers

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.png filter=lfs diff=lfs merge=lfs -text
37
+ pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
FLAIR-INC_rgb_15cl_mitb5-unet_confmat_norm-precision.png ADDED

Git LFS Details

  • SHA256: 4ead584ad8abdd84bd8917b9b7c1ace180179c4c3ed9a7cce34e7bfb8c0834a2
  • Pointer size: 131 Bytes
  • Size of remote file: 391 kB
FLAIR-INC_rgb_15cl_mitb5-unet_confmat_norm-recall.png ADDED

Git LFS Details

  • SHA256: e71877984040cd0cf8ae6a806760776fdbdb0fe6680a03ffffc60dde0b458d88
  • Pointer size: 131 Bytes
  • Size of remote file: 390 kB
FLAIR-INC_rgb_15cl_mitb5-unet_train-loss.png ADDED

Git LFS Details

  • SHA256: 1ce9fd179e54718617edcd8c72b13c5a1d4cc2f926c7519921395e2a29811327
  • Pointer size: 130 Bytes
  • Size of remote file: 45.2 kB
FLAIR-INC_rgb_15cl_mitb5-unet_val-loss.png ADDED

Git LFS Details

  • SHA256: c967ae479b8aefb65ef0b18a8bb43cda0a8b61ec249b77428df57967753178c0
  • Pointer size: 130 Bytes
  • Size of remote file: 60.9 kB
README.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: etalab-2.0
3
+ tags:
4
+ - segmentation
5
+ - pytorch
6
+ - aerial imagery
7
+ - landcover
8
+ - IGN
9
+ model-index:
10
+ - name: FLAIR-INC_rgb_15cl_mitb5-unet
11
+ results:
12
+ - task:
13
+ type: semantic-segmentation
14
+ dataset:
15
+ name: IGNF/FLAIR/
16
+ type: earth-observation-dataset
17
+ metrics:
18
+ - name: mIoU
19
+ type: mIoU
20
+ value: 57.258
21
+ - name: Overall Accuracy
22
+ type: OA
23
+ value: 75.870
24
+ - name: Fscore
25
+ type: Fscore
26
+ value: 69.800
27
+ - name: Precision
28
+ type: Precision
29
+ value: 70.197
30
+ - name: Recall
31
+ type: Recall
32
+ value: 70.333
33
+
34
+ - name: IoU Buildings
35
+ type: IoU
36
+ value: 77.933
37
+ - name: IoU Pervious surface
38
+ type: IoU
39
+ value: 55.060
40
+ - name: IoU Impervious surface
41
+ type: IoU
42
+ value: 71.639
43
+ - name: IoU Bare soil
44
+ type: IoU
45
+ value: 63.670
46
+ - name: IoU Water
47
+ type: IoU
48
+ value: 85.011
49
+ - name: IoU Coniferous
50
+ type: IoU
51
+ value: 58.907
52
+ - name: IoU Deciduous
53
+ type: IoU
54
+ value: 29.254
55
+ - name: IoU Brushwood
56
+ type: IoU
57
+ value: 30.2346
58
+ - name: IoU Vineyard
59
+ type: IoU
60
+ value: 77.993
61
+ - name: IoU Herbaceous vegetation
62
+ type: IoU
63
+ value: 50.343
64
+ - name: IoU Agricultural land
65
+ type: IoU
66
+ value: 58.801
67
+ - name: IoU Plowed land
68
+ type: IoU
69
+ value: 42.202
70
+ - name: IoU Swimming pool
71
+ type: IoU
72
+ value: 0.000
73
+ - name: IoU Greenhouse
74
+ type: IoU
75
+ value: 60.884
76
+
77
+ pipeline_tag: image-segmentation
78
+ ---
79
+
80
+
81
+ <div style="border:0px; padding:25px; background-color:#F8F5F5; padding-top:10px; padding-bottom:1px;">
82
+ <h1>FLAIR model collection</h1>
83
+ <p>The FLAIR models are a collection of semantic segmentation models initially developed to classify land cover on very high resolution aerial images (more specifically the French <a href="https://geoservices.ign.fr/bdortho">BD ORTHO®</a> product). The distributed pre-trained models differ in their :</p>
84
+ <ul style="list-style-type:disc;">
85
+ <li>dataset for training : <a href="https://huggingface.co/datasets/IGNF/FLAIR"><b>FLAIR</b> dataset</a> or the increased version of this dataset <b>FLAIR-INC</b> (x 3.5 patches). Only the FLAIR dataset is open at the moment.</li>
86
+ <li>input modalities : <b>RGB</b> (natural colours), <b>RGBI</b> (natural colours + infrared), <b>RGBIE</b> (natural colours + infrared + elevation)</li>
87
+ <li>model architecture : <b>resnet34_unet</b> (U-Net with a Resnet-34 encoder), <b>deeplab</b>, <b>fpn</b>, <b>mit</b></li>
88
+ <li>target class nomenclature : <b>12cl</b> (12 land cover classes) or <b>15cl</b> (15 land cover classes)</li>
89
+ </ul>
90
+ </div>
91
+ <br>
92
+
93
+ <div style="border:1px solid black; padding:25px; background-color:#FDFFF4 ; padding-top:10px; padding-bottom:1px;">
94
+ <h1>FLAIR-INC_rgb_15cl_mitb5-unet</h1>
95
+ <p>The general characteristics of this specific model <strong>FLAIR-INC_rgb_15cl_mitb5-unet</strong> are :</p>
96
+ <ul style="list-style-type:disc;">
97
+ <li>Trained with the FLAIR-INC dataset</li>
98
+ <li>Trained with the SegmentationModelsPytorch library</li>
99
+ <li>RGB images (true colours)</li>
100
+ <li>U-Net with a mit-b5 encoder</li>
101
+ <li>15 class nomenclature : [building, pervious surface, impervious surface, bare soil, water, coniferous, deciduous, brushwood, vineyard, herbaceous, agricultural land, plowed land, swimming pool, snow, greenhouse]</li>
102
+ </ul>
103
+ </div>
104
+
105
+ ## Model Informations
106
+ - **Code repository:** https://github.com/IGNF/FLAIR-1
107
+ - **Paper:** https://arxiv.org/pdf/2211.12979.pdf
108
+ - **Developed by:** IGN
109
+ - **Compute infrastructure:**
110
+ - software: python, pytorch-lightning
111
+ - hardware: HPC/AI resources provided by GENCI-IDRIS
112
+ - **License:** Etalab 2.0
113
+
114
+ ---
115
+
116
+ ## Uses
117
+
118
+ Although the model can be applied to other type of very high spatial earth observation images, it was initially developed to tackle the problem of classifying aerial images acquired on the French Territory.
119
+ The product called ([BD ORTHO®](https://geoservices.ign.fr/bdortho)) has its own spatial and radiometric specifications. The model is not intended to be generic to other type of very high spatial resolution images but specific to BD ORTHO images.
120
+ Consequently, the model’s prediction would improve if the user images are similar to the original ones.
121
+
122
+ _**Radiometry of input images**_ :
123
+ The BD ORTHO input images are distributed in 8-bit encoding format per channel. When traning the model, input normalization was performed (see section **Training Details**).
124
+ It is recommended that the user apply the same type of input normalization while inferring the model.
125
+
126
+ _**Multi-domain model**_ :
127
+ The FLAIR-INC dataset that was used for training is composed of 75 radiometric domains. In the case of aerial images, domain shifts are frequent and are mainly due to : the date of acquisition of the aerial survey (from april to november), the spatial domain (equivalent to a french department administrative division) and downstream radiometric processing.
128
+ By construction (sampling 75 domains) the model is robust to these shifts, and can be applied to any images of the ([BD ORTHO® product](https://geoservices.ign.fr/bdortho)).
129
+
130
+
131
+ _**Land Cover classes of prediction**_ :
132
+ The orginial class nomenclature of the FLAIR Dataset encompasses 19 classes (See the [FLAIR dataset](https://huggingface.co/datasets/IGNF/FLAIR) page for details).
133
+ However 3 classes corresponding to uncertain labelisation (Mixed (16), Ligneous (17) and Other (19)) and 1 class with very poor labelling (Clear cut (15)) were desactivated during training.
134
+ As a result, the logits produced by the model are of size 19x1, but classes n° 15, 16, 17 and 19 should appear at 0 in the logits and should not be present in the final argmax product.
135
+
136
+
137
+
138
+ ## Bias, Risks, Limitations and Recommendations
139
+
140
+ _**Using the model on input images with other spatial resolution**_ :
141
+ The FLAIR-INC_rgb_15cl_mitb5-unet model was trained with fixed scale conditions. All patches used for training are derived from aerial images with 0.2 meters spatial resolution. Only flip and rotate augmentations were performed during the training process.
142
+ No data augmentation method concerning scale change was used during training. The user should pay attention that generalization issues can occur while applying this model to images that have different spatial resolutions.
143
+
144
+ _**Using the model for other remote sensing sensors**_ :
145
+ The FLAIR-INC_rgb_15cl_mitb5-unet model was trained with aerial images of the ([BD ORTHO® product](https://geoservices.ign.fr/bdortho)) that encopass very specific radiometric image processing.
146
+ Using the model on other type of aerial images or satellite images may imply the use of transfer learning or domain adaptation techniques.
147
+
148
+ _**Using the model on other spatial areas**_ :
149
+ The FLAIR-INC_rgb_15cl_mitb5-unet model was trained on patches reprensenting the French Metropolitan territory.
150
+ The user should be aware that applying the model to other type of landscapes may imply a drop in model metrics.
151
+
152
+ ---
153
+
154
+ ## How to Get Started with the Model
155
+
156
+ Visit ([https://github.com/IGNF/FLAIR-1](https://github.com/IGNF/FLAIR-1)) to use the model.
157
+ Fine-tuning and prediction tasks are detailed in the README file.
158
+
159
+
160
+ ---
161
+
162
+ ## Training Details
163
+
164
+ ### Training Data
165
+
166
+ 218 400 patches of 512 x 512 pixels were used to train the **FLAIR-INC_rgb_15cl_mitb5-unet** model.
167
+ The train/validation split was performed patchwise to obtain a 80% / 20% distribution between train and validation.
168
+ Annotation was performed at the _zone_ level (~100 patches per _zone_). Spatial independancy between patches is guaranted as patches from the same _zone_ were assigned to the same set (TRAIN or VALIDATION).
169
+ The following number of patches were used for train and validation :
170
+ | TRAIN set | 174 700 patches |
171
+ | VALIDATION set | 43 700 patchs |
172
+
173
+
174
+
175
+
176
+
177
+ ### Training Procedure
178
+
179
+ #### Preprocessing
180
+
181
+ For traning the model, input normalization was performed to center-reduce (**a mean=0** and a **standard deviation = 1**, channel wise) the dataset.
182
+ We used the statistics of TRAIN+VALIDATION for input normalization. It is recommended that the user apply the same type of input normalization.
183
+
184
+ Statistics of the TRAIN+VALIDATION set :
185
+
186
+ | Modalities | Mean (Train + Validation) |Std (Train + Validation) |
187
+ | ----------------------- | ----------- |----------- |
188
+ | Red Channel (R) | 105.08 |52.17 |
189
+ | Green Channel (G) | 110.87 |45.38 |
190
+ | Blue Channel (B) | 101.82 |44.00 |
191
+
192
+
193
+
194
+ #### Training Hyperparameters
195
+
196
+ ```yaml
197
+ - Model architecture: Unet #(implementation from the [Segmentation Models Pytorch library](https://segmentation-modelspytorch.readthedocs.io/en/latest/docs/api.html#unet))
198
+ - Encoder : mit-b5 pre-trained with ImageNet
199
+ - Augmentation :
200
+ - VerticalFlip(p=0.5)
201
+ - HorizontalFlip(p=0.5)
202
+ - RandomRotate90(p=0.5)
203
+ - Input normalization (mean=0 | std=1):
204
+ - norm_means: [105.08, 110.87, 101.82]
205
+ - norm_stds: [52.17, 45.38, 44]
206
+ - Seed: 2022
207
+ - Batch size: 10
208
+ - Number of epochs : 200
209
+ - Early stopping : patience 30 and val_loss as monitor criterium
210
+ - Optimizer : SGD
211
+ - Schaeduler : mode = "min", factor = 0.5, patience = 10, cooldown = 4, min_lr = 1e-7
212
+ - Learning rate : 0.02
213
+ - Class Weights : [1-building: 1.0 , 2-pervious surface: 1.0 , 3-impervious surface: 1.0 , 4-bare soil: 1.0 , 5-water: 1.0 , 6-coniferous: 1.0 , 7-deciduous: 1.0 , 8-brushwood: 1.0 , 9-vineyard: 1.0 , 10-herbaceous vegetation: 1.0 , 11-agricultural land: 1.0 , 12-plowed land: 1.0 , 13-swimming_pool: 1.0 , 14-snow: 1.0 , 15-clear cut: 0.0 , 16-mixed: 0.0 , 17-ligneous: 0.0 , 18-greenhouse: 1.0 , 19-other: 0.0]
214
+ ```
215
+
216
+ #### Speeds, Sizes, Times
217
+
218
+ The FLAIR-INC_rgb_15cl_mitb5-unet model was trained on a HPC/AI resources provided by GENCI-IDRIS (Grant 2022-A0131013803).
219
+ 16 V100 GPUs were used ( 4 nodes, 4 GPUS per node). With this configuration the approximate learning time is 6 minutes per epoch.
220
+
221
+ FLAIR-INC_rgbie_15cl_resnet34-unet was obtained for num_epoch=101 with corresponding val_loss=0.59.
222
+
223
+
224
+ <div style="position: relative; text-align: center;">
225
+ <p style="margin: 0;">TRAIN loss</p>
226
+ <img src="FLAIR-INC_rgb_15cl_mitb5-unet_train-loss.png" alt="TRAIN loss" style="width: 60%; display: block; margin: 0 auto;"/>
227
+ <p style="margin: 0;">VALIDATION loss</p>
228
+ <img src="FLAIR-INC_rgb_15cl_mitb5-unet_val-loss.png" alt="VALIDATION loss" style="width: 60%; display: block; margin: 0 auto;"/>
229
+ </div>
230
+
231
+
232
+
233
+ ## Evaluation
234
+
235
+ ### Testing Data, Factors & Metrics
236
+
237
+ #### Testing Data
238
+
239
+ The evaluation was performed on a TEST set of 31 750 patches that are independant from the TRAIN and VALIDATION patches. They represent 15 spatio-temporal domains.
240
+ The TEST set corresponds to the reunion of the TEST set of scientific challenges FLAIR#1 and FLAIR#2. See the [FLAIR challenge page](https://ignf.github.io/FLAIR/) for more details.
241
+
242
+ The choice of a separate TEST set instead of cross validation was made to be coherent with the FLAIR challenges.
243
+ However the metrics for the Challenge were calculated on 12 classes and the TEST set acordingly.
244
+ As a result the _Snow_ class is absent from the TEST set.
245
+
246
+ #### Metrics
247
+
248
+ With the evaluation protocol, the **FLAIR-INC_rgb_15cl_mitb5-unetm** have been evaluated to **OA= 75.870%** and **mIoU=57.258%**.
249
+ The _snow_ class is discarded from the average metrics.
250
+
251
+ The following table give the class-wise metrics :
252
+
253
+ | Classes | IoU (%) | Fscore (%) | Precision (%) | Recall (%) |
254
+ | ----------------------- | ----------|---------|---------|---------|
255
+ | building | 77.933 | 87.598 | 87.358 | 87.839 |
256
+ | pervious_surface | 55.060 | 71.018 | 73.758 | 68.474 |
257
+ | impervious_surface | 71.639 | 83.477 | 82.315 | 84.671 |
258
+ | bare_soil | 63.670 | 77.803 | 78.465 | 77.152 |
259
+ | water | 85.011 | 91.899 | 90.641 | 93.192 |
260
+ | coniferous | 58.907 | 74.140 | 77.911 | 70.717 |
261
+ | deciduous | 69.909 | 82.290 | 78.461 | 86.511 |
262
+ | brushwood | 29.254 | 45.266 | 59.845 | 36.398 |
263
+ | vineyard | 77.993 | 87.636 | 84.002 | 91.599 |
264
+ | herbaceous | 50.343 | 66.971 | 71.301 | 63.136 |
265
+ | agricultural_land | 58.801 | 74.056 | 66.961 | 82.832 |
266
+ | plowed_land | 42.202 | 59.355 | 65.114 | 54.532 |
267
+ | swimming_pool | 0.000 | 0.000 | 0.000 | 0.000 |
268
+ | snow | _0.000_ | _0.000_ | _0.000_ | _0.000_ |
269
+ | greenhouse | 60.884 | 75.687 | 66.620 | 87.609 |
270
+ | **average** | **57.258** | **69.800** | **70.197** | **70.333** |
271
+
272
+
273
+
274
+
275
+
276
+ The following illustration gives the resulting confusion matrix :
277
+ * Top : normalised acording to columns, columns sum at 100% and the **precision** is on the diagonal of the matrix
278
+ * Bottom : normalised acording to rows, rows sum at 100% and the **recall** is on the diagonal of the matrix
279
+
280
+
281
+ <div style="position: relative; text-align: center;">
282
+ <p style="margin: 0;">Normalized Confusion Matrix (precision)</p>
283
+ <img src="FLAIR-INC_rgb_15cl_mitb5-unet_confmat_norm-precision.png" alt="drawing" style="width: 70%; display: block; margin: 0 auto;"/>
284
+ <p style="margin: 0;">Normalized Confusion Matrix (recall)</p>
285
+ <img src="FLAIR-INC_rgb_15cl_mitb5-unet_confmat_norm-recall.png" alt="drawing" style="width: 70%; display: block; margin: 0 auto;"/>
286
+ </div>
287
+
288
+
289
+
290
+ ### Results
291
+
292
+ Samples of results
293
+
294
+
295
+ ---
296
+
297
+ ## Citation
298
+
299
+
300
+ **BibTeX:**
301
+
302
+ ```
303
+ @inproceedings{ign-flair,
304
+ title={FLAIR: a Country-Scale Land Cover Semantic Segmentation Dataset From Multi-Source Optical Imagery},
305
+ author={Anatol Garioud and Nicolas Gonthier and Loic Landrieu and Apolline De Wit and Marion Valette and Marc Poupée and Sébastien Giordano and Boris Wattrelos},
306
+ year={2023},
307
+ booktitle={Advances in Neural Information Processing Systems (NeurIPS) 2023},
308
+ doi={https://doi.org/10.48550/arXiv.2310.13336},
309
+ }
310
+ ```
311
+
312
+
313
+ **APA:**
314
+ ```
315
+ Anatol Garioud, Nicolas Gonthier, Loic Landrieu, Apolline De Wit, Marion Valette, Marc Poupée, Sébastien Giordano and Boris Wattrelos. 2023.
316
+ FLAIR: a Country-Scale Land Cover Semantic Segmentation Dataset From Multi-Source Optical Imagery. (2023).
317
+ In proceedings of Advances in Neural Information Processing Systems (NeurIPS) 2023.
318
+ DOI: https://doi.org/10.48550/arXiv.2310.13336
319
+ ```
320
+
321
+ ## Contact : [email protected]
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"model_type":"segformer","num_labels":15}
confmat.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4e921a47cabd3e18a5adb7385a319d34781347524dab1a54bbef22021fdfd6a
3
+ size 3016
preprocessor_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"do_resize":false,"do_normalize":true,"image_mean":[105.08,110.87,101.82],"image_std":[52.17,45.38,44.00]}
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbb59e59e8390362825bb29face698be89b6426bbaf03b0943cece70de9250f9
3
+ size 339344766