ResNeXt-PyTorch icon indicating copy to clipboard operation
ResNeXt-PyTorch copied to clipboard

#27 is right?(conv3x3(planes*2, planes*2, groups=num_group))

Open gjd2017 opened this issue 6 years ago • 6 comments

self.conv2 = conv3x3(planes2, planes2, groups=num_group), add' groups=num_group'?

gjd2017 avatar Sep 17 '18 12:09 gjd2017

I'm assuming he forgot to change conv3x3 to:

def conv3x3(in_planes, out_planes, stride=1, groups=1):
    """3x3 convolution with padding"""
    return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
                     padding=1, bias=False, groups=groups)

Check: https://pytorch.org/docs/stable/nn.html#torch.nn.Conv2d

tuliocasagrande avatar Oct 08 '18 19:10 tuliocasagrande

Having changed the conv3x3, new issue is coming: RuntimeError: The size of tensor a (128) must match the size of tensor b (64) at non-singleton dimension 1 Obviously, the size is not match.

JohnATJ avatar Apr 04 '21 12:04 JohnATJ

I have found that: just change the second conv3x3 of BasicBlock, the dismatch varnishs. From conv3x3(planes*2, planes*2, groups=num_group) to conv3x3(planes*2, planes, groups=num_group). Also, don't forget change the BN planes. That's all. It works.

JohnATJ avatar Apr 04 '21 12:04 JohnATJ

I have found that: just change the second conv3x3 of BasicBlock, the dismatch varnishs. From conv3x3(planes*2, planes*2, groups=num_group) to conv3x3(planes*2, planes, groups=num_group). Also, don't forget change the BN planes. That's all. It works.

这是修改哪里呢?

shiying-sxu avatar Jul 28 '21 09:07 shiying-sxu

I think it can be modified from self.conv2 = conv3x3(planes*2, planes*2, groups=num_group)
to self.conv2 = nn.Conv2d(planes*2, planes*2, kernel_size=3, stride=stride,padding=1, bias=False, groups=num_group) In BasicBlock

lrfighting avatar Aug 26 '21 07:08 lrfighting

Having changed the conv3x3, new issue is coming: RuntimeError: The size of tensor a (128) must match the size of tensor b (64) at non-singleton dimension 1 Obviously, the size is not match.

The reason for the size mismatch is that this code doubles the channel at the first conv3 * 3, change self.conv1 = conv3x3(inplanes, planes*2, stride) to self.conv1 = conv3x3(inplanes, planes, stride)

Having changed the conv3x3, new issue is coming: RuntimeError: The size of tensor a (128) must match the size of tensor b (64) at non-singleton dimension 1 Obviously, the size is not match.

I have a size problem, but I don't know how to solve it The size of tensor a (46) must match the size of tensor b (92) at non-singleton dimension 3 After the second conv3*3, the size become 46 but I didn't find the reason

lrfighting avatar Aug 26 '21 12:08 lrfighting