TL;DR
A fully convolutional network is a Convolutional Neural Network with no fully connected layers. Built only from convolutions, it accepts an image of any size and returns a grid of predictions, one for each region of the input, instead of one label for the whole picture. Upsampling layers and skip connections then bring that grid back to the input's resolution, so the network can label every pixel.
Where you'll see it: in segmentation models that outline roads, organs or crops, and in robot-manipulation networks that output a heatmap of where to grasp (see Transporter Network).
Intuition
The classifier ends in a vector
A standard image classifier has two halves. The convolutional layers turn the picture into a stack of feature maps. The fully connected layers then flatten those maps into one long vector and produce a single score per class. The fully connected half needs a fixed input size, so every photo must be cropped or resized to the same shape first. Its output also has no sense of position: the network says "cat", not "cat in the left corner".
Segmentation needs the opposite. It must keep a grid, with an answer at every position. The question is whether the fully connected half can be dropped without losing what it does.
The fully connected layer was a convolution all along
The key observation, made by Jonathan Long, Evan Shelhamer and Trevor Darrell, is that a fully connected layer applied to a feature map is the same computation as a convolution whose kernel covers the whole map. A convolution slides its kernel over a larger input and computes that same dot product at every position. Replace the fully connected layers with convolutions and the network no longer needs a fixed size. Feed it a bigger image and you get a bigger output grid, with the same weights reused at every position.
Each cell of that grid sees a large patch of the image and says what is in it. Cells near a cat score high for "cat", and cells over grass do not. That is a dense prediction: a map of scores that lives in the same spatial layout as the image.
flowchart LR A[Image of any size] --> B[Convolution and pooling stages] B --> C[Coarse grid of class scores] C --> D[Upsample to input size] D --> E[Score per pixel] B -.skip connection.-> D
Coarse first, then fine
Pooling halves the grid several times, so the score grid is coarse. In a VGG-style backbone the cells are 32 pixels apart. That is enough to say where a large object is, but the boundaries are blurry. The fix has two steps. First, upsample the coarse grid back to the input size. Second, add in scores from earlier, finer layers, which still remember where the edges were. The network is then a classifier at every location with a decoder that puts the result back in place.
The math
A fully connected layer is a convolution
Take a feature map with rows, columns and channels. A fully connected layer with outputs computes, for each output ,
A convolution with filters, each of size , computes the same weighted sum. If the input is exactly , the convolution has only one position to slide to, so its output is , identical to the fully connected layer. The weights are literally the same numbers, reshaped.
Now give the convolution a larger input, with and . The filter slides over every valid position and produces
outputs, one fully connected computation per window. This is the whole idea of the fully convolutional network. The layer is still the same layer; it has just been applied to more places.
Output size and upsampling
Suppose the coarse map has stride , meaning each cell is input pixels apart. An input of length gives a coarse map of about cells. To go back up, use a Transposed Convolution with stride , kernel length and padding at each end. Its output length is
Choosing and gives , which is the exact factor-of- enlargement.
Fusing scores from earlier layers
Let be the score map produced by a convolution (a convolution with a single-pixel kernel, which mixes channels at each position and acts like a small dense layer applied to every location) on top of pooling stage . Let denote upsampling by a factor . The version that fuses the stride-32 and stride-16 stages is
The factor 2 aligns the coarse stage with the finer grid of , so they can be added cell by cell. The final upsampling by 16 brings the sum to input resolution. Adding a stride-8 stage in the same way gives the finer version of the model.
Training uses the per-pixel cross-entropy from Image Segmentation, applied to the full-resolution output.
Worked examples
Take a single-channel input and a dense layer with one output. Flatten the input as and use weights . The output is .
Now write the same weights as a kernel, , and convolve it with the same input. The output is the same , because the kernel's elementwise products with the input are the dense layer's products.
- Apply the kernel to a larger input, .
- Top-left window : .
- Top-right window : .
- Bottom-left window : .
- Bottom-right window : .
The output is the map .
Interpretation: the dense layer would reject the input, because it expects exactly four values. The convolution takes it in stride and returns one answer per window, with the same weights. Those four answers are the dense layer's answers on four different patches.
A VGG-style backbone halves the grid five times, with stride 2 each time, so its coarse output has stride 32.
- Coarse grid: . The coarse map is , and each cell covers a patch of the input.
- Upsample with a transposed convolution of kernel , stride and padding : .
- The output is , back at the input size.
- Now reuse the same network on a image. The coarse map becomes , and the upsampled output is again , with no change to the weights.
Interpretation: the network adapts its output to the input size automatically. Each coarse cell is responsible for a block, which is why the boundaries are blurry before fusion.
Take one class, "cat", and a block of stride-16 cells from pool4 whose cat scores are . The stride-32 score from pool5 for the same region is , and upsampling by 2 copies it to all four cells.
- Upsampled pool5 score: .
- Add the pool4 scores: .
- The fused map keeps the variation from pool4, so the cell with score 3.0 is the most likely cat location, while pool5 sets the overall level.
Interpretation: the coarse score says that a cat is probably here. The fine score says where within the block the cat's evidence is strongest. Adding them gives a map with both.
Take a VGG-style backbone whose last pooling stage gives a feature map on inputs. The original classifier has a fully connected layer with 4096 outputs.
- Parameters in that fully connected layer: inputs, and weights. Written as a convolution, it is 4096 filters of size , the same weights.
- Replace the 4096-way classifier with a convolution to 21 classes (PASCAL VOC's 20 object classes plus background). It has weights and 21 biases, parameters in total.
- On a input the backbone gives a grid of 4096 features, and the head gives a score map.
- Upsampling that map to gives one score per class per pixel. Taking the arg-max over the 21 classes gives the segmentation.
Interpretation: the head that dominated the original network's size is still there, unchanged, as a convolution. What changed is that it now runs at every location, so the same weights answer "what is here?" everywhere in the image.
Tradeoffs and failure modes
The fully convolutional design works well when the important information is local and the output needs to match the input's layout. It struggles when the network has to see the whole scene at once, or when fine detail is lost on the way down.
| Situation | Problem | Better choice |
|---|---|---|
| Output taken straight from the stride-32 map | Boundaries are blurry and small objects disappear | Fuse finer stages, as in FCN-16s and FCN-8s, or use U-Net-style skip connections |
| Large objects that exceed the Receptive Field | A cell cannot see the whole object, so its label is unreliable | Dilated convolutions, pyramid pooling, or global context |
| Relations between distant regions matter | Local filters connect far-apart cells only after many layers | Transformer attention over the feature map |
| Learned upsampling gives a grid pattern | Uneven overlap of the transposed kernel | Kernel width divisible by the stride (see Transposed Convolution) |
| Training crops differ in size from test images | Results depend on scale, and objects may look different at a new size | Train on crops close to the test scale, or test on the sizes used in training |
| Very large inputs, such as satellite tiles | Full-resolution feature maps exhaust memory | Run on overlapping tiles and stitch the predictions |
The most common mistake is to judge the model on the coarse grid alone. The grid looks reasonable at a glance while its edges are off by tens of pixels, which only shows up when the output is upsampled and compared with a precise mask.
History
Before 2014, some detection systems had already run a trained classifier convolutionally over larger images. OverFeat, in 2013, is one example. Long, Shelhamer and Darrell made the idea general and central. They took classification networks, including AlexNet and VGG, converted their fully connected layers into convolutions, and fine-tuned them for dense prediction. The paper was posted in late 2014 and presented at CVPR in 2015. It set new results on PASCAL VOC segmentation at the time.
The approach caught on for two reasons. First, it let segmentation reuse the large pretrained weights of classification networks, so a model could start from features learned on ImageNet rather than from scratch. Second, it turned an architecture that had been designed for a single label into one that produced a map, so one network could serve many tasks. The decoder ideas came next: U-Net in 2015 added skip connections from the encoder, and later models refined the upsampling and the context. The fully convolutional pattern is still the default for per-pixel prediction.
Recap
A fully convolutional network replaces the fully connected layers of a classifier with convolutions, which compute the same weighted sums at every position. It therefore takes any input size and outputs a coarse grid of scores. Transposed convolutions upsample that grid, and skip connections from earlier stages restore edges. Training uses the per-pixel loss from Image Segmentation. The same idea reaches beyond labelling: a Transporter Network uses it to output where a robot should grasp. The skip-connection variant that became standard for medical images is the U-Net.
Check yourself
QuestionWhat makes a network fully convolutional, and what does it output for a 320 by 320 image?Show answer
A fully convolutional network has no fully connected layers, so every layer is a convolution, pooling or upsampling. For a 320 by 320 image the coarse output from a stride-32 backbone is a grid, and after upsampling it is a map of per-pixel scores.
QuestionA dense layer takes a feature map. How many weights does each output use, and what convolution gives the same layer?Show answer
Each output uses one weight for every input value, so weights. A convolution with a kernel over the 8 channels, with one filter per output, computes exactly the same sum at a single position, so it is the same layer.
QuestionWhy do FCN-style models add scores from earlier, finer layers instead of upsampling the final map alone?Show answer
The final map has a stride of 32, so each cell covers a large block and the edges within it are lost. Earlier layers have a finer stride and still hold where the edges were. Adding their scores restores fine boundaries that upsampling alone cannot recover.
QuestionYou train on crops and then run the network on a image. What size is the coarse map, and what should you check before trusting the output?Show answer
Halving with floor rounding gives and over five stages, so the coarse map is about , and the output is upsampled back to . Before trusting it, check the scale: objects in the new image may be much larger than the crops the network was trained on, so they can fall outside the receptive field the model learned. Check the outputs on a few images at the test scale.
Sources
- Long, Shelhamer, Darrell, Fully Convolutional Networks for Semantic Segmentation (2015): https://arxiv.org/abs/1411.4038
- Ronneberger, Fischer, Brox, U-Net: Convolutional Networks for Biomedical Image Segmentation (2015): https://arxiv.org/abs/1505.04597
- Image segmentation (Wikipedia)