Open wcyy0123 opened 1 year ago
Sorry about the delay in response. X3D uses split batchnorm to compute batchnorm stats with a constant batch size, no matter the actual input batch size. To do so, the input batch size per gpu (BASE_BS_PER_GPU
) should be a multiple of CONST_BN_SIZE
. Please see here: https://github.com/kkahatapitiya/X3D-Multigrid/blob/d63d8fe6210d2b38aa26d71b0062b569687d6be2/train_x3d_kinetics_multigrid.py#L161C50-L161C95
The origin code like this:
def forward(self, x):
if self.training:
n, c, t, h, w = x.shape
x = x.view(n // self.num_splits, c * self.num_splits, t, h, w)
x = self.split_bn(x)
x = x.view(n, c, t, h, w)
else:
x = self.bn(x)
if self.affine:
x = x * self.weight.view((-1, 1, 1, 1))
x = x + self.bias.view((-1, 1, 1, 1))
return x
It is different from the x3d.py
Add these codes to the file
The code can run success, but except the summary, The error report was
I found that the shape of x was (2,3,10,112,112) in the forwad other than (8,3,10,112,112), and I don`t konw why. Do you konw that?