ResNeXt-PyTorch
ResNeXt-PyTorch copied to clipboard
#27 is right?(conv3x3(planes*2, planes*2, groups=num_group))
self.conv2 = conv3x3(planes2, planes2, groups=num_group), add' groups=num_group'?
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
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 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.
I have found that: just change the second conv3x3 of
BasicBlock
, the dismatch varnishs. Fromconv3x3(planes*2, planes*2, groups=num_group)
toconv3x3(planes*2, planes, groups=num_group)
. Also, don't forget change the BN planes. That's all. It works.
这是修改哪里呢?
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
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