0
0
Computer Visionml~10 mins

FCN (Fully Convolutional Network) in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the necessary PyTorch module for building an FCN model.

Computer Vision
import torch.nn as [1]
Drag options to blanks, or click blank then click option'
Adata
Boptim
Cutils
Dnn
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the optimizer module instead of the neural network module.
Using 'utils' which is unrelated to layers.
2fill in blank
medium

Complete the code to define a convolutional layer with 3 input channels and 64 output channels.

Computer Vision
conv_layer = nn.Conv2d([1], 64, kernel_size=3, padding=1)
Drag options to blanks, or click blank then click option'
A3
B1
C64
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Using the number of output channels as input channels.
Confusing kernel size with input channels.
3fill in blank
hard

Fix the error in the forward method by completing the code to apply the final convolutional layer to the input.

Computer Vision
def forward(self, x):
    x = self.conv_final([1])
    return x
Drag options to blanks, or click blank then click option'
Aself
Bx
Cconv_final
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the layer itself instead of the input tensor.
Using an undefined variable like 'input'.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each class index to its predicted pixel count in the segmentation output.

Computer Vision
pixel_counts = {cls: (pred == [1]).sum().item() for cls in range([2])}
Drag options to blanks, or click blank then click option'
Acls
Bpred
Cnum_classes
Doutput
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing with the prediction tensor instead of the class index.
Using the wrong variable for the range.
5fill in blank
hard

Fill all three blanks to complete the training loop snippet that computes the loss, backpropagates, and updates the model parameters.

Computer Vision
optimizer.zero_grad()
outputs = model(inputs)
loss = criterion(outputs, [1])
loss.[2]()
optimizer.[3]()
Drag options to blanks, or click blank then click option'
Alabels
Bbackward
Cstep
Dinputs
Attempts:
3 left
💡 Hint
Common Mistakes
Using inputs instead of labels for loss calculation.
Forgetting to zero gradients before backward pass.
Calling wrong methods on loss or optimizer.