Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the training code different from the test code? #36

Open
784682065 opened this issue Jul 20, 2021 · 0 comments
Open

Why is the training code different from the test code? #36

784682065 opened this issue Jul 20, 2021 · 0 comments

Comments

@784682065
Copy link

784682065 commented Jul 20, 2021

Thanks for your contribution!
But i still have some questions ,like this !
why training code different from the test code in the cls_head.py's forward method?

   def forward(self, x):
        if not self.fcn_testing:
            if x.ndimension() == 4:
                x = x.unsqueeze(2)
            assert x.shape[1] == self.in_channels
            assert x.shape[2] == self.temporal_feature_size
            assert x.shape[3] == self.spatial_feature_size
            assert x.shape[4] == self.spatial_feature_size
            if self.with_avg_pool:
                x = self.avg_pool(x)
            if self.dropout is not None:
                x = self.dropout(x)
            x = x.view(x.size(0), -1)
            cls_score = self.fc_cls(x)
            return cls_score
        else:
            if self.with_avg_pool:
                x = self.avg_pool(x)
            if self.new_cls is None:
                self.new_cls = nn.Conv3d(self.in_channels, self.num_classes, 1, 1, 0).cuda()
                self.new_cls.weight.copy_(self.fc_cls.weight.unsqueeze(-1).unsqueeze(-1).unsqueeze(-1))
                self.new_cls.bias.copy_(self.fc_cls.bias)
                self.fc_cls = None
            class_map = self.new_cls(x)
            # return class_map.mean([2,3,4])
            return class_map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant