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

Method forward

script/feature/model.py:375–389  ·  view source on GitHub ↗
(self, x, upsampleH=224, upsampleW=224)

Source from the content-addressed store, hash-verified

373 self.encoder = models.vgg19(pretrained=True).features
374
375 def forward(self, x, upsampleH=224, upsampleW=224):
376 feat_out = [] # we only use high level features
377 for i in range(len(self.encoder)):
378 # print("layer {} encoder layer: {}".format(i, self.encoder[i]))
379 x = self.encoder[i](x)
380 if i == 3: # ReLU-4
381 feature = torch.mean(torch.nn.UpsamplingBilinear2d(size=(upsampleH, upsampleW))(x), dim=1)
382 feat_out.append(feature)
383 elif i == 8: # ReLU-9
384 feature = torch.mean(torch.nn.UpsamplingBilinear2d(size=(upsampleH, upsampleW))(x), dim=1)
385 feat_out.append(feature)
386 elif i == 17: # ReLU-18
387 feature = torch.mean(torch.nn.UpsamplingBilinear2d(size=(upsampleH, upsampleW))(x), dim=1)
388 feat_out.append(feature)
389 return feat_out, x
390
391# PoseNet (SE(3)) w/ mobilev2 backbone
392class PoseNetV2(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected