Super-resolution is a technique used in computer vision. What is its main goal?
Think about what happens when you zoom into a blurry photo and want it clearer.
Super-resolution aims to create a higher resolution image from a low resolution one by adding details and pixels.
Which of the following model types is most commonly used to perform image super-resolution?
Think about models good at processing images and spatial data.
CNNs are designed to handle image data and are widely used for super-resolution tasks.
Consider this PyTorch code snippet for a super-resolution model. What is the shape of the output tensor?
import torch import torch.nn as nn class SimpleSR(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 64, kernel_size=3, padding=1) self.upsample = nn.PixelShuffle(upscale_factor=2) self.conv_out = nn.Conv2d(16, 3, kernel_size=3, padding=1) def forward(self, x): x = self.conv(x) # shape: (batch, 64, H, W) x = self.upsample(x) # shape: (batch, 16, 2*H, 2*W) x = self.conv_out(x) # shape: (batch, 3, 2*H, 2*W) return x input_tensor = torch.randn(1, 3, 24, 24) model = SimpleSR() output = model(input_tensor) output.shape
PixelShuffle with upscale_factor=2 doubles height and width but reduces channels accordingly.
The input has shape (1,3,24,24). After conv, channels=64. PixelShuffle with factor 2 converts 64 channels to 16 channels and doubles height and width to 48. Then conv_out outputs 3 channels with same height and width.
Which metric is most commonly used to measure the quality of super-resolution images compared to the original high-resolution images?
Think about a metric that compares pixel differences but on a logarithmic scale.
PSNR measures the ratio between the maximum possible power of a signal and the power of corrupting noise, commonly used for image quality assessment in super-resolution.
Given the following training loop for a super-resolution model, why might the loss not decrease during training?
import torch import torch.nn as nn import torch.optim as optim model = nn.Sequential( nn.Conv2d(3, 64, 3, padding=1), nn.ReLU(), nn.Conv2d(64, 3, 3, padding=1) ) criterion = nn.MSELoss() optimizer = optim.Adam(model.parameters(), lr=0.001) input_lr = torch.randn(1, 3, 24, 24) # low-res input target_hr = torch.randn(1, 3, 48, 48) # high-res target for epoch in range(5): optimizer.zero_grad() output = model(input_lr) loss = criterion(output, target_hr) loss.backward() optimizer.step() print(f"Epoch {epoch+1}, Loss: {loss.item():.4f}")
Check if the model output size matches the target size for loss calculation.
The model outputs a tensor with shape (1,3,24,24) but the target is (1,3,48,48). This mismatch means the loss compares tensors of different sizes, preventing meaningful learning.