Official PyTorch implementation of GeoFormerX: Parameter-Efficient Multimodal SAM Adaptation for Multiclass Pavement Mapping (November 17, 2026 revision).
GeoFormerX maps paired grayscale intensity (I) and range-coded (Q) pavement images into eight classes. The range-coded raster contains digital numbers; the model does not estimate physical depths, dimensions, or volumes.
Visual Overview · Results · Expert Comparison · Installation · Paper Tables
- Parameter-efficient adaptation: GeoFormerX trains 5.39M of its 92.07M parameters while retaining the frozen SAM ViT-B backbone.
- Paired input and complete-image output: gated fusion and a local refiner use paired inputs; overlapping tile predictions form one eight-class map.
- Class-wise evaluation: the paper reports results for seven methods on the same 1,000 test images, with paired class-wise confidence intervals.
Fig. 1. GeoFormerX processing pipeline. Panels (a)–(d) show the paired intensity and range rasters, their tiles, and the full-tile prompt. Panel (e) shows G8 fusion, S0 adaptation, D0 decoding, and paired-input refinement. Panel (f) shows horizontal-flip averaging, fixed class offsets, and Hann-weighted reconstruction.
Fig. 2. Core modules. G8 combines a tile coefficient with a spatial mask to control how much of Q enters the model. The schematic draws the global branch; the model also uses spatial modulation. S0 inserts a 768 → 42 → 42 → 768 residual path in each of the 12 ViT-B MLP blocks.
Fig. 3. PaIR-Pave10K partition and evaluation workflow. Panel (a) shows the 7,000 training, 1,000 source-validation, 1,000 reserved, and 1,000 test images. Panel (b) shows which subsets are used for model training, checkpoint selection, and final evaluation.
Fig. 4. Three-seed source-validation comparisons. Panels (a)–(c) vary the G8/G4 descriptor, the D0/D1 decoder, and the S0/M0 adapter, respectively. Lines connect the same training seed. Scores are pooled foreground macro Dice over 1,000 complete source-validation images.
All seven methods use fixed seed-2028 checkpoints on the same 1,000 PaIR-Pave10K test images. Foreground macro Dice averages seven Dice scores computed from pooled pixel counts.
| Method | Input | FG macro Dice | Boundary-F1 | Seam Dice |
|---|---|---|---|---|
| GeoFormerX | I + Q | 0.7605 | 0.7154 | 0.7659 |
| Intensity-only FrozenSAM | I | 0.6920 | 0.6273 | 0.6927 |
| SegFormer-B2 | I | 0.7104 | 0.6403 | 0.7354 |
| CMX | I + Q | 0.7763 | 0.7181 | 0.7743 |
| DFormer-B | I + Q | 0.7319 | 0.6581 | 0.7391 |
| CWSAM | I | 0.7028 | 0.6319 | 0.7232 |
| Matched SAM–LoRA | I + Q | 0.7583 | 0.7209 | 0.7609 |
GeoFormerX achieved 0.7633 ± 0.0053 foreground macro Dice across seeds 2026–2028 (mean ± sample SD). The improvement over intensity-only FrozenSAM and SegFormer-B2 was concentrated in Crack: GeoFormerX-minus-baseline Dice was +0.4286 [0.4082, 0.4483] and +0.2806 [0.2636, 0.2977], respectively (pointwise 95% paired bootstrap CIs). The macro Dice interval for the comparison with CMX spans zero. Pothole Dice was 0.4686 [0.1294, 0.8061], with only 19 positive images.
In the matched three-seed input study, simple fusion with zero direct Q in the refiner (V1) had the highest mean foreground macro Dice (0.7651). The full model (V4) had the highest mean Crack Dice (0.5375). The CE–Dice objective had higher mean macro Dice than the full objective (0.7682 vs. 0.7633); the full objective had higher mean Boundary-F1 (0.7220 vs. 0.7151).
Fig. 5. Qualitative comparison on test image DL2D00006080. Panels (a)–(c) show the intensity raster, range-coded raster, and dataset labels. Panels (d)–(i) show GeoFormerX, intensity-only FrozenSAM, CMX, DFormer-B, CWSAM, and matched SAM–LoRA. All masks use the same image coordinates and class palette.
Fig. 6. Expert and model delineations. The rows show intensity, the original dataset label, three expert annotations, and GeoFormerX for three selected examples. Across the 13-image expert comparison, the paper reports model–expert foreground macro Dice between 0.5157 and 0.5465.
Deployment profiling reported 59.7 ± 3.5 ms/image for GeoFormerX across five warmed FP32 passes on one RTX 4090 D, with 522.6 MiB peak allocated CUDA memory. The complete inference state occupied 351.4 MiB; the additional task state occupied 20.7 MiB when loaded with the shared SAM checkpoint. See the paper tables for class scores, confidence intervals, ablations, expert agreement, and model resource measurements.
| Location | Contents |
|---|---|
assets/ |
Paper Figures 1–6 and their source index |
configs/ |
Canonical GeoFormerX settings |
docs/ |
Paper tables, data layout, and training and evaluation protocols |
examples/ |
Synthetic data for the smoke test |
scripts/ |
Demo, SAM checkpoint helper, and paired statistics |
train.py · evaluate.py |
Training and evaluation entry points |
git clone https://github.com/sisisichen/GeoFormer.git
cd GeoFormer
python -m venv .venvActivate the environment (.\.venv\Scripts\Activate.ps1 in PowerShell or source .venv/bin/activate in Bash). For training and evaluation, install PyTorch and torchvision for your CPU or CUDA platform, then run python -m pip install -r requirements.txt.
python -m pip install numpy pillow
python scripts/demo.pyThe smoke test uses synthetic images and writes its outputs to runs/demo/.
PaIR-Pave10K has 7,000 training, 1,000 source-validation, 1,000 reserved adaptation, and 1,000 test images. Architecture and checkpoint selection use only training and source validation. See the input layout and label palette. Access to the benchmark data is subject to its data-use conditions; contact the paper's corresponding author for access. This repository does not contain the benchmark dataset, trained task checkpoints, or archived per-image counts.
python scripts/download_sam_checkpoint.py --model_type vit_b --out_dir checkpoints/sam
python train.py --data_path data/pavement_rgbd --checkpoint checkpoints/sam --work_dir runs/geoformerx_seed2028 --seed 2028Use --source_val_ids path/to/source_val.txt if val/image contains both validation subsets; otherwise prepare val/image with only source_val. The wrapper writes model_final.pth and training_manifest.json under the run directory. Run python train.py --dry_run to inspect the resolved command. For the paper's auxiliary-input study use --pathway V0 through --pathway V4 with the full objective. For the separate loss comparison use --objective ce_dice with V4. Use a separate directory per variant and seed. The training protocol specifies the loss, sampling, schedule, and checkpoint selection.
python evaluate.py --data_path data/pavement_rgbd --checkpoint checkpoints/sam --ckpt runs/geoformerx_seed2028/model_final.pth --split test --out_dir runs/geoformerx_seed2028/eval_testUse the audited test membership and, when available, pass its ordered list with --split-file path/to/test.txt. The paper evaluator uses three 256 × 256 tiles at stride 128, a fixed full-tile box, horizontal-flip logit averaging, and fixed offsets of 0.02 (Crack), 0.01 (Road Marking), and 0.02 (Expansion Joint). It then applies Hann-weighted logit reconstruction and argmax. Use --pathway to match an ablation checkpoint. See the evaluation protocol for settings and outputs.
Evaluation writes semantic maps, per-image confusion counts for paired analysis, and downstream research fields (class pixel count, presence, and relative pixel coverage) in condition_records.json and condition_records.csv. Relative coverage is a dimensionless image measure.
python scripts/paper_statistics.py --bundle /path/to/paired_counts.npz --out-dir runs/paper_statsThe statistics script also accepts separate per-model count files. It draws 10,000 paired complete-image bootstrap samples and recalculates Dice from pooled counts. Class intervals are pointwise. The six benchmark tests use 10,000 paired within-image permutations and a joint Holm adjustment. The matched auxiliary-input study uses a separate three-contrast family.
This release implements the GeoFormerX path and paired analysis. Baseline scores come from each comparator's archived predictions under the protocol specified in the revised paper tables. Results measure agreement within the fixed survey dataset; independent cross-device or cross-region generalization has not been established.
See CITATION.cff for the manuscript citation and THIRD_PARTY_NOTICES.md for the vendored SAM code. The August supplemental material and its archived release describe the earlier revision.





