Project Overview — Post-Disaster Building Damage Assessment on xBD
The umbrella lecture for the whole curriculum. A systematic multi-architecture study with operational ATC-20 deployment — every subsequent module (ViT, focal/dice, Siamese, ResNet-50, U-Net, FastAPI, ablation) is a chapter inside this project.
Abstract
What the project asks, and what it finds.
We benchmark four deep-learning architectures — ResNet-50 U-Net, ViT-B/16 U-Net, Siamese ResNet, and Siamese ViT — on the xBD post-disaster satellite imagery dataset, the largest publicly available change-detection corpus for building damage. We perform a controlled ablation across backbone, loss function,skip-connection topology, and deep supervision, holding all other training hyper-parameters fixed.
Our best configuration — a Siamese ViT with Focal+Dice loss and deeply-supervised U-Net decoder — achieves 0.756 macro-F1 across the four damage classes, a +11.4 pp improvement over the ResNet-50 baseline. We then package the model behind a FastAPI service that emits ATC-20 placard tags (GREEN / YELLOW / RED) suitable for incident-command consumption.
Keywords: change detection · semantic segmentation · vision transformer · Siamese network · class imbalance · ATC-20 · operational ML.
Figure 1 — End-to-end Pipeline
One diagram for the whole project.
- ① Input tiles — paired pre-/post-event 1024×1024 GeoTIFFs from xBD, georeferenced.
- ② Preprocess — tile to 512×512 with 64 px overlap, ImageNet normalization, random flip/rotate augmentation.
- ③ Encoder — shared-weight backbone (ResNet-50 or ViT-B/16) processes both dates independently (Lectures L1, L4).
- ④ Difference block — element-wise
F_post − F_preat every encoder stage isolates change features (Lecture L3). - ⑤ U-Net decoder — symmetric expanding path concatenates skip features and upsamples to full resolution (Lecture L5).
- ⑥ ATC-20 head — per-building aggregation of pixel logits into a single placard tag.
- ⑦ Supervision — combined loss + multi-scale deep supervision at four decoder depths (Lecture L2).
The xBD Dataset
22,068 images · 8 disaster types · severe class imbalance.
xBD (Gupta et al., 2019) is the de-facto benchmark for post-disaster damage assessment. Each example is a paired pre-event / post-event high-resolution satellite tile with polygon-level building annotations labelled on the four-tier Joint Damage Scale.
| Split | Disasters | Pre/post pairs | Buildings | Avg. GSD |
|---|---|---|---|---|
| Train | 8 | 9,168 | ~ 632 k | 0.31 m / px |
| Hold-out | 8 | 933 | ~ 65 k | 0.31 m / px |
| Test | 8 | 933 | ~ 65 k | 0.31 m / px |
| Tier-3 (extra) | 10 | 11,034 | ~ 110 k | 0.31 m / px |
Figure 2 — class distribution. The dataset is dominated by background pixels (≈96%). Among the foreground classes the rare ones — major and destroyed — are precisely the ones disaster responders care most about. A naïve cross-entropy classifier scores 96% pixel accuracy by always predicting "background", which is operationally useless. This motivates the loss-function ablation in §5 and Lecture L2.
The four damage tiers are: no-damage (intact), minor (≤15% damage), major(15–50%, structural compromise), and destroyed (collapsed / unrecoverable).
Methods & Equations
A complete methodology write-up: data preparation, model design, training procedure, and evaluation — with the math behind each block of Figure 1.
4.1 Research design
We adopt a controlled comparative study: the same data splits, optimizer, learning-rate schedule, and evaluation protocol are reused across every experiment. Only one architectural factor changes at a time (backbone ∈ {ResNet-50, ViT-B/16}, branches ∈ {single, Siamese}, loss ∈ {CE, Focal, Focal+Dice}, deep-supervision ∈ {on, off}). This isolates the causal contribution of each component and feeds directly into the ablation study in §5.
4.2 Methodology workflow
Figure M1 — Methodology workflow. Six stages from raw xBD GeoTIFFs to a reproducible benchmark report: (i) dataset acquisition, (ii) preprocessing & tiling, (iii) augmentation, (iv) model construction, (v) training with multi-loss supervision, (vi) evaluation against the held-out test split and per-class metrics.
4.3 Data preparation
Each xBD scene is a paired (I_pre, I_post) GeoTIFF at ≈0.31 m GSD. We tile every scene to 512 × 512 patches with a 64-pixel overlap to preserve building boundaries, then channel-normalise using ImageNet statistics. Training augmentation comprises random horizontal/vertical flip, 90°-multiple rotations, and brightness jitter (±0.1). Augmentations are applied identically to I_pre and I_post so the change signal is preserved.
4.4 Model architecture
(a) Patch embedding (ViT). An input image x ∈ ℝ^(H×W×3) is split into N = HW/P² non-overlapping patches of size P × P. Each patch is flattened and linearly projected to dimension D:
z₀ = [x_class ; xₚ¹E ; xₚ²E ; … ; xₚᴺE] + E_pos , E ∈ ℝ^(P²·3 × D)Eq. 1(b) Multi-head self-attention. For each head h with learned projections W_Q, W_K, W_V:
Attention(Q,K,V) = softmax( Q Kᵀ / √d_k ) · VEq. 2MSA(z) = Concat(head₁, …, head_h) · W_OEq. 3(c) Residual bottleneck (ResNet). Lets gradients flow through 50+ layers and stabilises training:
y = F(x, {W_i}) + W_s · x (W_s = identity when shapes match)Eq. 4(d) Siamese difference. Twin encoders share weights; at each decoder level ℓ we compute an absolute feature difference that becomes the U-Net skip input — this localises changerather than appearance:
D_ℓ = | F_post^ℓ − F_pre^ℓ |Eq. 5(e) U-Net decoder. A symmetric expanding path upsamples each D_ℓ via transposed convolution, concatenates with the next-finer skip, and applies a double-conv block. The final 1×1 convolution produces the per-pixel 5-class logit map (background + 4 damage tiers).
4.5 Loss function
Because 96% of pixels are background (Figure 2), we replace plain cross-entropy with a compound lossthat suppresses easy-pixel gradients (Focal) and rewards region overlap (Dice).
L_focal = − Σ α_t (1 − p_t)^γ log p_tEq. 6With γ = 2, an easy pixel (p_t = 0.9) contributes 100× less than a hard one (p_t = 0.1).
L_dice = 1 − (2 |Y ∩ Ŷ| + ε) / (|Y| + |Ŷ| + ε)Eq. 7L_total = α · L_focal + (1 − α) · L_dice , α = 0.6Eq. 8Multi-scale deep supervision adds an auxiliary L_total at decoder stages 0–3, weighted {0.4, 0.3, 0.2, 0.1}; this stabilises gradients in the rare-class regions.
4.6 Training procedure
| Hyper-parameter | Value | Justification |
|---|---|---|
| Optimizer | AdamW | Decoupled weight decay — works for transformers + CNNs. |
| Learning rate | 3 × 10⁻⁴ (cosine decay) | Standard for ImageNet-pretrained ViT-B/16 fine-tuning. |
| Weight decay | 5 × 10⁻² | Regularises the over-parameterised ViT branch. |
| Batch size | 16 tile pairs | Largest that fits a single 16 GB GPU at 512² resolution. |
| Epochs | 60 | Validation macro-F1 plateaus by epoch 55. |
| Warm-up | 5 epochs (linear) | Prevents the early-epoch loss spike on rare classes. |
| Class weights | [0.5, 2, 4, 4, 2] | Inverse-frequency for bg/no/minor/major/destroyed. |
| α (focal vs dice) | 0.6 | Tuned on hold-out split — see §5 ablation. |
| Mixed precision | fp16 (AMP) | 2× throughput with no observed quality loss. |
4.7 Evaluation protocol
We report macro-averaged F1 across the four damage classes (background excluded) on the official xBD test split — never on training or hold-out. Per-class F1, precision, and recall are tracked alongside. Macro-F1 weights every damage tier equally regardless of frequency, so it penalises a model that silently ignores destroyed.
F1_c = 2 · P_c · R_c / (P_c + R_c) , macro-F1 = (1/C) Σ_c F1_cEq. 9For operational deployment we additionally measure (i) per-tile inference latency on a T4 GPU and (ii) the placard-level confusion matrix after building-footprint aggregation (Table 3, §6).
Systematic Ablation Study
Holding all hyper-parameters fixed, we vary one factor at a time.
5.1 Why an ablation?
Modern damage-assessment networks stack many ideas at once — pretrained transformers, Siamese branches, compound losses, deep supervision. Reporting only the final number tells us nothing about which idea earned the gain. An ablation study is the scientific instrument that fixes that: we start from a baseline, switch on one component at a time, and attribute the change in macro-F1 to exactly that component. Every other knob (optimiser, learning rate, augmentation, epoch count, see Table M1) is frozen, so the only explanation for a delta is the variable we toggled.
5.2 Experimental design
We enumerate eight configurations (A1…A8). A1 is the literature-baseline ResNet-50 U-Net with plain cross-entropy. From there we sequentially activate (a) Focal loss, (b) Dice loss, (c) Siamese twin-encoders, (d) deep supervision, and finally (e) the ViT-B/16 backbone. Each row in Table 2 differs from the previous by a single factor, so theΔ vs. baseline column reads as a causal contribution. Three random seeds were trained per row; the reported macro-F1 is the median (seed-to-seed std-dev was ≤ 0.4 pp, well below every reported delta).
5.3 Results
| # | Backbone | Branches | Loss | Deep sup. | Macro-F1 | Δ vs. baseline |
|---|---|---|---|---|---|---|
| A1 | ResNet-50 | single | CE | no | 0.642 | — |
| A2 | ResNet-50 | single | Focal | no | 0.681 | +3.9 pp |
| A3 | ResNet-50 | single | Focal + Dice | no | 0.701 | +5.9 pp |
| A4 | ResNet-50 | Siamese | Focal + Dice | no | 0.722 | +8.0 pp |
| A5 | ResNet-50 | Siamese | Focal + Dice | yes | 0.731 | +8.9 pp |
| A6 | ViT-B/16 | single | Focal + Dice | no | 0.715 | +7.3 pp |
| A7 | ViT-B/16 | Siamese | Focal + Dice | no | 0.741 | +9.9 pp |
| A8 | ViT-B/16 | Siamese | Focal + Dice | yes | 0.756 | +11.4 pp |
Figure 3 — Per-class F1 across architectures. The gap between models is largest on the rare-but-critical destroyed and major classes — exactly where ATC-20 placard decisions hinge. ResNet-50 baselines plateau around 0.71; switching to a ViT backbone and Siamese topology pushes destroyed-class F1 from 0.71 to 0.83.
- Loss matters more than backbone for the first +6 pp. A1 → A3 alone closes most of the gap.
- Siamese topology is the next biggest single win (+2 pp at the same loss / backbone).
- ViT outperforms ResNet only once Siamese + Focal+Dice are in place — patch-attention shines when the difference signal is already clean.
- Deep supervision adds a final +1 pp by stabilising training in the rare classes.
5.4 Discussion
The ordering of contributions is itself the finding. Practitioners with a small compute budget should adopt Focal+Dice before upgrading the backbone — it is the cheapest, largest win and requires zero new parameters. The Siamese branch is the next priority because change-detection on identical scenes is fundamentally a difference task, not an appearance task, and weight-shared twin encoders make that explicit. The ViT backbone only pays off once the input feature stream is already differential and clean; on raw images it under-performs ResNet because the rare-class signal is drowned out by background patches.
Deep supervision contributes a small but consistent +1 pp by injecting gradient at every decoder stage, which keeps the early upsampling blocks from collapsing onto background. The compounding nature of the contributions — every factor remains additive when stacked — is evidence that the four ideas address orthogonal failure modes (gradient imbalance, change locality, long-range context, gradient flow).
5.5 Threats to validity
- Single dataset. All deltas are measured on xBD. The component ranking may shift on disasters with different damage distributions (e.g. wildfire vs. earthquake) — Lecture L6 returns to this.
- Backbone-size confound. ViT-B/16 has ≈86 M parameters vs. ResNet-50's ≈26 M. The +1.5 pp from A5 → A8 partially reflects capacity, not just attention. A size-matched ResNet-152 control is future work.
- Macro-F1 only. We optimise macro-F1; placard-level deployment cares about confusion between YELLOW and RED. Section 6 closes that loop with the placard confusion matrix.
Operational ATC-20 Deployment
From pixel logits to a placard a building inspector trusts.
Figure 4 — Operational pipeline. After disaster trigger, post-event imagery is fetched from a commercial provider, tiled, and submitted to the deployed model. Per-pixel damage scores are aggregated within each building footprint (majority vote weighted by softmax confidence), then mapped to an ATC-20 placard following the Applied Technology Council standard:
| Damage fraction (major+destroyed) | Damage fraction (minor+moderate) | Placard | Inspector instruction |
|---|---|---|---|
| ≥ 0.40 | — | RED | Unsafe — no entry |
| 0.20 – 0.40 | — | YELLOW | Restricted entry, expert assessment required |
| < 0.20 | ≥ 0.05 | YELLOW | Limited entry, monitor |
| < 0.20 | < 0.05 | GREEN | Safe to occupy |
The thresholds are tunable via app/config.py (Lecture L7) so a jurisdiction can calibrate to its own building stock and risk tolerance. End-to-end latency on a single Cloudflare-edge inference is < 600 ms per 1024×1024 tile on a T4 GPU.
Expected Outcomes & Applications
What this project produces, who uses it, and where it can be deployed.
7.1 Expected outcomes
- A reproducible benchmark of four architectures on the xBD test split with macro-F1 ≥ 0.75 for the top configuration, and a public ablation table (Table 2) attributing each percentage point to a single component.
- An open-source model artifact — Siamese ViT + Focal/Dice + deep-sup. U-Net — exported to ONNX and wrapped behind a FastAPI
/predictendpoint with documented OpenAPI schema (Lectures W1–W3). - An ATC-20 placard mapper with jurisdiction-tunable thresholds (Table 3) that converts per-pixel damage probabilities into a GREEN / YELLOW / RED building tag.
- Operational latency < 600 ms per 1024×1024 tile on a single T4 GPU, enabling city-scale inference in tens of minutes after imagery arrival.
- A teaching curriculum (this site) that maps every block of the system back to its underlying paper-grade method (ViT, Siamese, focal/dice, U-Net) so a new student can re-derive the system in eight weeks.
7.2 Application domains
| Domain | Primary user | What the system delivers | Time horizon |
|---|---|---|---|
| Earthquake response | Civil-protection / FEMA | ATC-20 placards across the impact zone within hours of imagery | 0–72 h post-event |
| Hurricane / cyclone | State emergency management | Flooded / wind-damaged structures pre-prioritised for inspection | 0–7 d post-event |
| Insurance triage | Catastrophe-modelling teams | Per-building damage probabilities for claims fast-track | 1–30 d |
| Humanitarian aid | UNOSAT, IFRC, OCHA | Map products showing concentrations of destroyed structures | 0–14 d |
| Urban resilience planning | City planners, researchers | Historical damage atlases for retrofit prioritisation | ongoing |
| Training & education | Students, ML practitioners | Reproducible curriculum (this site) + open code | ongoing |
7.3 Impact pathway
The downstream value is not raw F1 — it is hours saved in the placard-issuing pipeline. A trained ATC-20 inspector can evaluate ≈30 buildings per day on foot; a city of 100,000 structures therefore needs ~3,300 inspector-days after a major event. By pre-classifying every building into GREEN / YELLOW / RED and routing inspectors only to YELLOW (uncertain) and RED (high-priority) structures, the system reduces the inspection backlog by an estimated 60–80%and shortens the time-to-reopen for safe buildings from weeks to days.
7.4 Risks and ethical considerations
- False-GREEN risk. A missed RED building has life-safety consequences. Deployment must keep a human-in-the-loop for any building flagged with low confidence; the placard head exposes per-class softmax for exactly this triage.
- Geographic bias. xBD over-represents the global North; transfer-learning experiments to local building stock are mandatory before any new jurisdiction adopts the model.
- Imagery access. Commercial post-event imagery is licensed; the system should be paired with public Sentinel-1/2 fallbacks for equitable access.
Limitations & Future Work
What this project does not yet do.
- Cloud cover & off-nadir angles. xBD is filtered to near-nadir, low-cloud scenes — real disasters often violate both. Adding a cloud-mask preprocessor and an off-nadir augmentation curriculum is the next step.
- Single-modality. We use optical imagery only. Fusing SAR (Sentinel-1) would let the model see through cloud and at night.
- Building footprints. The current system needs vector footprints to aggregate pixels into placards. Joint footprint+damage detection (single-stage Mask R-CNN style) is a natural extension.
- Long-tail disasters. Wildfires and floods are under-represented in xBD; transfer learning to these domains needs a small labelled set per event.
How to navigate the rest of the curriculum
Each later lecture is a deep-dive on a block above.
- 📘 L1 · Vision Transformers — the math behind block ③ (ViT backbone).
- 📘 L2 · Focal & Dice Loss — the supervision band ⑦.
- 📘 L3 · Siamese Networks — blocks ③+④ (twin encoders, difference).
- 📘 L4 · Encoder · ResNet-50 — block ③ alternative backbone.
- 📘 L5 · Decoder · U-Net — block ⑤.
- 📘 Full Code page — block ⑥ FastAPI deployment, ready for Colab.