Image Segmentation with U-Net

ECE 57000 — Fall 2026

David I. Inouye

Segmentation needs a prediction at every image location

Arc 5: CNN fundamentals → evidence → ResNet classification → U-Net segmentation.

Task → Upsampling → Architecture

A classifier summarizes an image. A segmentation model must retain where each class occurs.

A road map needs a label at every pixel

An actual Massachusetts aerial RGB image crop beside its supplied binary road annotation. White mask pixels indicate roads.

Mnih, Massachusetts Roads (2013), validation tile 10228690_15; aligned crop.

The input can stay the same while the output becomes spatial

Image classification Semantic segmentation
RGB input \([B,3,H,W]\) \([B,3,H,W]\)
Model logits \([B,K]\) \([B,K,H,W]\)
Integer targets \([B]\) \([B,H,W]\)

For roads: two logits per pixel, road or background.

Reuse cross-entropy, averaged over labeled pixels. Keep the spatial grid instead of globally pooling it away.

Transposed convolution uses the transpose of the linear operator

A convolution matrix maps six flattened inputs to two outputs. Its transpose reverses the connections and maps two inputs to six outputs, without guaranteeing inversion.

\[\boldsymbol{y}=A_K\boldsymbol{x}\qquad\longrightarrow\qquad\boldsymbol{u}=A_K^{\mathsf T}\boldsymbol{z}\]

Fractional-stride intuition explains learned spatial expansion

A stride-two transposed convolution of inputs two and three with kernel one-two-one scatters overlapping patches, summing to two-four-five-six-three.

In 2D, ConvTranspose2d(16, 8, 2, stride=2) maps \([B,16,16,16]\) to \([B,8,32,32]\).

U-Net combines coarse context with fine-resolution features

U-shaped MONAI BasicUNet architecture. Front faces shrink while channel depth grows through the encoder; the decoder restores spatial size. Horizontal skip arrows concatenate features at equal spatial resolutions.

Original illustration of MONAI BasicUNet 1.5.1, 2D configuration; shapes are channels × spatial size.

The U-Net head keeps one score vector at every pixel

The last U-Net stage concatenates two 32-channel full-resolution maps, fuses 64 channels to 32, and uses a one-by-one head to output two logits at each pixel.

The task determines what the architecture must preserve

  • Classification: aggregate spatial features into an image-level decision.
  • Segmentation: combine broad context with location-specific detail.
  • Both: architectural choices need evidence on the intended data and task.

We can now read complete architectures from familiar operations. Knowing the pieces does not show that a model solves the application.