Bird
Raised Fist0
Computer Visionml~20 mins

FCN (Fully Convolutional Network) in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
FCN Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main advantage of using an FCN for image segmentation?

Fully Convolutional Networks (FCNs) are popular for image segmentation tasks. What is the key advantage of using an FCN compared to traditional CNNs with fully connected layers?

AFCNs can take input images of any size and produce correspondingly sized output segmentation maps.
BFCNs require less training data because they use fully connected layers.
CFCNs always run faster because they use fewer convolutional layers.
DFCNs use fully connected layers to improve classification accuracy.
Attempts:
2 left
💡 Hint

Think about how FCNs handle input size and output size compared to traditional CNNs.

❓ Predict Output
intermediate
2:00remaining
Output shape of an FCN layer

Consider an input tensor of shape (batch_size=1, channels=3, height=64, width=64) passed through a convolutional layer in an FCN with 16 filters, kernel size 3, stride 1, and padding 1. What will be the output shape?

Computer Vision
import torch
import torch.nn as nn

input_tensor = torch.randn(1, 3, 64, 64)
conv_layer = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1)
output = conv_layer(input_tensor)
output.shape
Atorch.Size([1, 16, 66, 66])
Btorch.Size([1, 16, 62, 62])
Ctorch.Size([1, 3, 64, 64])
Dtorch.Size([1, 16, 64, 64])
Attempts:
2 left
💡 Hint

Recall how padding affects output size in convolution layers.

❓ Model Choice
advanced
2:00remaining
Choosing the correct FCN architecture for semantic segmentation

You want to build an FCN for semantic segmentation on a dataset with 10 classes. Which architecture choice is best to produce pixel-wise class predictions?

AUse convolutional layers followed by fully connected layers to output a single class label per image.
BUse convolutional layers only, ending with a 1x1 convolution layer with 10 filters to output class scores per pixel.
CUse fully connected layers only to output a 10-dimensional vector for each pixel.
DUse convolutional layers with max pooling but no upsampling layers.
Attempts:
2 left
💡 Hint

Think about how to get class scores for each pixel in the input image.

❓ Hyperparameter
advanced
2:00remaining
Effect of upsampling method in FCN output quality

In an FCN, which upsampling method is most likely to produce smoother and more accurate segmentation maps?

ABilinear interpolation upsampling
BNearest neighbor upsampling
CMax pooling
DStrided convolution downsampling
Attempts:
2 left
💡 Hint

Consider which method interpolates pixel values smoothly.

❓ Metrics
expert
2:00remaining
Choosing the best metric for evaluating FCN segmentation output

You trained an FCN for semantic segmentation. Which metric best measures how well the predicted segmentation matches the ground truth at the pixel level?

AAccuracy (percentage of correctly classified pixels)
BMean Squared Error (MSE) between predicted and true pixel values
CIntersection over Union (IoU) per class averaged over all classes
DPrecision of the predicted class labels ignoring spatial location
Attempts:
2 left
💡 Hint

Think about a metric that balances false positives and false negatives per class.

Practice

(1/5)
1. What is the main advantage of a Fully Convolutional Network (FCN) compared to a traditional CNN for image tasks?
easy
A. It can label every pixel in the image, preserving spatial information.
B. It uses fully connected layers to improve classification accuracy.
C. It reduces the image size to a single vector for faster processing.
D. It only works with grayscale images for simplicity.

Solution

  1. Step 1: Understand FCN structure

    FCNs replace fully connected layers with convolution layers to keep spatial info.
  2. Step 2: Compare with traditional CNNs

    Traditional CNNs use fully connected layers that lose pixel location details, FCNs keep pixel-wise info.
  3. Final Answer:

    It can label every pixel in the image, preserving spatial information. -> Option A
  4. Quick Check:

    FCN labels pixels = B [OK]
Hint: FCNs keep pixel info; CNNs lose it with fully connected layers [OK]
Common Mistakes:
  • Thinking FCNs use fully connected layers
  • Assuming FCNs reduce image to vector
  • Believing FCNs only work on grayscale
2. Which of the following is the correct way to replace a fully connected layer with a convolutional layer in an FCN?
easy
A. nn.Linear(in_features, out_features)
B. nn.ReLU()
C. nn.Conv2d(in_channels, out_channels, kernel_size=1)
D. nn.MaxPool2d(kernel_size=2)

