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

Method forward

script/feature/model.py:428–452  ·  view source on GitHub ↗

Currently under dev. :param x: image blob () :param upsampleH: New H obsolete :param upsampleW: New W obsolete :param isTrain: True to extract features, False only return pose prediction. Really should be isExtractFeature :param isSingleStrea: True to

(self, x, upsampleH=224, upsampleW=224, isTrain=False, isSingleStream=False)

Source from the content-addressed store, hash-verified

426 return feature
427
428 def forward(self, x, upsampleH=224, upsampleW=224, isTrain=False, isSingleStream=False):
429 '''
430 Currently under dev.
431 :param x: image blob ()
432 :param upsampleH: New H obsolete
433 :param upsampleW: New W obsolete
434 :param isTrain: True to extract features, False only return pose prediction. Really should be isExtractFeature
435 :param isSingleStrea: True to inference single img, False to inference two imgs in siemese network fashion
436 '''
437 feat_out = [] # we only use high level features
438 for i in range(len(self.feature_extractor)):
439 # print("layer {} encoder layer: {}".format(i, self.feature_extractor[i]))
440 x = self.feature_extractor[i](x)
441
442 if isTrain: # collect aggregate features
443 if i >= 17 and i <= 17: # 17th block
444 if isSingleStream:
445 feature = torch.stack([x])
446 else:
447 feature = self._aggregate_feature2(x)
448 feat_out.append(feature)
449 x = self.avgpool(x)
450 x = x.reshape(x.size(0), -1)
451 predict = self.fc_pose(x)
452 return feat_out, predict
453
454class EfficientNetB3(nn.Module):
455 ''&#x27; EfficientNet-B3 backbone,

Callers

nothing calls this directly

Calls 1

_aggregate_feature2Method · 0.95

Tested by

no test coverage detected