|
|
|
@ -46,12 +46,12 @@ class SelectiveKernelBasic(nn.Module):
|
|
|
|
|
expansion = 1
|
|
|
|
|
|
|
|
|
|
def __init__(self, inplanes, planes, stride=1, downsample=None, cardinality=1, base_width=64,
|
|
|
|
|
sk_kwargs=None, reduce_first=1, dilation=1, first_dilation=None,
|
|
|
|
|
drop_block=None, drop_path=None, act_layer=nn.ReLU, norm_layer=nn.BatchNorm2d, attn_layer=None):
|
|
|
|
|
sk_kwargs=None, reduce_first=1, dilation=1, first_dilation=None, act_layer=nn.ReLU,
|
|
|
|
|
norm_layer=nn.BatchNorm2d, attn_layer=None, aa_layer=None, drop_block=None, drop_path=None):
|
|
|
|
|
super(SelectiveKernelBasic, self).__init__()
|
|
|
|
|
|
|
|
|
|
sk_kwargs = sk_kwargs or {}
|
|
|
|
|
conv_kwargs = dict(drop_block=drop_block, act_layer=act_layer, norm_layer=norm_layer)
|
|
|
|
|
conv_kwargs = dict(drop_block=drop_block, act_layer=act_layer, norm_layer=norm_layer, aa_layer=aa_layer)
|
|
|
|
|
assert cardinality == 1, 'BasicBlock only supports cardinality of 1'
|
|
|
|
|
assert base_width == 64, 'BasicBlock doest not support changing base width'
|
|
|
|
|
first_planes = planes // reduce_first
|
|
|
|
@ -94,11 +94,12 @@ class SelectiveKernelBottleneck(nn.Module):
|
|
|
|
|
|
|
|
|
|
def __init__(self, inplanes, planes, stride=1, downsample=None,
|
|
|
|
|
cardinality=1, base_width=64, sk_kwargs=None, reduce_first=1, dilation=1, first_dilation=None,
|
|
|
|
|
drop_block=None, drop_path=None, act_layer=nn.ReLU, norm_layer=nn.BatchNorm2d, attn_layer=None):
|
|
|
|
|
act_layer=nn.ReLU, norm_layer=nn.BatchNorm2d, attn_layer=None, aa_layer=None,
|
|
|
|
|
drop_block=None, drop_path=None):
|
|
|
|
|
super(SelectiveKernelBottleneck, self).__init__()
|
|
|
|
|
|
|
|
|
|
sk_kwargs = sk_kwargs or {}
|
|
|
|
|
conv_kwargs = dict(drop_block=drop_block, act_layer=act_layer, norm_layer=norm_layer)
|
|
|
|
|
conv_kwargs = dict(drop_block=drop_block, act_layer=act_layer, norm_layer=norm_layer, aa_layer=aa_layer)
|
|
|
|
|
width = int(math.floor(planes * (base_width / 64)) * cardinality)
|
|
|
|
|
first_planes = width // reduce_first
|
|
|
|
|
outplanes = planes * self.expansion
|
|
|
|
|