Question 12
Consider the following code snippets used in a multiscale deep network for single-image depth estimation. Both blocks play different roles in the network.
Which of the following best describes the roles of the two blocks?
A. Block A:
import torchimport torch.nn as nn
class DepthNetwork(nn.Module): def __init__(self): super(DepthNetwork, self).__init__() self.encoder = nn.Sequential( nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3), nn.ReLU(), nn.Conv2d(64, 128, kernel_size=5, stride=2, padding=2), nn.ReLU() ) self.fc = nn.Sequential( nn.Linear(128 * 28 * 28, 1024), nn.ReLU(), nn.Linear(1024, 128 * 56 * 56) ) def forward(self, x): x = self.encoder(x) x = x.view(x.size(0), -1) x = self.fc(x) x = x.view(x.size(0), 128, 56, 56) return xB. Block B:
import torchimport torch.nn as nn
class DepthRefinementNetwork(nn.Module): def __init__(self): super(DepthRefinementNetwork, self).__init__() self.refinement = nn.Sequential( nn.Conv2d(131, 64, kernel_size=3, padding=1), nn.ReLU(), nn.Conv2d(64, 1, kernel_size=3, padding=1) )
def forward(self, coarse_depth, rgb): x = torch.cat((coarse_depth, rgb), dim=1) # Concatenate coarse depth and RGB x = self.refinement(x) return xBlock A generates high-level global features and outputs an initial coarse depth map, while Block B refines the depth map using local details from the RGB image and the coarse depth map.
Block A performs refinement of the depth map using concatenated coarse depth and RGB features, while Block B generates the coarse depth map from the input RGB image.
Both Block A and Block B are coarse networks, with Block B performing an additional refinement step.
Block A generates a low-resolution coarse depth map but does not include global features, while Block B produces fine-grained depth without refinement.