๐Ÿ”ฅLimited Offer: Get 50% OFFon AI & Full Stack Courses๐Ÿ”ฅ
Back to Deep Learning Notes
Topic #204

FCN (Fully Convolutional Network)

The Fully Convolutional Network (FCN) was the architecture that made modern semantic segmentation practical โ€” by replacing a classification CNN's fully-connected layers with convolutional ones, preserving spatial structure all the way to the output.

The Problem It Solved

Standard classification CNNs deliberately discard spatial information via flattening or Global Average Pooling before their final fully-connected layers (see Flattening) โ€” exactly the opposite of what segmentation needs, which is a full-resolution, per-pixel output. FCN asked: what if the network stayed fully convolutional throughout, never discarding spatial structure at all?

Key Innovation: Replacing FC Layers with Convolutions, Then Upsampling

FCN takes a standard classification backbone (like VGG) and replaces its fully-connected layers with equivalent convolutional layers, keeping the network's output spatial (though at a much lower resolution than the original input, due to the pooling/stride operations along the way). It then upsamples this low-resolution output back to the original input's spatial size โ€” commonly via transposed convolution (sometimes loosely called "deconvolution"), a learnable operation that increases spatial resolution, in some sense the reverse of standard convolution's typical size reduction.

Diagram

Input Conv layers (downsample) Upsampling Output per-pixel segmentation map, same size as input

The network downsamples via standard convolution/pooling, then upsamples back to the original resolution to produce a per-pixel output map.

Code โ€” A Simplified Sketch

import torch.nn as nn

class SimpleFCN(nn.Module):
    def __init__(self, num_classes):
        super().__init__()
        self.encoder = nn.Sequential(
            nn.Conv2d(3, 64, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
            nn.Conv2d(64, 128, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
        )
        self.upsample = nn.ConvTranspose2d(128, num_classes, kernel_size=4, stride=4)

    def forward(self, x):
        features = self.encoder(x)   # downsampled spatially
        return self.upsample(features)   # upsampled back to (roughly) the original size

Advantages and Limitations

AdvantagesLimitations
First architecture to make dense, per-pixel prediction practical using a standard CNN backboneDirect upsampling from a heavily downsampled feature map can lose fine spatial detail
Adaptable to any classification backbone by simply replacing its final layersLater architectures (like U-Net, next note) improved on FCN's detail-preservation with skip connections

Common Mistakes

  • Assuming any upsampling method (like simple interpolation) is equivalent to FCN's learnable transposed convolution โ€” a learnable upsampling operation can recover more useful detail than a purely fixed, non-learned resizing method.

Interview Relevance

Q: "What was FCN's key architectural change compared to a standard classification CNN?" It replaced the classification network's fully-connected layers with convolutional ones, keeping the entire network spatial throughout, and added a learnable upsampling step (transposed convolution) to restore the heavily downsampled feature map back to the original input's resolution โ€” producing a genuine per-pixel output map instead of a single whole-image label.

Practice Question

Why does FCN need an upsampling step at all, rather than simply keeping every layer at the original input resolution throughout the network?

Want to go beyond the notes?

Join CodingNow 2.0's Deep Learning course โ€” live mentorship, real projects, and 100% placement support.

Enroll Now โ€” Free Demo Available

FCN (Fully Convolutional Network) โ€“ FAQs

Quick answers about learning FCN (Fully Convolutional Network) in Deep Learning.

This free note from CodingNow 2.0 explains FCN (Fully Convolutional Network) in Deep Learning โ€” concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Deep Learning topic on CodingNow 2.0, including FCN (Fully Convolutional Network), is 100% free with no signup required.
With focused practice, most students grasp FCN (Fully Convolutional Network) in 1โ€“3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) โ€” expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now