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.
★☆☆☆☆ 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 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. Segmentation assigns a class to…
2. FCN replaces fully connected layers with…
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. Score map for a 512 × 384 image at stride 32:
2. FCN-8s fuses predictions from…
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 resolutionloss = 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. VOC's ignore label:
2. FCN's upsampling layers were initialised to…
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. Deep layers know…
2. FCN-32s to FCN-8s mIoU on VOC 2011 val:
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
J. Long, E. Shelhamer, T. Darrell (2015). “Fully convolutional networks for semantic segmentation.” Proc. CVPR.
O. Ronneberger, P. Fischer, T. Brox (2015). “U-Net: convolutional networks for biomedical image segmentation.” Proc. MICCAI.
L.-C. Chen et al. (2018). “DeepLab: semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs.” IEEE TPAMI 40(4).
With perfect stride-32 scores, small objects get IoU 0; stride 8 recovers most detail.
Practice
Show:
Level 0
Problem 1Level 0
Output stride of VGG-based FCN-32s?
32.
Problem 2Level 0
Classes in PASCAL VOC segmentation (20 objects plus background)?
21.
Problem 3Level 0
Score maps fused in FCN-8s?
Strides 32, 16 and 8: 3.
Level 1
Problem 4Level 1
Score-map height for a 512-pixel-tall image at stride 32?
16.
Problem 5Level 1
Middle weight of the 1-D bilinear upsampling kernel for factor 2?
0.75.
Problem 6Level 1
Pixel accuracy of an all-background prediction on a 10 × 10 mask with 2 object pixels?
98/100 = 0.98.
Problem 7Level 1
Parameters of VGG’s fc6 as a 7 × 7 convolution (512 → 4,096, with bias)?
102764544.
Level 2
Problem 8Level 2
Best achievable IoU for large objects at stride 32 in exercise 2?
0.497.
Problem 9Level 2
Best achievable IoU for small objects at stride 8?
0.578.
Problem 10Level 2
Best achievable IoU for medium objects at stride 8?
0.919.
Problem 11Level 2
Mean IoU over classes with IoUs 0.8, 0.6 and 0.4?
0.6.
Problem 12Level 2
Length of the 1-D bilinear kernel for upsampling by 32?
2·32 = 64.
Problem 13Level 2
Mean-IoU gain from FCN-32s to FCN-8s on VOC 2011 val (59.4 → 62.7), in points?
3.3.
Level 3
Problem 14Level 3
Show that a fully connected layer on a c × k × k input equals a k × k convolution.
The fully connected layer computes y_o = Σ_(c,i,j) W[o, (c, i, j)]·x[c, i, j] + b_o. A k × k convolution with kernels K_o[c, i, j] = W[o, (c, i, j)] at the single valid position computes the same sum. So the outputs agree, and on larger inputs the convolution simply produces the same computation at every position. ∎
Problem 15Level 3
Explain why even perfect stride-32 scores give IoU 0 for small objects.
At stride 32 each score covers a 32 × 32 cell. An object under 24 pixels across fills less than half of any cell it touches, so the best score (its foreground fraction) stays below 0.5 everywhere, and bilinear upsampling cannot raise it above 0.5. After thresholding nothing is predicted, so IoU is 0 whatever the network learns. ∎
Problem 16Level 3
Explain why mean IoU is preferred over pixel accuracy.
Pixel accuracy counts all pixels equally, so large classes such as background, sky or road dominate it, and a model ignoring small classes can still score highly (98% for an all-background prediction on a 2% object). Mean IoU computes IoU per class and averages over classes, so each class counts equally, and IoU penalises both false positives and misses. ∎
Problem 17Level 3
Advise how to segment narrow rivers in satellite images.
Rivers can be a few pixels wide, so keep the output stride at 4 to 8 with dilated backbones or a U-Net-style decoder with skip connections. Train with a loss robust to class imbalance (Dice or focal plus cross-entropy). Tile the large images at native resolution, evaluate IoU of the river class specifically, and check thin tributaries visually. ∎
Level 4
Problem 18Level 4
FCN-8s’s mean IoU on VOC 2012 test, in percent?
62.2.
Problem 19Level 4
Best achievable IoU for small objects at stride 4 in exercise 2?
0.910.
Problem 20Level 4
Best achievable IoU for medium objects at stride 16?
0.676.
Coding practice
🐍 Code 1 (Level 0): output size
Divide by the stride.
🐍 Code 2 (Level 1): bilinear kernel
1-D bilinear upsampling weights.
🐍 Code 3 (Level 0): accuracy and IoU
Pixel accuracy and IoU of binary masks.
🐍 Code 4 (Level 0): mean IoU
Average over classes.
🐍 Code 5 (Level 1): fc6 as convolution
Parameters stay the same.
Topic test
A timed test drawn at random from this topic's question bank. Each attempt gets new questions. For a longer test across the whole chapter, see the chapter test, or mix topics in the question bag.
Fully Convolutional Network (FCN): topic test
10 questions, drawn at random from a bank of 21. Every attempt is different.
⏱ Time limit: 15 minutes. The test submits itself when time runs out.
Levels covered: 0, 1, 2, 3, 4. No hints or solutions until you submit.