Add SegFormer-B0 (IGN) checkpoint, config and metrics

#1

Hi @gabrielkasmi — here is the SegFormer-B0 (IGN) checkpoint you asked for, trained as part of deeppvmapper#20 (issue #11).

This PR adds a self-contained segformer-b0/ folder:

File Description
segformer_ign_best.pth Raw PyTorch state_dict, epoch 47 (3.71 M params)
config.yaml Exact training config
metrics.json Per-epoch history + best-epoch summary
evaluate.py Reference-protocol evaluation (see below)
README.md Training recipe and full results

Results — canonical test split (1239 IGN positives):

Protocol IoU (PV) Pixel F1
Reference (mean of per-batch metrics, batch 8, 416²) 0.7356 0.8437
Pixel-aggregated over the split 0.7445 0.8535

Instance F1 0.8549, pixel precision 0.8705, recall 0.8372 (aggregated).

Two practical notes:

  1. train/evaluate.py builds deeplabv3_resnet101 and loads a raw DeepLab state dict, so it cannot load this checkpoint directly. segformer-b0/evaluate.py keeps its SegmentationDataset transform and per-batch metric aggregation and only swaps the model to SegFormer-B0.
  2. SegFormer requires spatial dimensions divisible by 32, so this runs at 416² — the reference's 400² default raises a shape error. The comparison with the 400² DeepLab baseline is therefore not resolution-aligned, as already flagged on the GitHub PR.

Evaluate:

pip install segmentation-models-pytorch datasets
python evaluate.py --provider ign --checkpoint segformer_ign_best.pth

Training followed the guidance on deeppvmapper#20: 416², batch 4 × gradient accumulation 8, AMP fp16, AdamW, BCE+Dice, 50 epochs, checkpoint selection by val_pixelF1, canonical department split, seed 42.

Code MIT / weights CC-BY-4.0, matching the repo.

gabrielkasmi changed pull request status to merged

Sign up or log in to comment