uiz Space

January 2025 term · Deep Learning Practice · BSDA5013

Deep Learning Practice End Term: 13 April 2025 (January 2025 term)

The IIT Madras BS Deep Learning Practice (Deep Learning Practice) End Term paper sat on 13 Apr 2025, in the January 2025 term: 20 questions for 100 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
20
Marks
100
Duration
180 min
MCQ
15
MSQ
5

Updated

Official paper: IIT M FOUNDATION AN EXAM QDF3 13 Apr 2025 · No negative marking.

Question 1

+5 marksOne correct option

Consider the following code snippet for modifying an AlexNet architecture to adapt it for a custom classification task with 10 output classes. Fill in the blank portion with the most appropriate code snippet.

python
import torch
import torch.nn as nn
from torchvision.models import alexnet
class CustomAlexNet(nn.Module):
def __init__(self, num_classes=10):
super(CustomAlexNet, self).__init__()
self.alexnet = alexnet(pretrained=True)
# Blank portion
def forward(self, x):
x = self.alexnet.features(x)
x = self.alexnet.avgpool(x)
x = torch.flatten(x, 1)
x = self.alexnet.classifier(x)
return x
model = CustomAlexNet()

Which of the following code snippets correctly fills the blank portion to modify the AlexNet classifier while preserving the pretrained feature extraction layers?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 2

+5 marksOne correct option

An RGB image of size 227 × 227 × 3 is first converted to grayscale and then passed through a 2D Convolutional Neural Network (CNN) layer with the following parameters:
– Kernel size: 3 × 3
– Stride: 1
– Padding: 1
– Number of filters: 16
What will be the shape of the output feature map?

  1. A

    (227, 227, 3)

  2. B

    (227, 227, 16)

  3. C

    (225, 225, 16)

  4. D

    (114, 114, 16)

Show answer

Correct answer

  • B

    (227, 227, 16)

Question 3

+5 marksOne correct option
  1. A

    0.25

  2. B

    0.29

  3. C

    0.45

  4. D

    0.21

Show answer

Correct answer

  • B

    0.29

Question 4

+5 marksOne correct option

Consider a Convolutional Neural Network (CNN) where the feature map after the convolutional and pooling layers has a shape of (8, 8, 64). This feature map is flattened and connected to a fully connected layer with 256 output neurons.
How many parameters (weights and biases) are in this fully connected layer?

  1. A

    524, 544

  2. B

    65, 536

  3. C

    258, 048

  4. D

    10, 48, 832

Show answer

Correct answer

  • D

    10, 48, 832

Question 5

+5 marksOne correct option

In self-supervised depth estimation, left-right consistency loss is often used to ensure that the depth maps from stereo images agree with each other. Which of the following code snippets correctly implements a left-right consistency loss by reconstructing the left depth map from the right depth map using disparity?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 6

+5 marksOne correct option

In the Fast R-CNN object detection pipeline, which of the following steps is NOT part of the preprocessing process?

  1. A

    Resize the input image to a fixed size.

  2. B

    Extract region proposals using Selective Search.

  3. C

    Apply a Region Proposal Network (RPN) to generate region proposals.

  4. D

    Extract features from the entire image using a CNN backbone before classifying region proposals.

Show answer

Correct answer

  • C

    Apply a Region Proposal Network (RPN) to generate region proposals.

Question 7

+5 marksOne correct option

Consider a deep learning model predicting object bounding box coordinates. The ground truth and predicted coordinates for five bounding boxes are given as follows:

BoxGround Truth (x, y, w, h)Prediction (x, y, w, h)
1(50, 50, 100, 100)(48, 53, 102, 98)
2(30, 40, 80, 90)(35, 38, 78, 92)
3(90, 60, 120, 130)(88, 63, 118, 132)
4(45, 80, 110, 120)(47, 78, 108, 118)
5(70, 90, 95, 105)(73, 92, 98, 102)

The Mean Absolute Error (MAE) is defined as:

MAE=1N∑i=1N14∑j=14∣GTij−Pij∣MAE = \frac{1}{N}\sum_{i=1}^{N}\frac{1}{4}\sum_{j=1}^{4}|GT_{ij} - P_{ij}|

where GTijGT_{ij} and PijP_{ij} are the ground truth and predicted bounding box values for x, y, w, h respectively, and NN is the number of bounding boxes.

What is the MAE (rounded to two decimal places)?

  1. A

    2.00

  2. B

    2.25

  3. C

    2.40

  4. D

    2.75

Show answer

Correct answer

  • C

    2.40

Question 8

+5 marksOne correct option

The following code snippets attempt to implement an Inception module in PyTorch. Identify the correct snippet(s):

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 9

+5 marksOne correct option

