Skip to content
AI.info

Deep architectures

Encoder–Decoder and U-Net Architectures

Design encoder–decoder networks for dense outputs by reasoning about bottlenecks, skip fusion, upsampling, output heads, and information preservation.

By the end you can

Visual

The U-shaped information path

The two arms solve different problems. They meet through explicit interfaces.

One sentence in the 2015 U-Net paper holds the whole shape: the network “consists of a contracting path to capture context and a symmetric expanding path that enables precise localization”. Encoder, bottleneck, decoder and skip fusion are the named parts of that sentence. The dense head turns the recovered grid into the quantity a particular task needs.

FigureProcess · 5 steps
  1. 1

    Encoder

    Build increasingly contextual features while reducing spatial resolution.

  2. 2

    Bottleneck

    Represent broad context in a compact grid or latent state.

  3. 3

    Decoder

    Recover the output geometry through upsampling and refinement.

  4. 4

    Skip fusion

    Return selected high-resolution evidence from matching encoder stages.

  5. 5

    Dense head

    Produce per-position classes, values, vectors, or reconstructed content.

Dense outputs need both “what” and “where”

A compressed representation can recognize that an object exists and still lose the boundary a mask, a depth map, or a restored signal needs. The decoder translates context back into an output grid. U-Net-style skips help because they keep fine features reachable. They do not remove the need for the bottleneck, whose broader context disambiguates local textures.

Fully convolutional networks made that trade explicit in 2015. They are “fully convolutional”, and they “take input of arbitrary size and produce correspondingly-sized output”. The component that recovers detail is named after the two things it joins: “a skip architecture that combines semantic information from a deep, coarse layer with appearance information from a shallow, fine layer to produce accurate and detailed segmentations”. What that bought was “state-of-the-art segmentation of PASCAL VOC (20% relative improvement to 62.2% mean IU on 2012)”. The deep, coarse layer supplied the what. The shallow, fine layer supplied the where. The 20 per cent is what happens when a design stops choosing between them.

Dense prediction requires semantic context and spatial correspondence at the same time.

Comparison

Three decoder upsampling strategies

Each changes artifact risk, flexibility, and how much work it takes to build — and one of the three carries a defect you can predict with arithmetic before training anything.

That arithmetic was published in Distill in 2016, and the condition is exact: “In particular, deconvolution has uneven overlap when the kernel size (the output window size) is not divisible by the stride (the spacing between points on the top).” A stride-2, size-3 transposed convolution therefore gives some outputs twice the input contributions of others in one dimension. On a grid the unevenness compounds, to a factor of four in two dimensions. A network could in principle learn weights that cancel it. Distill's finding is that in practice networks struggle to avoid it completely. The checkerboard is a property of the geometry you chose, not a mystery of the optimizer.

Rearrangement methods attack the same problem from the other side. The sub-pixel layer arrived in 2016: “In addition, we introduce an efficient sub-pixel convolution layer which learns an array of upscaling filters to upscale the final LR feature maps into the HR output.” Features are extracted in low-resolution space. Channels are then rearranged into pixels. That is the exact channel–resolution contract. It bought +0.15 dB on images and +0.39 dB on videos. It ran an order of magnitude faster than the prior CNN methods, and was the first CNN able to super-resolve 1080p video in real time on a single K2 GPU. Distill, assessing it independently, notes that this amounts to choosing a kernel size divisible by the stride, and that “while this approach helps, it is still easy for deconvolution to fall into creating artifacts”. Interpolation followed by convolution sidesteps the divisibility question entirely. It separates resizing from feature learning, at the cost of the follow-up convolution.

FigureComparison · 3 columns

Interpolation plus convolution

Resize deterministically, then refine with learned filters.

  • Predictable geometry
  • Separates resizing from feature learning
  • Often stable against checkerboard artifacts
  • Adds a follow-up convolution cost

Transposed convolution

Use a learned operation that expands the spatial grid.

  • Learns upsampling weights
  • Flexible kernel and stride
  • Overlap patterns can create artifacts
  • Requires careful output-size arithmetic

Sub-pixel or rearrangement methods

Predict channels that are reorganized into spatial positions.

  • Efficient for selected tasks
  • Exact channel–resolution contract
  • Can expose periodic artifacts
  • Common in super-resolution designs

Example

One architecture pattern, several output contracts

The decoder and head must match the physical meaning of each target. Where the target is a patient, the contract may be written by a regulator rather than by the modeller. Limbus Contour was cleared by the FDA on 13 August 2020 for automatic contouring of CT and MR images. The Indications for Use draw the line in a single sentence: “Limbus Contour is not intended to automatically contour tumors or tumor clinical target volumes.” Healthy anatomical structures, yes. Tumour volumes, no.

The product runs a separate U-Net per structure. An independent hospital evaluation in 2022 measured what that delivers. Average Dice across structures was 0.72 — 0.99 for lungs, 0.39 for the penile bulb. Contouring time in head and neck cases fell by 65%. One architecture, one clearance, and a per-structure quality spread wide enough that the output contract has to be written structure by structure rather than model by model.

  • Semantic segmentation: the head predicts a class distribution at each pixel or voxel, and quality has to be reported per structure because it varies per structure — 0.99 for lungs against 0.39 for the penile bulb in the same cleared product.
  • Depth estimation: the decoder emits a continuous field whose scale and invalid regions require explicit handling.
  • Denoising: the network predicts a clean signal, a residual, or noise, depending on the training objective.
  • Medical registration: the output may be a displacement field constrained by smoothness and topology.
  • Audio source separation: a time–frequency decoder estimates masks or waveforms while preserving phase-related structure.

Analogy

Summarizing a case, then rebuilding its annotated map

An investigator condenses a large case file into a strategic summary, then reconstructs a detailed map using both that summary and bookmarked evidence from earlier pages.

A bookmark points back to a page anyone can reopen; skip tensors are learned feature maps, not trustworthy citations. Context alone cannot reconstruct every local boundary.

The bottleneck explains the scene; skips restore access to where the evidence occurred.

Key idea

Skip connections can carry noise as efficiently as detail

Early encoder features may carry acquisition artifacts, texture shortcuts, or irrelevant high-frequency patterns. A decoder can overuse them, because they are an easy route to lower training loss. This is not a hypothetical risk, and the shortcut is not faint.

It was measured on 158,323 chest radiographs from three institutions and published in PLOS Medicine in 2018: “CNNs were able to directly detect hospital system of a radiograph for 99.95% NIH (22,050/22,062) and 99.98% MSH (8,386/8,388) radiographs.” A network that names the source hospital system on 22,050 of 22,062 images has learned the acquisition signature. That signature lives in exactly the high-resolution early features a skip connection hands to the decoder untouched. Three years later a different group found the same behaviour on different data. Their 2021 Nature Machine Intelligence paper is titled AI for radiographic COVID-19 detection selects shortcuts over signal.

Projection, gating, attention, normalization, or selective skip removal can help. Which of them is correct depends on whether the failure comes from alignment, scale, or nuisance information.

Preserved detail is valuable only when it corresponds to the target rather than a shortcut.

Steps

Debug a dense decoder from geometry outward

Start with deterministic tensor checks before blaming the optimizer. Two of these steps are arithmetic rather than experiment. Whether kernel size divides stride can be settled on paper. A synthetic impulse makes the resulting checkerboard visible in one forward pass, instead of after a training run.

FigureProcess · 5 steps
  1. 1. Assert every spatial shape

    Verify downsampling factors, padding, crops, and final output size.

  2. 2. Test a synthetic pattern

    Use lines, impulses, or shapes to reveal alignment and checkerboard effects.

  3. 3. Disable skips selectively

    Measure which fusion level adds detail and which imports artifacts.

  4. 4. Inspect per-scale gradients

    Confirm that encoder, bottleneck, and decoder all receive useful signal.

  5. 5. Evaluate boundaries separately

    Distinguish semantic recognition from localization quality.

A U-shape is a pattern, not a guarantee

U-Net's contracting and expanding paths are widely reusable. Architecture names still do not settle data efficiency, calibration, robustness, or annotation quality. The KiTS19 challenge in 2019 put numbers on the last of those, over 210 public training CT scans and 90 private test scans. The winning entry came from Isensee and Maier-Hein, under the title An Attempt at Beating the 3D U-Net. The organisers recorded what it did: “The winning team achieved a Dice of 0.974 for kidney and 0.851 for tumor, approaching the inter-annotator performance on kidney (0.983) but falling short on tumor (0.923).” One entry, one set of scans, one architecture. It sat at the annotation ceiling for kidney and a long way beneath it for tumour. On kidney the binding constraint was no longer the network.

What won is equally instructive. nnU-Net configures preprocessing, architecture, training and post-processing automatically. Its 2020 paper in Nature Methods states the result: “Without manual intervention, nnU-Net surpasses most existing approaches, including highly specialized solutions on 23 public datasets used in international biomedical segmentation competitions.” The KiTS19 organisers saw the same lesson from the other side, writing that “one might have expected KiTS19 to be won by the team which finds the right architectural garnish with which to augment the nnU-Net baseline, but as we discuss in Section 4, the 'vanilla' nnU-Net demonstrated top performance despite attempts by several teams to enhance it”. Three-dimensional variants can also become prohibitively memory intensive.

Treat depth, skip placement, receptive field, and decoder capacity as hypotheses. Evaluate them against the actual output geometry and acquisition process.

Across 23 public competition datasets and one head-to-head challenge, the pipeline tuned by rules about the data beat the ones decorated with architecture.

Case

U-Net won the 2015 cell-tracking challenge from 35 and 20 annotated images

The shape has one origin. U-Net was published in 2015 by Ronneberger and colleagues. The claim they made was about data rather than depth: “such a network can be trained end-to-end from very few images”. The two challenges they entered say how few.

The ISBI 2012 EM segmentation challenge released 30 consecutive 512×512 images for training, and 30 for test. They were serial-section transmission electron microscopy images of the Drosophila first-instar larva ventral nerve cord. The organisers set the training data and the warping-error metric. On the leaderboard of 6 March 2015 U-Net ranked first: “The u-net (averaged over 7 rotated versions of the input data) achieves without any further pre- or postprocessing a warping error of 0.0003529 (the new best score, see Table 1) and a rand-error of 0.0382.” The best prior method, Ciresan's sliding-window network, scored 0.000420 and 0.0504 on the same two metrics. Human annotators scored 0.000005 and 0.0021. Thirty training images put the network ahead of the best prior method and short of the humans, with both distances printed.

The “large margin” in the paper is also a number. The claim reads: “using the same network trained on transmitted light microscopy images (phase contrast and DIC) we won the ISBI cell tracking challenge 2015 in these categories by a large margin”. On PhC-U373, from 35 partially annotated training images, U-Net reached an average IoU of 92.03% against 83% for the second-best entry. On DIC-HeLa, from 20 partially annotated training images, it reached 77.56% against 46%. Twenty annotated images, and the runner-up left at 46%. Speed came with it: “segmentation of a 512x512 image takes less than a second on a recent GPU”.

Key takeaways