Foundations to Frontier
Tests
E. Deep Learning › E10 Segmentation Architectures

Fully Convolutional Network (FCN)

The Fully Convolutional Network (Long, Shelhamer and Darrell, 2015) turned image classifiers into pixel labellers. Fully connected layers are rewritten as convolutions, so the network outputs a coarse map of class scores for an image of any size. Transposed convolutions initialised to bilinear interpolation upsample the map, and skip connections fuse predictions from finer layers (FCN-16s, FCN-8s). FCN-8s reached 62.2% mean IoU on PASCAL VOC 2012, a 20% relative improvement. This page covers convolutionalisation, upsampling, skip fusion and segmentation metrics. In the exercises you convert a fully connected layer to a convolution, then show that even perfect predictions at stride 32 give IoU 0 for small objects, while stride 8 recovers most detail.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

A class for every pixel

An image classifier says “there is a cat”. Segmentation says which pixels are cat. FCN showed how to reuse a classifier for this. Its final fully connected layers are just convolutions that look at the whole small feature map, so they can slide over larger images too, giving a coarse grid of class scores. That grid is then stretched back to full size, and details lost on the way are restored by adding predictions from earlier, sharper layers.

Segmentation lab
pixel accuracy 0.933 · IoU 0.792 · Dice 0.884 (blue: correct, red: false positive, yellow: missed)
Segmentation labels every pixel. Coarse score maps lose boundaries when upsampled; skip connections from finer layers (FCN, U-Net) and dilated convolutions (DeepLab) recover detail. Judge masks by IoU or Dice, not pixel accuracy, which background inflates.
Why engineers care

Segmentation labels roads, obstacles, crops, buildings and water pixel by pixel, for driving, robot navigation and Earth observation. FCN’s design (convolutional throughout, upsampling, skip connections) is the template for all later segmenters.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Segmentation assigns a class to…
  2. 2. FCN replaces fully connected layers with…
  3. 3. Skip connections restore…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Convolutionalisation: a fully connected layer on a c × k × k map equals a k × k convolution with the same weights.

    • VGG’s fc6 on 512 × 7 × 7 becomes a 7 × 7 convolution with 4,096 filters: 102,764,544 parameters, unchanged.
    • On a larger image it outputs a map, e.g. 3 × 3 for a 6 × 6 input with k = 4.
  • Output stride: VGG downsamples by 32, so a 512 × 384 image gives 16 × 12 scores.

  • Upsampling: a transposed convolution with stride s. Initialised to bilinear interpolation, its 1-D kernel for s = 2 is [0.25, 0.75, 0.75, 0.25].

  • Skip fusion:

    • FCN-32s upsamples stride-32 scores by 32;
    • FCN-16s adds scores from pool4 (stride 16) to 2× upsampled stride-32 scores;
    • FCN-8s also adds pool3 (stride 8).
  • Metrics:

    • pixel accuracy is the share of correctly labelled pixels;
    • IoU per class is TP/(TP + FP + FN);
    • mean IoU averages IoU over classes.

    Predicting all background on a mask that is 2% object gives 98% pixel accuracy but IoU 0 for the object.

📝 Quick check (Level 1)
0/3 answered
  1. 1. Score map for a 512 × 384 image at stride 32:
  2. 2. FCN-8s fuses predictions from…
  3. 3. Why not pixel accuracy?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

FCN in code

Exercise 1.

  • A fully connected layer and its convolutional form gave identical outputs on a k × k input, and a 3 × 3 score map on a larger input.
  • The bilinear transposed-convolution kernel for factor 2 matched [0.25, 0.75, 0.75, 0.25].

Practice.

  • torchvision’s fcn_resnet50 and fcn_resnet101 use a dilated ResNet backbone (output stride 8) with an FCN head.
  • Loss: per-pixel cross-entropy, ignoring unlabelled pixels (label 255 in VOC).
  • Training: in the original, SGD with momentum and whole images as batches (batch size 1). Skip layers were trained in stages: FCN-32s first, then 16s, then 8s.
  • Evaluation: report mean IoU over classes on the validation set at full resolution; pixel accuracy hides class imbalance.