LAKDNet is designed to enhance feature extraction and knowledge distillation in deep neural networks. Which of the following best describes its core architectural improvement?

  1. A

    It employs a Dual Attention Mechanism (Spatial and Channel Attention) to improve feature aggregation.

  2. B

    It uses Graph Convolutional Networks (GCNs) to capture hierarchical dependencies in spatial features.

  3. C

    It integrates Recurrent Neural Networks (RNNs) to enhance temporal feature extraction.

  4. D

    It relies on Transformer-based self-attention to capture global contextual dependencies.

Show answer

Correct answer

  • A

    It employs a Dual Attention Mechanism (Spatial and Channel Attention) to improve feature aggregation.

Question 10

+5 marksOne correct option

The following PyTorch code implements a simple Convolutional Neural Network (CNN). However, some of the layers are incomplete. Select the correct option to complete the layers.

python
import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(in_channels=16, out_channels=32, kernel_size=3, stride=1, padding=1)
self.pool = nn.MaxPool2d(kernel_size=2, stride=2)
# Fully Connected (FC) Layer - Missing Part
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = torch.flatten(x, 1) # Flatten feature map
# Missing part
return x
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 11

+5 marksOne correct option

SRGAN is a deep learning-based approach for image super-resolution that improves the perceptual quality of upscaled images. Which of the following best describes the role of the adversarial loss in SRGAN?

  1. A

    It minimizes the pixel-wise difference between the super-resolved and high- resolution images to ensure pixel accuracy.

  2. B

    It encourages the generator to produce high-resolution images that are perceptually similar to real images by fooling the discriminator.

  3. C

    It directly optimizes the Structural Similarity Index (SSIM) to improve texture and detail preservation.

  4. D

    It ensures that the generated high-resolution images have better Peak Signal- to-Noise Ratio (PSNR) compared to traditional interpolation methods.

Show answer

Correct answer

  • B

    It encourages the generator to produce high-resolution images that are perceptually similar to real images by fooling the discriminator.

Question 12

+5 marksOne correct option

In the U-Net architecture, downsampling is performed using pooling layers to reduce spatial dimensions while preserving important features. Which of the following code snippets correctly implement the pooling layer in U-Net?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 13

+5 marksOne correct option

Consider the following code snippet, which generates predictions and ground truth for an object detection task:

python
# Predicted bounding boxes and confidence scores
predictions = [
{'bbox': [40, 40, 90, 90], 'score': 0.85},
{'bbox': [20, 20, 60, 60], 'score': 0.80},
{'bbox': [150, 150, 200, 200], 'score': 0.65},
{'bbox': [250, 250, 300, 300], 'score': 0.50}
]
# Ground truth bounding boxes
ground_truths = [
{'bbox': [40, 40, 90, 90]},
{'bbox': [20, 20, 60, 60]},
{'bbox': [150, 150, 200, 200]}
]
# Function to calculate IoU (Intersection over Union)
def calculate_iou(box1, box2):
x1 = max(box1[0], box2[0])
y1 = max(box1[1], box2[1])
x2 = min(box1[2], box2[2])
y2 = min(box1[3], box2[3])
intersection = max(0, x2 - x1) * max(0, y2 - y1)
area1 = (box1[2] - box1[0]) * (box1[3] - box1[1])
area2 = (box2[2] - box2[0]) * (box2[3] - box2[1])
union = area1 + area2 - intersection
return intersection / union if union > 0 else 0
# Match predictions with ground truths (IoU > 0.5 considered correct)
threshold = 0.5
true_positives = 0
false_positives = 0
false_negatives = len(ground_truths)
for pred in predictions:
matched = False
for gt in ground_truths:
iou = calculate_iou(pred['bbox'], gt['bbox'])
if iou >= threshold:
true_positives += 1
false_negatives -= 1
matched = True
break
if not matched:
false_positives += 1
precision = true_positives / (true_positives + false_positives)
recall = true_positives / (true_positives + false_negatives)
print(f"Precision: {precision:.2f}")
print(f"Recall: {recall:.2f}")

Given the predictions and ground truths, what are the precision and recall values?

  1. A

    Precision: 0.75, Recall: 1.00

  2. B

    Precision: 0.75, Recall: 0.75

  3. C

    Precision: 1.00, Recall: 0.75

  4. D

    Precision: 0.60, Recall: 1.00

Show answer

Correct answer

  • A

    Precision: 0.75, Recall: 1.00

Question 14

+5 marksOne correct option

Consider the following code snippet, which calculates the F1-score for an object detection task:

python
# Predicted labels and ground truth labels
predictions = [1, 1, 0, 1, 0, 0, 1, 0, 1, 1]
ground_truth = [1, 0, 0, 1, 0, 1, 1, 0, 1, 0]
# Confusion matrix components
true_positive = sum([1 for p, g in zip(predictions, ground_truth) if p == 1 and g == 1])
false_positive = sum([1 for p, g in zip(predictions, ground_truth) if p == 1 and g == 0])
false_negative = sum([1 for p, g in zip(predictions, ground_truth) if p == 0 and g == 1])
# Precision and Recall Calculation
precision = true_positive / (true_positive + false_positive) if (true_positive + false_positive) > 0
else 0
recall = true_positive / (true_positive + false_negative) if (true_positive + false_negative) > 0
else 0
# F1-Score Calculation
f1_score = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0
print(f"F1-Score: {f1_score:.2f}")

Given the predictions and ground truth, what is the calculated F1-score?

  1. A

    0.67

  2. B

    0.71

  3. C

    0.73

  4. D

    0.75

Show answer

Correct answer

  • C

    0.73

Question 15

+5 marksOne correct option

In VGGNet, which part of the architecture contributes the most to memory utilization during training, and which part contains the **highest number of parameters?

  1. A

    The early convolutional layers have the highest memory utilization, while the fully connected layers** have the highest number of parameters.

  2. B

    The fully connected layers have the highest memory utilization, while the convolutional layers have the highest number of parameters.

  3. C

    The deeper convolutional layers have the highest memory utilization, while the **pooling layers** have the highest number of parameters.

  4. D

    The batch normalization layers have the highest memory utilization, while the skip connections have the highest number of parameters.

Show answer

Correct answer

  • A

    The early convolutional layers have the highest memory utilization, while the fully connected layers** have the highest number of parameters.

Question 16

+5 marksOne or more correct options

Which of the following code snippets correctly implement Min Pooling in PyTorch?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • B

Question 17

+5 marksOne or more correct options

In deep convolutional neural networks, 1 x 1 convolutions play a significant role in optimizing computation and feature extraction. Which of the following statements correctly describe their role in modern CNN architectures?

Select all that apply.

  1. A

    1 x 1 convolutions can be used to perform dimensionality reduction by reducing the number of channels before applying computationally expensive convolutions.

  2. B

    They introduce non-linearity into the network, even when used without activation functions.

  3. C

    1 x 1 convolutions enable cross-channel interactions by linearly combining feature maps from different channels.

  4. D

    In ResNet architectures, 1 x 1 convolutions are used in bottleneck blocks to match the dimensions when applying skip connections.

  5. E

    When applied after a max pooling layer, 1 x 1 convolutions help recover lost spatial information by increasing the resolution of the feature maps.

Show answer

Correct answers

  • A

    1 x 1 convolutions can be used to perform dimensionality reduction by reducing the number of channels before applying computationally expensive convolutions.

  • C

    1 x 1 convolutions enable cross-channel interactions by linearly combining feature maps from different channels.

  • D

    In ResNet architectures, 1 x 1 convolutions are used in bottleneck blocks to match the dimensions when applying skip connections.

Question 18

+5 marksOne or more correct options

Consider the following PyTorch code snippet for a custom ResNet block.

python
import torch
import torch.nn as nn
class ResNetBlock(nn.Module):
def __init__(self, in_channels, out_channels, stride=1):
super(ResNetBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1,
bias=False)
self.bn1 = nn.BatchNorm2d(out_channels)
self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, stride=1, padding=1,
bias=False)
self.bn2 = nn.BatchNorm2d(out_channels)
self.relu = nn.ReLU(inplace=True)
self.shortcut = nn.Sequential()
if stride != 1 or in_channels != out_channels:
self.shortcut = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False),
nn.BatchNorm2d(out_channels)
)
def forward(self, x):
identity = x # Store residual connection
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
# Missing Code
out = self.relu(out)
return out
model = ResNetBlock(64, 128, stride=2)

Which of the following options correctly fill in the missing code snippet?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answers

  • B
  • C

Question 19

+5 marksOne or more correct options

Estimating depth from a single image using a multiscale deep neural network presents several challenges. Which of the following correctly describe these challenges?

Select all that apply.

  1. A

    Understanding global context and handling variations in scene geometry and textureless regions.

  2. B

    Dealing with scale ambiguity and the lack of absolute depth reference in monocular images.

  3. C

    Reducing computational complexity while matching points across two images.

  4. D

    Handling occlusions and depth discontinuities, especially at object boundaries.

  5. E

    Accurately aligning stereo image pairs and computing disparity for depth estimation.

Show answer

Correct answers

  • A

    Understanding global context and handling variations in scene geometry and textureless regions.

  • B

    Dealing with scale ambiguity and the lack of absolute depth reference in monocular images.

  • D

    Handling occlusions and depth discontinuities, especially at object boundaries.

Question 20

+5 marksOne or more correct options

Monocular depth estimation using a multiscale deep neural network presents several challenges due to the lack of direct depth cues. Which of the following is a primary challenge specific to monocular depth estimation?

Select all that apply.

  1. A

    Handling scale ambiguity and the absence of absolute depth reference in single images.

  2. B

    Accurately computing depth by triangulating matching keypoints between two images.

  3. C

    Estimating depth consistently in textureless regions and under varying lighting conditions.

  4. D

    Using LiDAR or structured light to obtain precise depth values instead of predicting them.

Show answer

Correct answers

  • A

    Handling scale ambiguity and the absence of absolute depth reference in single images.

  • C

    Estimating depth consistently in textureless regions and under varying lighting conditions.