@@ -13,19 +13,21 @@ def _cfg(url='', **kwargs):
13
13
return {
14
14
'url' : url ,
15
15
'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 ' ,
17
17
'mean' : IMAGENET_DEFAULT_MEAN , 'std' : IMAGENET_DEFAULT_STD ,
18
18
'first_conv' : 'conv1' , 'classifier' : 'fc' ,
19
19
** kwargs
20
20
}
21
21
22
22
23
23
default_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 = '' ),
26
27
'skresnet50' : _cfg (),
27
28
'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' ),
29
31
}
30
32
31
33
@@ -134,24 +136,10 @@ def forward(self, x):
134
136
135
137
@register_model
136
138
def 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.
151
140
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.
155
143
"""
156
144
default_cfg = default_cfgs ['skresnet18' ]
157
145
sk_kwargs = dict (
@@ -169,17 +157,21 @@ def sksresnet18(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
169
157
170
158
171
159
@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.
174
165
"""
175
- default_cfg = default_cfgs ['skresnet26d ' ]
166
+ default_cfg = default_cfgs ['skresnet34 ' ]
176
167
sk_kwargs = dict (
177
- keep_3x3 = False ,
168
+ min_attn_channels = 16 ,
169
+ attn_reduction = 8 ,
170
+ split_input = True
178
171
)
179
172
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 )
183
175
model .default_cfg = default_cfg
184
176
if pretrained :
185
177
load_pretrained (model , default_cfg , num_classes , in_chans )
@@ -189,11 +181,12 @@ def skresnet26d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
189
181
@register_model
190
182
def skresnet50 (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
191
183
"""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.
194
187
"""
195
188
sk_kwargs = dict (
196
- attn_reduction = 2 ,
189
+ split_input = True ,
197
190
)
198
191
default_cfg = default_cfgs ['skresnet50' ]
199
192
model = ResNet (
@@ -208,11 +201,12 @@ def skresnet50(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
208
201
@register_model
209
202
def skresnet50d (pretrained = False , num_classes = 1000 , in_chans = 3 , ** kwargs ):
210
203
"""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.
213
207
"""
214
208
sk_kwargs = dict (
215
- attn_reduction = 2 ,
209
+ split_input = True ,
216
210
)
217
211
default_cfg = default_cfgs ['skresnet50d' ]
218
212
model = ResNet (
0 commit comments