ResNeSt icon indicating copy to clipboard operation
ResNeSt copied to clipboard

how to write a test code. the splat.py has code error?

Open saladjay opened this issue 4 years ago • 3 comments

using ResNeSt-50 as an example ` from resnest.torch import resnest50 net = resnest50(pretrained=True) import torch

a = torch.ones(1,3,512,512)

net.cuda() net.train()

net(a.cuda()) `

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 32, 1, 1])

i found this error in splat.py in line 65 gap = F.adaptive_avg_pool2d(gap, 1) print(gap.shape) gap = self.fc1(gap) print(gap.shape) if self.use_bn: gap = self.bn1(gap)

after adaptive_avg_pool2d, the shape of tensor is like [n,32,1,1]. And the BN layer can not accept this shape of tensor.

saladjay avatar Apr 26 '20 03:04 saladjay

i dont know how to insert code...hahaha

saladjay avatar Apr 26 '20 03:04 saladjay

sry. that is my fault. close it. i should not use single sample as input

saladjay avatar Apr 26 '20 07:04 saladjay

I pushed an issue just now, is the same problem as yours, I think it is no need to use bn here, cuz bn is somehow channel-wise normalization, thist require more than 1 value per channel.

chrisway613 avatar May 05 '20 06:05 chrisway613