Quiz Space

Deep Learning Practice · End Term · 22 Dec 2024 · September 2024 term

Question 7: The following code snippets represent different blocks in…

Question 7

+5 marksOne correct option

The following code snippets represent different blocks in the Fast R-CNN pipeline. Identify the correct arrangement of these blocks in the Fast R-CNN architecture:

A. Block A

python
import torch
import torch.nn as nn
class RegionProposal(nn.Module):
def __init__(self, in_channels):
super(RegionProposal, self).__init__()
self.conv = nn.Conv2d(in_channels, 256, kernel_size=3, stride=1, padding=1)
self.cls_layer = nn.Conv2d(256, 18, kernel_size=1)
self.reg_layer = nn.Conv2d(256, 36, kernel_size=1)
def forward(self, x):
features = torch.relu(self.conv(x))
cls_logits = self.cls_layer(features)
reg_deltas = self.reg_layer(features)
return cls_logits, reg_deltas

B. Block B

python
import torchvision.models as models
class FeatureExtractor(nn.Module):
def __init__(self):
super(FeatureExtractor, self).__init__()
vgg = models.vgg16(pretrained=True)
self.features = vgg.features # Use pre-trained VGG16 convolutional layers
def forward(self, x):
return self.features(x)

C. Block C

python
from torchvision.ops import roi_pool
class ROIPooling(nn.Module):
def __init__(self, output_size=(7, 7)):
super(ROIPooling, self).__init__()
self.output_size = output_size
def forward(self, feature_map, proposals):
return roi_pool(feature_map, proposals, output_size=self.output_size)

D. Block D

python
class FullyConnectedHead(nn.Module):
def __init__(self, in_features, num_classes):
super(FullyConnectedHead, self).__init__()
self.fc1 = nn.Linear(in_features, 4096)
self.fc2 = nn.Linear(4096, 4096)
self.cls_score = nn.Linear(4096, num_classes)
self.bbox_pred = nn.Linear(4096, num_classes * 4) # 4 coordinates per class
def forward(self, x):
x = torch.relu(self.fc1(x))
x = torch.relu(self.fc2(x))
cls_logits = self.cls_score(x)
bbox_deltas = self.bbox_pred(x)
return cls_logits, bbox_deltas

Which of the following is the correct arrangement of these blocks in the Fast R-CNN architecture?

  1. A

    B, A, C, D

  2. B

    A, B, C, D

  3. C

    B, C, D, A

  4. D

    C, A, B, D

Show answer

Correct answer

  • A

    B, A, C, D

Question 7 of 20 in the IIT Madras BS Deep Learning Practice (Deep Learning Practice) End Term paper sat on 22 Dec 2024, in the September 2024 term (IIT M DEGREE AN EXAM QDB4 22 Dec 2024). It carries 5 marks.

This question was also asked in

More questions from this paper

  1. Q1Consider the following code snippets for loading and modifying VGGNet-16 and VGGNet-19 architectures for a classificati…
  2. Q2Figure question
  3. Q3Suppose I have an image of size 227×227. Which of the following code snippets correctly implements a Min Pooling operat…
  4. Q4Consider a black-and-white image of dimension 227×227. Which of the following correctly demonstrates a function to flat…
  5. Q5Which of the following code snippets correctly implements the skip connection in ResNet?
  6. Q6Figure question
  7. Q8Which of the following code snippets correctly models the loss function in YOLO?
  8. Q9Consider the following predictions and ground truths for a binary classification problem: - True Positives (TP): 30 - F…
  9. Q10How many convolutional layers are there in the original YOLO architecture?
  10. Q11Consider the following code snippet that calculates the Intersection over Union (IoU) for two bounding boxes: What will…
  11. Q12Consider the following code snippets used in a multiscale deep network for single-image depth estimation. Both blocks p…
  12. Q13Which of the following code snippets correctly implements the downsampling operation in a U-Net architecture?
  13. Q14Consider the following predictions and ground truth values:\ Predictions: [3.0,−0.5, 2.0, 7.0] - Ground Truth: [2.5, 0.…
  14. Q15In a stereo vision system, left-right disparity is used to compute depth by comparing\ corresponding points in the left…
  15. Q16What are the primary roles of the generator and discriminator in a Super-Resolution GAN (SRGAN) architecture?
  16. Q17Which of the following code snippets correctly adds gaussian noise to an image?
  17. Q18What are the benefits of using depthwise and pointwise convolutions (as in depthwise separable convolutions) compared t…
  18. Q19Which of the following code snippets correctly implements the generator for a super- resolution GAN (SRGAN) network?
  19. Q20Which of the following are common use cases of super-resolution using SRGAN?