U-Net — the decoder that paints the damage map
A symmetric expanding path that takes the encoder's tiny 7×7 feature map and grows it back to a full 224×224 per-pixel damage map. Skip connections from the encoder restore the fine spatial detail that downsampling discarded.
The encoder squeezed our photo down to a tiny 7×7 grid full of meaning. The decoder's job is the opposite: blow that grid back up to a full 224×224 colour-coded damage map, one of five classes per pixel (no damage, minor, moderate, major, destroyed). Naively upsampling alone gives a blurry blob. The trick is the skip connections: at every level, we paste the encoder's same-resolution feature map back in, so the decoder knows both what a region is (from deep features) and whereit ends (from early features).
- UpConv (transposed 2×2) = a learned "zoom in 2×" — doubles height and width.
- Concat = stick two feature maps together along the channel axis (like stacking transparencies).
- DoubleConv = two 3×3 convs back-to-back, each with BN + ReLU. The first halves channels; the second refines.
- 1×1 conv at the end = a tiny per-pixel classifier that maps the final 32-channel map to 5 damage-class scores.
- The whole network is shaped like a "U" — encoder going down on the left, decoder coming back up on the right, skip arrows crossing the middle.
- ① Enc 0 (stem features,
64 × 224 × 224) — the very first encoder output. Same resolution as the input; holds crisp edges and colour gradients. We will use it to place razor-sharp damage boundaries at the end. - ② Enc 1 / Stage 1 (
256 × 56 × 56) — local textures (roof shingles, vegetation, asphalt). - ③ Enc 2 / Stage 2 (
512 × 28 × 28) — object parts (a window, a wall section, a car). - ④ Enc 3 / Stage 3 (
1024 × 14 × 14) — mid-level semantics ("intact building", "rubble pile"). - ⑤ Enc 4 / Stage 4 — the bottom of the U (
2048 × 7 × 7) — the deepest, most abstract feature map. This is the "valley" of the U-shape. - ⑥ Dec 4 — first up-step — a transposed 2×2 conv doubles the size to 14×14, then DoubleConv fuses it with the Enc 3 skip. Output:
512 × 14 × 14. - ⑦ Dec 3 — up to 28×28; concatenates the Enc 2 skip; output
256 × 28 × 28. - ⑧ Dec 2 — up to 56×56; concatenates the Enc 1 skip; output
128 × 56 × 56. - ⑨ Dec 1 — up to 112×112; output
64 × 112 × 112(no skip available at 112² — the encoder never stops there). - ⑩ Dec 0 — final up-step — up to 224×224; concatenates the Enc 0 skip; output
32 × 224 × 224. We are now back at the original resolution. - ⓫ Skip connections (the four dashed blue arrows) — at each level, the encoder feature map is concatenated (stacked, not added) with the upsampled decoder feature. This is the single biggest reason U-Net beats a plain encoder-decoder: it can read "what is this" from deep features and "where exactly does it end" from shallow features at the same time.
- ⑫ Bridge (bottom arrow) — the deepest encoder feature flows straight into Dec 4 with no separate skip — Enc 4 is the decoder's input.
- ⑬ Final 1×1 conv + softmax — projects 32 channels → 5 (one per damage class), then softmax turns those into per-pixel probabilities.
argmaxover the 5 channels gives the final colour-coded damage map. - ⑭ Zoom: one decoder stage — internally each Dec block is: UpConv 2× (doubles H,W) → Concat with the encoder skip → 3×3 conv + BN + ReLU twice (the classic U-Net "double-conv") → tiny Dropout for regularisation → hand off to the next stage. The first 3×3 halves the concatenated channels; the second refines them.
| Stage | Input (from below) | Skip in | After UpConv | After DoubleConv |
|---|---|---|---|---|
| Bridge | 2048 × 7 × 7 | — | — | 1024 × 7 × 7 |
| Dec 4 | 1024 × 7 × 7 | 1024 × 14 × 14 | 512 × 14 × 14 | 512 × 14 × 14 |
| Dec 3 | 512 × 14 × 14 | 512 × 28 × 28 | 256 × 28 × 28 | 256 × 28 × 28 |
| Dec 2 | 256 × 28 × 28 | 256 × 56 × 56 | 128 × 56 × 56 | 128 × 56 × 56 |
| Dec 1 | 128 × 56 × 56 | — | 64 × 112 × 112 | 64 × 112 × 112 |
| Dec 0 | 64 × 112 × 112 | 64 × 224 × 224 | 32 × 224 × 224 | 32 × 224 × 224 |
| Head | 32 × 224 × 224 | — | — | 5 × 224 × 224 (softmax) |
Note how every up-step halves the channel count and doubles the spatial size, mirroring the encoder's contracting path exactly — that symmetry is the "U".
- U-Net
- — U-shaped encoder-decoder with skip connections, Ronneberger et al. 2015.
- Encoder
- — left side: shrinks H/W, grows channels. Asks "what is in the image?"
- Decoder
- — right side: grows H/W, shrinks channels. Asks "where exactly is it?"
- UpConv
- — transposed convolution; a learned 2× zoom-in (doubles H and W).
- Concat
- — stack two tensors along the channel axis (like stacking transparencies).
- DoubleConv
- — two 3×3 conv + BN + ReLU layers back-to-back; the U-Net "Lego brick".
- Skip connection
- — same-resolution feature map piped from encoder to decoder.
- Bridge / bottom
- — deepest layer at the bottom of the "U"; no separate skip.
- 1×1 conv
- — per-pixel linear layer; here projects 32 channels → 5 class scores.
- Softmax
- — turns the 5 raw scores into probabilities summing to 1 per pixel.
- Dropout
- — randomly zeros some activations during training to fight overfitting.
- Segmentation map
- — H×W image where each pixel is a class label (here: damage tier).