MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / _aggregate_feature

Method _aggregate_feature

script/feature/model.py:400–413  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 '''

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected