@@ -13,19 +13,21 @@ def _cfg(url='', **kwargs):
1313 return {
1414 'url' : url ,
1515 'num_classes' : 1000 , 'input_size' : (3 , 224 , 224 ), 'pool_size' : (7 , 7 ),
16- 'crop_pct' : 0.875 , 'interpolation' : 'bilinear ' ,
16+ 'crop_pct' : 0.875 , 'interpolation' : 'bicubic ' ,
1717 'mean' : IMAGENET_DEFAULT_MEAN , 'std' : IMAGENET_DEFAULT_STD ,
1818 'first_conv' : 'conv1' , 'classifier' : 'fc' ,
1919 ** kwargs
2020 }
2121
2222
2323default_cfgs = {
24- 'skresnet18' : _cfg (url = '' ),
25- 'skresnet26d' : _cfg (),
24+ 'skresnet18' : _cfg (
25+ url = 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/skresnet18_ra-4eec2804.pth' ),
26+ 'skresnet34' : _cfg (url = '' ),
2627 'skresnet50' : _cfg (),
2728 'skresnet50d' : _cfg (),
28- 'skresnext50_32x4d' : _cfg (),
29+ 'skresnext50_32x4d' : _cfg (
30+ url = 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/skresnext50_ra-f40e40bf.pth' ),
2931}
3032
3133
@@ -134,24 +136,10 @@ def forward(self, x):
134136
135137@register_model
136138def skresnet18 (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
137- """Constructs a ResNet-18 model.
138- """
139- default_cfg = default_cfgs ['skresnet18' ]
140- sk_kwargs = dict (
141- min_attn_channels = 16 ,
142- )
143- model = ResNet (
144- SelectiveKernelBasic , [2 , 2 , 2 , 2 ], num_classes = num_classes , in_chans = in_chans ,
145- block_args = dict (sk_kwargs = sk_kwargs ), ** kwargs )
146- model .default_cfg = default_cfg
147- if pretrained :
148- load_pretrained (model , default_cfg , num_classes , in_chans )
149- return model
150-
139+ """Constructs a Selective Kernel ResNet-18 model.
151140
152- @register_model
153- def sksresnet18 (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
154- """Constructs a ResNet-18 model.
141+ Different from configs in Select Kernel paper or "Compounding the Performance Improvements..." this
142+ variation splits the input channels to the selective convolutions to keep param count down.
155143 """
156144 default_cfg = default_cfgs ['skresnet18' ]
157145 sk_kwargs = dict (
@@ -169,17 +157,21 @@ def sksresnet18(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
169157
170158
171159@register_model
172- def skresnet26d (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
173- """Constructs a ResNet-26 model.
160+ def skresnet34 (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
161+ """Constructs a Selective Kernel ResNet-34 model.
162+
163+ Different from configs in Select Kernel paper or "Compounding the Performance Improvements..." this
164+ variation splits the input channels to the selective convolutions to keep param count down.
174165 """
175- default_cfg = default_cfgs ['skresnet26d ' ]
166+ default_cfg = default_cfgs ['skresnet34 ' ]
176167 sk_kwargs = dict (
177- keep_3x3 = False ,
168+ min_attn_channels = 16 ,
169+ attn_reduction = 8 ,
170+ split_input = True
178171 )
179172 model = ResNet (
180- SelectiveKernelBottleneck , [2 , 2 , 2 , 2 ], stem_width = 32 , stem_type = 'deep' , avg_down = True ,
181- num_classes = num_classes , in_chans = in_chans , block_args = dict (sk_kwargs = sk_kwargs ), zero_init_last_bn = False
182- ** kwargs )
173+ SelectiveKernelBasic , [3 , 4 , 6 , 3 ], num_classes = num_classes , in_chans = in_chans ,
174+ block_args = dict (sk_kwargs = sk_kwargs ), zero_init_last_bn = False , ** kwargs )
183175 model .default_cfg = default_cfg
184176 if pretrained :
185177 load_pretrained (model , default_cfg , num_classes , in_chans )
@@ -189,11 +181,12 @@ def skresnet26d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
189181@register_model
190182def skresnet50 (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
191183 """Constructs a Select Kernel ResNet-50 model.
192- Based on config in "Compounding the Performance Improvements of Assembled Techniques in a
193- Convolutional Neural Network"
184+
185+ Different from configs in Select Kernel paper or "Compounding the Performance Improvements..." this
186+ variation splits the input channels to the selective convolutions to keep param count down.
194187 """
195188 sk_kwargs = dict (
196- attn_reduction = 2 ,
189+ split_input = True ,
197190 )
198191 default_cfg = default_cfgs ['skresnet50' ]
199192 model = ResNet (
@@ -208,11 +201,12 @@ def skresnet50(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
208201@register_model
209202def skresnet50d (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
210203 """Constructs a Select Kernel ResNet-50-D model.
211- Based on config in "Compounding the Performance Improvements of Assembled Techniques in a
212- Convolutional Neural Network"
204+
205+ Different from configs in Select Kernel paper or "Compounding the Performance Improvements..." this
206+ variation splits the input channels to the selective convolutions to keep param count down.
213207 """
214208 sk_kwargs = dict (
215- attn_reduction = 2 ,
209+ split_input = True ,
216210 )
217211 default_cfg = default_cfgs ['skresnet50d' ]
218212 model = ResNet (
0 commit comments