model = torchvision.models.segmentation.fcn_resnet50(weights="DEFAULT")
out = model(img)["out"]                                   # (N, 21, H, W) class scores at full resolution
loss = F.cross_entropy(out, mask, ignore_index=255)
🐍 Exercise 1: from classifier to segmenter
Rewrite a fully connected layer as a convolution, build FCN's bilinear upsampling kernel, and compute the output size.
📝 Quick check (Level 2)
0/3 answered
  1. 1. VOC's ignore label:
  2. 2. FCN's upsampling layers were initialised to…
  3. 3. torchvision's FCN backbone has output stride…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

What versus where. Deep, coarse layers know what is in the image but not exactly where; shallow, fine layers know where edges are but not what they belong to. FCN’s skip architecture combines them:

  • coarse semantic predictions are refined by adding predictions from finer layers;
  • the network learns how much to trust each.

Resolution limits. Even perfect scores at a coarse stride cannot represent objects smaller than about one cell. Exercise 2 shows small objects get IoU 0 at stride 32 even with oracle scores. FCN-32s → 16s → 8s raised mean IoU on VOC 2011 validation from 59.4 to 62.4 to 62.7, diminishing returns as the stride approached object scales.

Shift-and-stitch, upsampling and dilation.

  • Dense outputs can be obtained by shifting the input and interleaving outputs, which FCN considered but rejected in favour of learned upsampling.
  • Dilated convolutions (DeepLab, E10-5) later kept higher resolution without extra parameters.
  • Encoder–decoders (U-Net, SegNet) upsample step by step.
📝 Quick check (Level 3)
0/3 answered
  1. 1. Deep layers know…
  2. 2. FCN-32s to FCN-8s mIoU on VOC 2011 val:
  3. 3. Objects smaller than a cell at the output stride…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much does output stride cost?

History.

  • J. Long, E. Shelhamer and T. Darrell (2015) introduced FCN at CVPR (best paper honourable mention), with 62.2% mean IoU on VOC 2012 test.
  • O. Ronneberger et al. (2015) introduced U-Net; V. Badrinarayanan et al. (2017) SegNet; L.-C. Chen et al. (2015–2018) DeepLab.

Exercise 2. This is an upper-bound calculation, not a training run. For 240 elliptical objects in 128 × 128 images, we assume the best possible prediction at output stride s: the fraction of foreground in each s × s cell. We upsample it bilinearly, threshold at 0.5, and measure IoU with the true object:

output stride small (under 24 px) medium large (over 48 px)
32 0.000 0.093 0.497
16 0.094 0.676 0.871
8 0.578 0.919 0.962
4 0.910 0.975 0.986
  • Stride sets a hard ceiling. At stride 32 no small object survives, and even large ones (here under two cells wide) reach only 0.50.
  • Each halving of the stride recovers detail; small objects need stride 8 or finer.
  • What matters is object size relative to the stride. In real 500-pixel VOC images the same stride costs less. This motivates FCN-8s’s skips and the high-resolution designs that followed.
🐍 Exercise 2 (research): how much does output stride cost?
Compute the best achievable IoU after upsampling oracle predictions at several output strides, by object size.

FCN in AI, robotics and aerospace

  • Driving and robot navigation: drivable-area and obstacle segmentation are FCN descendants running on vehicles.
  • Earth observation: land-cover, water and cloud masks from satellite imagery use fully convolutional networks on large tiles of any size.
  • Small structures: roads, rivers and power lines are thin, so keep the output stride small or use skips.

References

  1. J. Long, E. Shelhamer, T. Darrell (2015). “Fully convolutional networks for semantic segmentation.” Proc. CVPR.
  2. O. Ronneberger, P. Fischer, T. Brox (2015). “U-Net: convolutional networks for biomedical image segmentation.” Proc. MICCAI.
  3. L.-C. Chen et al. (2018). “DeepLab: semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs.” IEEE TPAMI 40(4).