U-Net is an encoder-decoder architecture for image segmentation, where every pixel receives a prediction. It combines fine image details with high-level context through skip connections. section 8.0 section 8.3
Build the architecture from three cooperating subnetworks:
- Process the full-resolution input with convolutional layers to preserve low-level features. section 8.3
- Shrink features with max pooling, process higher-level information in a bottleneck, and restore spatial size with transposed convolution. section 8.3
- Concatenate the restored features with the full-resolution features, then apply output convolutions. section 8.3.1
- Nest U-Net blocks recursively to inspect multiple resolutions; typically increase filters as resolution decreases. section 8.3
PyTorch implementation pattern
An `UNetBlock2d` can store `in_model`, an optional max-pooling bottleneck, and `out_model`. Its forward pass computes full-scale features, concatenates bottleneck output along the channel dimension, and returns the output model’s result. Nesting three blocks and ending with `nn.Conv2d(32, 1, (3,3), padding=1)` produces one output channel per pixel. Compared with fine- or coarse-grained segmentation models, the demonstrated U-Net learns faster and reaches lower or equal loss. section 8.3.1
Figure 8.7 Example of a U-Net style architecture. After some rounds of convolution, max pooling is used to shrink the image several times. Eventually, a transposed convolution up-samples the results, and every up-sample includes a skip connection to the previous result before pooling. The results are concatenated together and proceed to a new output round of convolutions. The architecture makes a U-like shape.
Trace the U-shaped flow from repeated convolution and pooling through transposed-convolution up-sampling, skip concatenation, and output convolutions. section 8.3




