U-Net & Fully Convolutional Networks

The network shape that labels every pixel, and became the standard for medical scans.

🔴 advanced5 min readvision
These networks label every pixel in an image, for example marking which pixels are road, car or person. A fully convolutional network swapped the usual classification layers for convolutions, so it accepts any image size and outputs a full map of labels. U-Net shrinks the image step by step to understand what is in it, then grows it back to full size to say exactly where. Shortcut links carry fine detail across, which keeps edges sharp. It became the standard for medical images.

The U-Net Architecture (Ronneberger et al., 2015)

U-Net consists of a Contracting Path (Encoder) to capture context and a symmetric Expanding Path (Decoder) for precise spatial localization:

  CONTRACTING ENCODER (Context)                      EXPANDING DECODER (Localization)
  Input Image (572x572) ──────────────────────────────────────────────────────────► Output Mask (388x388)
     │                                                                                ▲
     ▼                                                                                │
  [ 2x Conv 3x3 ] ─────────────── Skip Connection (Concatenate) ──────────────► [ 2x Conv 3x3 ]
     │ MaxPool 2x2                                                                    ▲ UpConv 2x2
     ▼                                                                                │
  [ 2x Conv 3x3 ] ─────────────── Skip Connection (Concatenate) ──────────────► [ 2x Conv 3x3 ]
     │ MaxPool 2x2                                                                    ▲ UpConv 2x2
     ▼                                                                                │
     └──────────────────────────► [ Bottleneck 2x Conv 3x3 ] ─────────────────────────┘

Encoder-Decoder Mechanics

  1. Contracting Encoder: Repeated blocks of 3×33 \times 3 convolutions followed by ReLU and 2×22 \times 2 Max Pooling downsampling. Feature channels double at each step (64→128→256→512→102464 \to 128 \to 256 \to 512 \to 1024).
  2. Bottleneck: Deepest layer capturing high-level semantic context.
  3. Expanding Decoder: Upsamples feature maps using 2×22 \times 2 Transposed Convolutions (Deconvolutions), halving feature channels while doubling spatial dimensions.
  4. Skip Connections: Concatenates feature maps from the contracting path directly onto corresponding upsampled decoder feature maps.

Why Skip Connections Are Essential

Pooling operations downsample spatial resolution to capture invariant semantic features.

However, pixel-level segmentation requires exact spatial boundary localization.

Skip connections copy high-resolution edge and boundary details directly from early encoder layers, giving the decoder both what (semantic context) and where (exact spatial location).

FCN: Replacing Fully Connected Layers with 1x1 Convolutions

Traditional classifiers (VGG/AlexNet) end with Dense Fully Connected layers (4096→10004096 \to 1000).

FCN replaced Dense layers with 1×11 \times 1 convolutions:

  Traditional: [ Feature Map 7x7x512 ] ──► Flatten ──► [ Dense Layer 4096 ] (Requires FIXED 224x224 input!)
  FCN:         [ Feature Map 7x7x512 ] ──► [ 1x1 Conv 4096 ]                 (Accepts ANY input H x W!)

Replacing dense layers allows FCNs to take an input image of any resolution and produce a spatially corresponding heat map output in a single forward pass.

Say this out loud

U-Net uses a symmetric U-shaped encoder-decoder architecture with skip connections. The encoder captures deep semantic context through downsampling, while the decoder upsamples feature maps for pixel-wise prediction. Skip connections concatenate early high-resolution spatial maps directly to decoder layers, recovering sharp object boundary details lost during pooling.

Follow-ups to expect

Check yourself

Question 1 of 3

Why are Skip Connections between Encoder layers and Decoder layers crucial to U-Net's high pixel-level segmentation accuracy?

More in Computer Vision

See all →
Image Augmentation Strategies5 minResizing, Normalization & Colour Spaces4 minResNet, EfficientNet & Friends5 min