Course contentsShow
← Machine Learning and Deep Learning
Lesson 977 of 3,53822. Computer Vision TasksFree lesson

Fully Convolutional Networks (FCN)

Learn how FCNs replace fully connected layers with convolutions to produce spatial outputs for segmentation.

Fully Convolutional Networks (FCN)

What you'll learn: How FCNs adapt classification networks to produce pixel-wise predictions for semantic segmentation by replacing fully connected layers with convolutions.

The Problem with Fully Connected Layers

Traditional CNNs for classification (like AlexNet or VGG) end with fully connected layers that flatten spatial feature maps into fixed-size vectors and output class probabilities. This works great for "what's in the image?" but destroys spatial information needed for "where is each class located at every pixel?"

For segmentation, you need to maintain spatial structure throughout the network to produce an output that's the same height and width as your input image.

The FCN Solution

Fully Convolutional Networks replace fully connected layers with convolutional layers. Here's why this matters:

  • Fully connected layers accept fixed input sizes and produce 1D vectors (spatial information lost)
  • Convolutional layers preserve spatial dimensions and can accept any input size

By converting a classification network's final fully connected layers into 1×1 convolutions, the network can now output a spatial feature map instead of a single vector. This feature map has height and width dimensions that correspond to spatial locations in the original image.

From Features to Predictions

The resulting feature maps are typically smaller than the input (due to pooling/striding). FCNs use upsampling (covered later in your curriculum) to enlarge these feature maps back to the original image size, producing one prediction per pixel.

Think of it like this: instead of asking "is there a cat?" the network now asks "is this specific pixel part of a cat?" for every pixel simultaneously.

Key Takeaway: FCNs eliminate fully connected layers in favor of convolutions, preserving spatial structure throughout the network to enable pixel-wise predictions required for semantic segmentation.