FLAIR #1: semantic segmentation and domain adaptation dataset
Paper • 2211.12979 • Published
How to use mandresyandri/flair-inc-onnx with Flair:
from flair.models import SequenceTagger
tagger = SequenceTagger.load("mandresyandri/flair-inc-onnx")Conversion ONNX du modèle de segmentation sémantique FLAIR-INC publié par l'IGN France.
Ce modèle n'est pas une création originale. Il s'agit d'une conversion du modèle officiel IGNF vers le format ONNX pour faciliter le déploiement sans dépendance PyTorch. Tous les droits sur l'architecture et les poids appartiennent à l'IGN.
| Auteurs | IGN France — équipe FLAIR |
| Repo original | IGNF/FLAIR-INC_rgb_12cl_resnet34-unet |
| Architecture | U-Net · encodeur ResNet-34 (ImageNet) |
| Framework original | PyTorch + segmentation-models-pytorch |
| Licence | Etalab Open Licence 2.0 |
| Format | ONNX opset 17 |
| Entrée | (1, 3, 512, 512) float32 — valeurs brutes [0, 255], normalisées en amont |
| Sortie | (1, 19, 512, 512) float32 — logits (seuls les 12 premiers canaux sont actifs) |
| Résolution | 0.20 m/px (BD ORTHO® IGN) |
| Taille | ~93 MB |
mean = [105.08, 110.87, 101.82]
std = [ 52.17, 45.38, 44.00]
| ID | Classe |
|---|---|
| 0 | building |
| 1 | pervious_surface |
| 2 | impervious_surface |
| 3 | bare_soil |
| 4 | water |
| 5 | coniferous |
| 6 | deciduous |
| 7 | brushwood |
| 8 | vineyard |
| 9 | herbaceous |
| 10 | agricultural_land |
| 11 | plowed_land |
import numpy as np
import onnxruntime as ort
MEAN = np.array([105.08, 110.87, 101.82], dtype=np.float32).reshape(3, 1, 1)
STD = np.array([ 52.17, 45.38, 44.00], dtype=np.float32).reshape(3, 1, 1)
sess = ort.InferenceSession("flair_12cl_resnet34_unet.onnx")
arr255 = ... # (3, 512, 512) float32 dans [0, 255]
normed = (arr255 - MEAN) / STD
logits = sess.run(None, {"image": normed[np.newaxis]})[0][0] # (19, 512, 512)
class_map = logits[:12].argmax(axis=0).astype(np.uint8) # (512, 512)
Script de conversion reproductible disponible dans le projet :
scripts/convert_to_onnx.py
python scripts/convert_to_onnx.py --verify
Si vous utilisez ce modèle, merci de citer les travaux originaux de l'IGN :
@article{garioud2022flair,
title = {FLAIR: a Country-Scale Land Cover Semantic Segmentation Dataset
From Multi-Source Optical Imagery},
author = {Garioud, Anatol and Peillet, Nicolas and Bookjans, Eva
and Gaussier, Eric and Vallet, Bruno},
journal = {arXiv preprint arXiv:2211.12979},
year = {2022},
url = {https://arxiv.org/abs/2211.12979}
}
@misc{ignf_flair_model,
author = {{IGN France}},
title = {FLAIR-INC ResNet34-UNet — 12-class land cover segmentation},
year = {2023},
publisher = {HuggingFace},
url = {https://huggingface.co/IGNF/FLAIR-INC_rgb_12cl_resnet34-unet}
}
Base model
IGNF/FLAIR-INC_rgb_12cl_resnet34-unet