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

Method forward

script/feature/model.py:484–509  ·  view source on GitHub ↗

Currently under dev. :param x: image blob () :param return_feature: True to extract features, False only return pose prediction. Really should be isExtractFeature :param isSingleStream: True to inference single img, False to inference two imgs in siemese network fash

(self, x, return_feature=False, isSingleStream=False)

Source from the content-addressed store, hash-verified

482 return feature
483
484 def forward(self, x, return_feature=False, isSingleStream=False):
485 '''
486 Currently under dev.
487 :param x: image blob ()
488 :param return_feature: True to extract features, False only return pose prediction. Really should be isExtractFeature
489 :param isSingleStream: True to inference single img, False to inference two imgs in siemese network fashion
490 '''
491 # pdb.set_trace()
492 feat_out = [] # we only use high level features
493 if self.feature_block == 6:
494 x = self.feature_extractor(x)
495 fe = x.clone() # features to save
496 else:
497 list_x = self.feature_extractor(x)
498 fe = list_x['reduction_'+str(self.feature_block)]
499 x = list_x['reduction_6'] # features to save
500 if return_feature:
501 if isSingleStream:
502 feature = torch.stack([fe])
503 else:
504 feature = self._aggregate_feature2(fe)
505 feat_out.append(feature)
506 x = self.avgpool(x)
507 x = x.reshape(x.size(0), -1)
508 predict = self.fc_pose(x)
509 return feat_out, predict

Callers

nothing calls this directly

Calls 1

_aggregate_feature2Method · 0.95

Tested by

no test coverage detected