assume target and nerf rgb are inferenced at the same time, slice target batch and nerf batch and aggregate features :param x: image blob (2B x C x H x W) :param upsampleH: New H :param upsampleW: New W :return feature: (2 x B x H x W)
(self, x, upsampleH, upsampleW)
| 398 | self.fc_pose = nn.Linear(1280, feat_dim) |
| 399 | |
| 400 | def _aggregate_feature(self, x, upsampleH, upsampleW): |
| 401 | ''' |
| 402 | assume target and nerf rgb are inferenced at the same time, |
| 403 | slice target batch and nerf batch and aggregate features |
| 404 | :param x: image blob (2B x C x H x W) |
| 405 | :param upsampleH: New H |
| 406 | :param upsampleW: New W |
| 407 | :return feature: (2 x B x H x W) |
| 408 | ''' |
| 409 | batch = x.shape[0] # should be target batch_size + rgb batch_size |
| 410 | feature_t = torch.mean(torch.nn.UpsamplingBilinear2d(size=(upsampleH, upsampleW))(x[:batch//2]), dim=1) |
| 411 | feature_r = torch.mean(torch.nn.UpsamplingBilinear2d(size=(upsampleH, upsampleW))(x[batch//2:]), dim=1) |
| 412 | feature = torch.stack([feature_t, feature_r]) |
| 413 | return feature |
| 414 | |
| 415 | def _aggregate_feature2(self, x): |
| 416 | ''' |
nothing calls this directly
no outgoing calls
no test coverage detected