Solution

  1. Step 1: Identify layer types

    Fully connected layers are replaced by 1x1 convolution layers to keep spatial size.
  2. Step 2: Match correct PyTorch layer

    nn.Conv2d with kernel size 1 acts like a fully connected layer per pixel.
  3. Final Answer:

    nn.Conv2d(in_channels, out_channels, kernel_size=1) -> Option C
  4. Quick Check:

    1x1 conv replaces FC layer = D [OK]
Hint: Use 1x1 conv to replace fully connected layers [OK]
Common Mistakes:
  • Choosing nn.Linear which is fully connected
  • Confusing pooling or activation layers as replacements
  • Using wrong kernel sizes
3. Given this PyTorch FCN snippet, what is the output shape if the input is (1, 3, 64, 64)?
import torch
import torch.nn as nn

class SimpleFCN(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 16, 3, padding=1)
        self.conv2 = nn.Conv2d(16, 2, 1)
    def forward(self, x):
        x = self.conv1(x)
        x = self.conv2(x)
        return x

model = SimpleFCN()
input_tensor = torch.randn(1, 3, 64, 64)
output = model(input_tensor)
print(output.shape)
medium
A. (1, 2, 64, 64)
B. (1, 2, 62, 62)
C. (1, 16, 64, 64)
D. (1, 3, 64, 64)

Solution

  1. Step 1: Analyze first conv layer

    Conv2d(3,16,3,padding=1) keeps spatial size 64x64, output shape (1,16,64,64).
  2. Step 2: Analyze second conv layer

    Conv2d(16,2,1) with kernel size 1 keeps spatial size, output shape (1,2,64,64).
  3. Final Answer:

    (1, 2, 64, 64) -> Option A
  4. Quick Check:

    Padding keeps size; 1x1 conv keeps size = A [OK]
Hint: Padding keeps size; 1x1 conv keeps spatial dims [OK]
Common Mistakes:
  • Ignoring padding effect on size
  • Assuming kernel 3 reduces size without padding
  • Confusing channel and spatial dimensions
4. You have an FCN model but the output size is smaller than the input image size. What is the most likely cause?
medium
A. Using 1x1 convolution layers increases spatial size.
B. Using convolution layers without padding reduces spatial size.
C. Using fully connected layers preserves spatial size.
D. Using batch normalization layers reduces spatial size.

Solution

  1. Step 1: Understand convolution padding effect

    Convolution without padding shrinks spatial dimensions because kernel slides inside image.
  2. Step 2: Identify cause of smaller output

    If output is smaller, likely padding is missing in conv layers causing shrinkage.
  3. Final Answer:

    Using convolution layers without padding reduces spatial size. -> Option B
  4. Quick Check:

    No padding shrinks output = A [OK]
Hint: No padding in conv layers shrinks output size [OK]
Common Mistakes:
  • Thinking 1x1 conv changes size
  • Believing batch norm affects size
  • Assuming fully connected layers keep spatial size
5. You want to build an FCN for semantic segmentation on 128x128 images with 3 classes. Which architecture choice will produce output matching input size with class scores per pixel?
hard
A. Use fully connected layers after conv layers to classify whole image.
B. Use conv layers without padding and max pooling layers to reduce size.
C. Use conv layers with stride=2 and no upsampling layers.
D. Use conv layers with padding=1 and 1x1 conv at end, no pooling layers.

Solution

  1. Step 1: Maintain spatial size

    Padding=1 with kernel size 3 keeps spatial size; no pooling avoids shrinking.
  2. Step 2: Output class scores per pixel

    Use 1x1 conv with out_channels=3 to get class scores per pixel matching input size.
  3. Final Answer:

    Use conv layers with padding=1 and 1x1 conv at end, no pooling layers. -> Option D
  4. Quick Check:

    Padding + 1x1 conv = pixel-wise classes = C [OK]
Hint: Keep padding and no pooling for same size output [OK]
Common Mistakes:
  • Using pooling reduces output size
  • Using fully connected layers loses pixel info
  • Using stride>1 without upsampling shrinks output
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard