0
0
Intro to Computingfundamentals~20 mins

Computer vision basics in Intro to Computing - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Computer Vision Basics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary purpose of image preprocessing in computer vision?
Image preprocessing is a crucial step before feeding images into a model. What is its main goal?
ATo enhance image quality and normalize data for better model performance
BTo increase the image file size for better resolution
CTo convert images into audio signals for analysis
DTo randomly shuffle pixel values to create data augmentation
Attempts:
2 left
💡 Hint
Think about how preparing data helps a model learn better.
🔍 Analysis
intermediate
2:00remaining
What is the output shape after applying a 3x3 convolution with stride 1 and padding 1 on a 28x28 grayscale image?
Given a single grayscale image of size 28x28 pixels, a convolutional layer uses a 3x3 filter, stride 1, and padding 1. What will be the output shape?
Intro to Computing
import torch
import torch.nn as nn

input_tensor = torch.randn(1, 1, 28, 28)  # batch_size=1, channels=1, height=28, width=28
conv = nn.Conv2d(in_channels=1, out_channels=10, kernel_size=3, stride=1, padding=1)
output = conv(input_tensor)
output.shape
Atorch.Size([1, 10, 26, 26])
Btorch.Size([1, 10, 28, 28])
Ctorch.Size([1, 1, 28, 28])
Dtorch.Size([1, 10, 30, 30])
Attempts:
2 left
💡 Hint
Padding of 1 keeps the spatial size same when stride is 1 and kernel size is 3.
Model Choice
advanced
2:00remaining
Which model architecture is best suited for detecting objects at multiple scales in an image?
You want to build a computer vision model that detects objects of various sizes in images. Which architecture is most appropriate?
AA simple fully connected neural network
BA recurrent neural network (RNN)
CA convolutional neural network with feature pyramid networks (FPN)
DA linear regression model
Attempts:
2 left
💡 Hint
Think about architectures designed to handle different object sizes.
Metrics
advanced
2:00remaining
Which metric is most appropriate to evaluate a binary image segmentation model?
You trained a model to segment objects in images (pixel-wise classification). Which metric best measures overlap between predicted and true segments?
AMean Squared Error (MSE)
BPrecision
CAccuracy
DIntersection over Union (IoU)
Attempts:
2 left
💡 Hint
This metric compares the area of overlap to the area of union between prediction and ground truth.
🔍 Analysis
expert
2:00remaining
Why does this CNN training code raise a runtime error?
Examine the code below. It raises a runtime error during training. What is the cause?
Intro to Computing
import torch
import torch.nn as nn

class SimpleCNN(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3, 16, 3)
        self.fc = nn.Linear(16*30*30, 10)
    def forward(self, x):
        x = self.conv(x)
        x = torch.relu(x)
        x = x.view(-1, 16*30*30)
        x = self.fc(x)
        return x

model = SimpleCNN()
input_tensor = torch.randn(4, 3, 32, 32)
output = model(input_tensor)
AThe input to the linear layer has incorrect size due to convolution output shape mismatch
BThe convolution layer has wrong number of input channels
CThe ReLU function is applied incorrectly
DThe batch size is too large for the model
Attempts:
2 left
💡 Hint
Check the size of the tensor after convolution before flattening.