You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dear Professor Huang:
Hello! Is the final XBNBlock-P2 module the following code?
def GroupNorm(num_features, num_groups=32, eps=1e-5, affine=True, *args, **kwargs):
if num_groups>num_features:
print('------arrive maxum groub numbers of:', num_features)
num_groups=num_features
return nn.GroupNorm(num_groups, num_features, eps=eps, affine=affine)
class Bottleneck_XBNBlock_P2(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1, downsample=None):
super(Bottleneck_XBNBlock_P2, self).__init__()
self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=1, bias=False)
self.bn1 = nn.BatchNorm2d(planes)
self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
self.bn2 = GroupNorm(planes)
self.conv3 = nn.Conv2d(planes, planes * 4, kernel_size=1, bias=False)
self.bn3 = nn.BatchNorm2d(planes * 4)
self.relu = nn.ReLU(inplace=True)
self.downsample = downsample
self.stride = stride
def forward(self, x):
residual = x
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out = self.relu(out)
out = self.conv3(out)
out = self.bn3(out)
if self.downsample is not None:
residual = self.downsample(x)
out += residual
out = self.relu(out)
return out
I read your code and only this class matches the module above.
Also, I use the standard Bottleneck in my work: conv 11->bn->relu->conv33->bn->relu. The structure of this Bottleneck is different from the one in your article. Can I replace the bn after 3*3 convolution with BFN(GN)?
Thank you very much.
The text was updated successfully, but these errors were encountered:
Hi, yes, the module you list is the XBNBlock-P2. You can replace the BN (after 33 convolution) with BFN in the standard 'basicBlock' (based on your description, you have only 2 conv, I am not sure whether you forget the other 11 conv), technicually. However, based on my experience on the Bottleneck, it seems that repalce the BN (after 1*1 convolution) with BFN should be better in your standard 'basicBlock'.
Dear Professor Huang:
Hello! Is the final XBNBlock-P2 module the following code?
I read your code and only this class matches the module above.
Also, I use the standard Bottleneck in my work: conv 11->bn->relu->conv33->bn->relu. The structure of this Bottleneck is different from the one in your article. Can I replace the bn after 3*3 convolution with BFN(GN)?
Thank you very much.
The text was updated successfully, but these errors were encountered: