Consider a 3x3 convolution filter applied to a 5x5 input image with padding='valid' and stride=1. What will be the spatial dimension of the output?
Match each CNN architecture with its main feature:
Architecture with residual connections:
Architecture with inception modules:
Architecture with a simple and deep design:
First successful deep CNN architecture:
Which of the following statements about MobileNet is FALSE?
Select all features that are specific to the U-Net architecture:
Chronologically order the following object detection architectures based on their appearance:
Chronological order (oldest on top):
Complete the following code to implement a 3x3 convolutional layer with 16 filters, stride=1 and 'same' padding using PyTorch:
import torch
import torch.nn as nn
class SimpleCNN(nn.Module):
def __init__(self):
super(SimpleCNN, self).__init__()
self.conv = nn.______(______, kernel_size=______, stride=______, padding=______)
self.pool = nn.MaxPool2d(kernel_size=2, stride=2)
self.flatten = nn.Flatten()
self.fc = nn.Linear(16 * 14 * 14, 10) # Assuming input is 28x28
def forward(self, x):
x = torch.relu(self.conv(x))
x = self.pool(x)
x = self.flatten(x)
x = self.fc(x)
return x
nn.Conv2d
. Use padding=1
with a 3x3 kernel and stride 1 to simulate 'same' padding.
Implement a basic residual block like the one used in ResNet. The block should contain two 3x3 convolutional layers with the same number of filters and a skip connection:
import torch
import torch.nn as nn
import torch.nn.functional as F
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
self.bn1 = nn.BatchNorm2d(channels)
self.conv2 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
self.bn2 = nn.BatchNorm2d(channels)
def forward(self, x):
# Store input for the skip connection
shortcut = x
# First convolutional layer
# Second convolutional layer
# Add skip connection
return y
Complete the following code to implement a depthwise separable convolution block like the one used in MobileNet:
import torch
import torch.nn as nn
import torch.nn.functional as F
class DepthwiseSeparableConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3):
super(DepthwiseSeparableConv, self).__init__()
# Depthwise convolution
self.depthwise = nn.___(___, ___, ___, ___, ___)
# Pointwise convolution
self.pointwise = nn.___(___, ___, ___)
def forward(self, x):
x = F.relu(self.depthwise(x))
x = F.relu(self.pointwise(x))
return x
nn.Conv2d
with groups=in_channels
(depthwise)
2. nn.Conv2d
with kernel_size=1
(pointwise)
This is used to reduce parameters while maintaining performance.
Design a CNN for CIFAR-10 image classification (32x32x3) by dragging and ordering the layers:
CNN Architecture (order top to bottom):
Analyze the following architectures and choose the most suitable one for each use case:
1. Real-time object detection on a mobile device:
2. Accurate tumor segmentation in medical images:
3. High-accuracy image classification without resource constraints:
This certificate certifies that
has successfully completed all interactive exercises of the course.
Date: