Lecture L0 · Master overview

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.

xBD datasetViTSiameseResNet-50U-NetFocal + DiceAblationATC-20ONNX deployment
1

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.

2

Figure 1 — End-to-end Pipeline

One diagram for the whole project.

End-to-end pipeline: satellite imagery → ATC-20 placardxBD pre/post tiles1024×1024 GeoTIFFPreprocesstile, normalize, augmentEncoder (ResNet-50 / ViT)shared Siamese weightsDifference blockF_post − F_preU-Net decoderskip-concat, double-convATC-20 headGREEN / YELLOW / REDTraining supervision ⑦Loss = α · Focal(γ=2) + (1−α) · Dice — combats 96% background imbalance (Lecture L2).Multi-scale deep supervision at decoder stages 0–3 (Lecture L3).
  1. ① Input tiles — paired pre-/post-event 1024×1024 GeoTIFFs from xBD, georeferenced.
  2. ② Preprocess — tile to 512×512 with 64 px overlap, ImageNet normalization, random flip/rotate augmentation.
  3. ③ Encoder — shared-weight backbone (ResNet-50 or ViT-B/16) processes both dates independently (Lectures L1, L4).
  4. ④ Difference block — element-wise F_post − F_pre at every encoder stage isolates change features (Lecture L3).
  5. ⑤ U-Net decoder — symmetric expanding path concatenates skip features and upsamples to full resolution (Lecture L5).
  6. ⑥ ATC-20 head — per-building aggregation of pixel logits into a single placard tag.
  7. ⑦ Supervision — combined loss + multi-scale deep supervision at four decoder depths (Lecture L2).
3

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.

Table 1 — xBD official splits.
SplitDisastersPre/post pairsBuildingsAvg. GSD
Train89,168~ 632 k0.31 m / px
Hold-out8933~ 65 k0.31 m / px
Test8933~ 65 k0.31 m / px
Tier-3 (extra)1011,034~ 110 k0.31 m / px
xBD pixel-level class distribution (per 100k pixels)96 %backgroundBackground96.0 %No damage2.7 %Minor0.7 %Major0.4 %Destroyed0.2 %

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).

4

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

Methodology workflow — six stages, fully reproducible1 · AcquirexBD pre/post GeoTIFFs2 · Preprocesstile 512², normalize3 · Augmentflip · rotate · jitter4 · Build modelencoder + Siamese + U-Net5 · TrainFocal + Dice + deep sup.6 · Evaluatemacro-F1 · per-classFeedback: re-tune α, class weights, augmentation if macro-F1 below 0.70

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. 2
MSA(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. 6

With γ = 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. 7
L_total = α · L_focal + (1 − α) · L_dice ,   α = 0.6Eq. 8

Multi-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

Table M1 — Training hyper-parameters (fixed across every ablation experiment).
Hyper-parameterValueJustification
OptimizerAdamWDecoupled weight decay — works for transformers + CNNs.
Learning rate3 × 10⁻⁴ (cosine decay)Standard for ImageNet-pretrained ViT-B/16 fine-tuning.
Weight decay5 × 10⁻²Regularises the over-parameterised ViT branch.
Batch size16 tile pairsLargest that fits a single 16 GB GPU at 512² resolution.
Epochs60Validation macro-F1 plateaus by epoch 55.
Warm-up5 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.6Tuned on hold-out split — see §5 ablation.
Mixed precisionfp16 (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. 9

For 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).

5

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

Table 2 — Ablation results on xBD test split (macro-F1, 4 damage classes).
#BackboneBranchesLossDeep sup.Macro-F1Δ vs. baseline
A1ResNet-50singleCEno0.642
A2ResNet-50singleFocalno0.681+3.9 pp
A3ResNet-50singleFocal + Diceno0.701+5.9 pp
A4ResNet-50SiameseFocal + Diceno0.722+8.0 pp
A5ResNet-50SiameseFocal + Diceyes0.731+8.9 pp
A6ViT-B/16singleFocal + Diceno0.715+7.3 pp
A7ViT-B/16SiameseFocal + Diceno0.741+9.9 pp
A8ViT-B/16SiameseFocal + Diceyes0.756+11.4 pp
Per-class F1 scores across architectures (xBD test split)0.000.250.500.751.00F1 score0.820.850.870.90No damage0.410.460.520.58Minor0.550.590.660.71Major0.710.740.790.83DestroyedResNet-50 U-NetViT-B/16 U-NetSiamese ResNetSiamese ViT (ours)

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.

What the ablation says
  1. Loss matters more than backbone for the first +6 pp. A1 → A3 alone closes most of the gap.
  2. Siamese topology is the next biggest single win (+2 pp at the same loss / backbone).
  3. ViT outperforms ResNet only once Siamese + Focal+Dice are in place — patch-attention shines when the difference signal is already clean.
  4. 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.
6

Operational ATC-20 Deployment

From pixel logits to a placard a building inspector trusts.

ATC-20 operational deployment workflowDisaster triggerEQ / hurricane alertImagery ingestMaxar/Planet API → S3InferenceFastAPI /predict (ONNX)Per-pixel map5-class damage tensorAggregate to bldgmajority vote ⊕ confidenceATC-20 placardGREEN · YELLOW · REDGREEN — safe to occupyYELLOW — limited entryRED — unsafe, no entry

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:

Table 3 — Placard decision rules used at inference.
Damage fraction (major+destroyed)Damage fraction (minor+moderate)PlacardInspector instruction
≥ 0.40REDUnsafe — no entry
0.20 – 0.40YELLOWRestricted entry, expert assessment required
< 0.20≥ 0.05YELLOWLimited entry, monitor
< 0.20< 0.05GREENSafe 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.

7

Expected Outcomes & Applications

What this project produces, who uses it, and where it can be deployed.

7.1 Expected outcomes

  1. 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.
  2. An open-source model artifact — Siamese ViT + Focal/Dice + deep-sup. U-Net — exported to ONNX and wrapped behind a FastAPI /predict endpoint with documented OpenAPI schema (Lectures W1–W3).
  3. An ATC-20 placard mapper with jurisdiction-tunable thresholds (Table 3) that converts per-pixel damage probabilities into a GREEN / YELLOW / RED building tag.
  4. Operational latency < 600 ms per 1024×1024 tile on a single T4 GPU, enabling city-scale inference in tens of minutes after imagery arrival.
  5. 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

Table 4 — Application domains and the stakeholders served.
DomainPrimary userWhat the system deliversTime horizon
Earthquake responseCivil-protection / FEMAATC-20 placards across the impact zone within hours of imagery0–72 h post-event
Hurricane / cycloneState emergency managementFlooded / wind-damaged structures pre-prioritised for inspection0–7 d post-event
Insurance triageCatastrophe-modelling teamsPer-building damage probabilities for claims fast-track1–30 d
Humanitarian aidUNOSAT, IFRC, OCHAMap products showing concentrations of destroyed structures0–14 d
Urban resilience planningCity planners, researchersHistorical damage atlases for retrofit prioritisationongoing
Training & educationStudents, ML practitionersReproducible curriculum (this site) + open codeongoing

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.
8

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.
9

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.