MCPcopy Create free account
hub / github.com/MotrixLab/ADHMR / forward

Method forward

ADHMR/lib/models/hrnet.py:527–602  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

525 return nn.Sequential(*modules), num_inchannels
526
527 def forward(self, x):
528 batch_size = x.shape[0]
529 x = self.conv1(x)
530 x = self.bn1(x)
531 x = self.relu(x)
532 x = self.conv2(x)
533 x = self.bn2(x)
534 x = self.relu(x)
535 x = self.layer1(x)
536
537 x_list = []
538 for i in range(self.stage2_cfg['NUM_BRANCHES']):
539 if self.transition1[i] is not None:
540 x_list.append(self.transition1[i](x))
541 else:
542 x_list.append(x)
543 y_list = self.stage2(x_list)
544
545 x_list = []
546 for i in range(self.stage3_cfg['NUM_BRANCHES']):
547 if self.transition2[i] is not None:
548 x_list.append(self.transition2[i](y_list[-1]))
549 else:
550 x_list.append(y_list[i])
551 y_list = self.stage3(x_list)
552
553 x_list = []
554 for i in range(self.stage4_cfg['NUM_BRANCHES']):
555 if self.transition3[i] is not None:
556 x_list.append(self.transition3[i](y_list[-1]))
557 else:
558 x_list.append(y_list[i])
559 y_list = self.stage4(x_list)
560
561
562 y = self.incre_modules[0](y_list[0])
563 for i in range(len(self.downsamp_modules)):
564 y = self.incre_modules[i + 1](y_list[i + 1]) + \
565 self.downsamp_modules[i](y)
566 y_beta = self.final_feat_layer(y)
567 if torch._C._get_tracing_state():
568 feat = y_beta.flatten(start_dim=2).mean(dim=2)
569 else:
570 feat = F.avg_pool2d(y_beta, kernel_size=y_beta.size()
571 [2:]).view(y_beta.size(0), -1)
572
573 if not self.score:
574 delta_shape = self.pred_beta(feat)
575 init_shape = self.init_shape.expand(batch_size, -1)
576 pred_shape = delta_shape + init_shape
577
578
579 fmap = {}
580 # global feature
581 fmap_global = self.fmap_layer(y)
582 fmap['global'] = fmap_global
583
584 # local feature

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected