1
1
from ._base import EncoderMixin
2
- from timm .models .regnet import RegNet
2
+ from timm .models .regnet import RegNet , RegNetCfg
3
3
import torch .nn as nn
4
4
5
5
6
6
class RegNetEncoder (RegNet , EncoderMixin ):
7
7
def __init__ (self , out_channels , depth = 5 , ** kwargs ):
8
+ kwargs ["cfg" ] = RegNetCfg (** kwargs ["cfg" ])
8
9
super ().__init__ (** kwargs )
9
10
self ._depth = depth
10
11
self ._out_channels = out_channels
@@ -141,95 +142,95 @@ def _mcfg(**kwargs):
141
142
"pretrained_settings" : pretrained_settings ["timm-regnetx_002" ],
142
143
"params" : {
143
144
"out_channels" : (3 , 32 , 24 , 56 , 152 , 368 ),
144
- "cfg" : _mcfg (w0 = 24 , wa = 36.44 , wm = 2.49 , group_w = 8 , depth = 13 ),
145
+ "cfg" : _mcfg (w0 = 24 , wa = 36.44 , wm = 2.49 , group_size = 8 , depth = 13 ),
145
146
},
146
147
},
147
148
"timm-regnetx_004" : {
148
149
"encoder" : RegNetEncoder ,
149
150
"pretrained_settings" : pretrained_settings ["timm-regnetx_004" ],
150
151
"params" : {
151
152
"out_channels" : (3 , 32 , 32 , 64 , 160 , 384 ),
152
- "cfg" : _mcfg (w0 = 24 , wa = 24.48 , wm = 2.54 , group_w = 16 , depth = 22 ),
153
+ "cfg" : _mcfg (w0 = 24 , wa = 24.48 , wm = 2.54 , group_size = 16 , depth = 22 ),
153
154
},
154
155
},
155
156
"timm-regnetx_006" : {
156
157
"encoder" : RegNetEncoder ,
157
158
"pretrained_settings" : pretrained_settings ["timm-regnetx_006" ],
158
159
"params" : {
159
160
"out_channels" : (3 , 32 , 48 , 96 , 240 , 528 ),
160
- "cfg" : _mcfg (w0 = 48 , wa = 36.97 , wm = 2.24 , group_w = 24 , depth = 16 ),
161
+ "cfg" : _mcfg (w0 = 48 , wa = 36.97 , wm = 2.24 , group_size = 24 , depth = 16 ),
161
162
},
162
163
},
163
164
"timm-regnetx_008" : {
164
165
"encoder" : RegNetEncoder ,
165
166
"pretrained_settings" : pretrained_settings ["timm-regnetx_008" ],
166
167
"params" : {
167
168
"out_channels" : (3 , 32 , 64 , 128 , 288 , 672 ),
168
- "cfg" : _mcfg (w0 = 56 , wa = 35.73 , wm = 2.28 , group_w = 16 , depth = 16 ),
169
+ "cfg" : _mcfg (w0 = 56 , wa = 35.73 , wm = 2.28 , group_size = 16 , depth = 16 ),
169
170
},
170
171
},
171
172
"timm-regnetx_016" : {
172
173
"encoder" : RegNetEncoder ,
173
174
"pretrained_settings" : pretrained_settings ["timm-regnetx_016" ],
174
175
"params" : {
175
176
"out_channels" : (3 , 32 , 72 , 168 , 408 , 912 ),
176
- "cfg" : _mcfg (w0 = 80 , wa = 34.01 , wm = 2.25 , group_w = 24 , depth = 18 ),
177
+ "cfg" : _mcfg (w0 = 80 , wa = 34.01 , wm = 2.25 , group_size = 24 , depth = 18 ),
177
178
},
178
179
},
179
180
"timm-regnetx_032" : {
180
181
"encoder" : RegNetEncoder ,
181
182
"pretrained_settings" : pretrained_settings ["timm-regnetx_032" ],
182
183
"params" : {
183
184
"out_channels" : (3 , 32 , 96 , 192 , 432 , 1008 ),
184
- "cfg" : _mcfg (w0 = 88 , wa = 26.31 , wm = 2.25 , group_w = 48 , depth = 25 ),
185
+ "cfg" : _mcfg (w0 = 88 , wa = 26.31 , wm = 2.25 , group_size = 48 , depth = 25 ),
185
186
},
186
187
},
187
188
"timm-regnetx_040" : {
188
189
"encoder" : RegNetEncoder ,
189
190
"pretrained_settings" : pretrained_settings ["timm-regnetx_040" ],
190
191
"params" : {
191
192
"out_channels" : (3 , 32 , 80 , 240 , 560 , 1360 ),
192
- "cfg" : _mcfg (w0 = 96 , wa = 38.65 , wm = 2.43 , group_w = 40 , depth = 23 ),
193
+ "cfg" : _mcfg (w0 = 96 , wa = 38.65 , wm = 2.43 , group_size = 40 , depth = 23 ),
193
194
},
194
195
},
195
196
"timm-regnetx_064" : {
196
197
"encoder" : RegNetEncoder ,
197
198
"pretrained_settings" : pretrained_settings ["timm-regnetx_064" ],
198
199
"params" : {
199
200
"out_channels" : (3 , 32 , 168 , 392 , 784 , 1624 ),
200
- "cfg" : _mcfg (w0 = 184 , wa = 60.83 , wm = 2.07 , group_w = 56 , depth = 17 ),
201
+ "cfg" : _mcfg (w0 = 184 , wa = 60.83 , wm = 2.07 , group_size = 56 , depth = 17 ),
201
202
},
202
203
},
203
204
"timm-regnetx_080" : {
204
205
"encoder" : RegNetEncoder ,
205
206
"pretrained_settings" : pretrained_settings ["timm-regnetx_080" ],
206
207
"params" : {
207
208
"out_channels" : (3 , 32 , 80 , 240 , 720 , 1920 ),
208
- "cfg" : _mcfg (w0 = 80 , wa = 49.56 , wm = 2.88 , group_w = 120 , depth = 23 ),
209
+ "cfg" : _mcfg (w0 = 80 , wa = 49.56 , wm = 2.88 , group_size = 120 , depth = 23 ),
209
210
},
210
211
},
211
212
"timm-regnetx_120" : {
212
213
"encoder" : RegNetEncoder ,
213
214
"pretrained_settings" : pretrained_settings ["timm-regnetx_120" ],
214
215
"params" : {
215
216
"out_channels" : (3 , 32 , 224 , 448 , 896 , 2240 ),
216
- "cfg" : _mcfg (w0 = 168 , wa = 73.36 , wm = 2.37 , group_w = 112 , depth = 19 ),
217
+ "cfg" : _mcfg (w0 = 168 , wa = 73.36 , wm = 2.37 , group_size = 112 , depth = 19 ),
217
218
},
218
219
},
219
220
"timm-regnetx_160" : {
220
221
"encoder" : RegNetEncoder ,
221
222
"pretrained_settings" : pretrained_settings ["timm-regnetx_160" ],
222
223
"params" : {
223
224
"out_channels" : (3 , 32 , 256 , 512 , 896 , 2048 ),
224
- "cfg" : _mcfg (w0 = 216 , wa = 55.59 , wm = 2.1 , group_w = 128 , depth = 22 ),
225
+ "cfg" : _mcfg (w0 = 216 , wa = 55.59 , wm = 2.1 , group_size = 128 , depth = 22 ),
225
226
},
226
227
},
227
228
"timm-regnetx_320" : {
228
229
"encoder" : RegNetEncoder ,
229
230
"pretrained_settings" : pretrained_settings ["timm-regnetx_320" ],
230
231
"params" : {
231
232
"out_channels" : (3 , 32 , 336 , 672 , 1344 , 2520 ),
232
- "cfg" : _mcfg (w0 = 320 , wa = 69.86 , wm = 2.0 , group_w = 168 , depth = 23 ),
233
+ "cfg" : _mcfg (w0 = 320 , wa = 69.86 , wm = 2.0 , group_size = 168 , depth = 23 ),
233
234
},
234
235
},
235
236
# regnety
@@ -238,95 +239,95 @@ def _mcfg(**kwargs):
238
239
"pretrained_settings" : pretrained_settings ["timm-regnety_002" ],
239
240
"params" : {
240
241
"out_channels" : (3 , 32 , 24 , 56 , 152 , 368 ),
241
- "cfg" : _mcfg (w0 = 24 , wa = 36.44 , wm = 2.49 , group_w = 8 , depth = 13 , se_ratio = 0.25 ),
242
+ "cfg" : _mcfg (w0 = 24 , wa = 36.44 , wm = 2.49 , group_size = 8 , depth = 13 , se_ratio = 0.25 ),
242
243
},
243
244
},
244
245
"timm-regnety_004" : {
245
246
"encoder" : RegNetEncoder ,
246
247
"pretrained_settings" : pretrained_settings ["timm-regnety_004" ],
247
248
"params" : {
248
249
"out_channels" : (3 , 32 , 48 , 104 , 208 , 440 ),
249
- "cfg" : _mcfg (w0 = 48 , wa = 27.89 , wm = 2.09 , group_w = 8 , depth = 16 , se_ratio = 0.25 ),
250
+ "cfg" : _mcfg (w0 = 48 , wa = 27.89 , wm = 2.09 , group_size = 8 , depth = 16 , se_ratio = 0.25 ),
250
251
},
251
252
},
252
253
"timm-regnety_006" : {
253
254
"encoder" : RegNetEncoder ,
254
255
"pretrained_settings" : pretrained_settings ["timm-regnety_006" ],
255
256
"params" : {
256
257
"out_channels" : (3 , 32 , 48 , 112 , 256 , 608 ),
257
- "cfg" : _mcfg (w0 = 48 , wa = 32.54 , wm = 2.32 , group_w = 16 , depth = 15 , se_ratio = 0.25 ),
258
+ "cfg" : _mcfg (w0 = 48 , wa = 32.54 , wm = 2.32 , group_size = 16 , depth = 15 , se_ratio = 0.25 ),
258
259
},
259
260
},
260
261
"timm-regnety_008" : {
261
262
"encoder" : RegNetEncoder ,
262
263
"pretrained_settings" : pretrained_settings ["timm-regnety_008" ],
263
264
"params" : {
264
265
"out_channels" : (3 , 32 , 64 , 128 , 320 , 768 ),
265
- "cfg" : _mcfg (w0 = 56 , wa = 38.84 , wm = 2.4 , group_w = 16 , depth = 14 , se_ratio = 0.25 ),
266
+ "cfg" : _mcfg (w0 = 56 , wa = 38.84 , wm = 2.4 , group_size = 16 , depth = 14 , se_ratio = 0.25 ),
266
267
},
267
268
},
268
269
"timm-regnety_016" : {
269
270
"encoder" : RegNetEncoder ,
270
271
"pretrained_settings" : pretrained_settings ["timm-regnety_016" ],
271
272
"params" : {
272
273
"out_channels" : (3 , 32 , 48 , 120 , 336 , 888 ),
273
- "cfg" : _mcfg (w0 = 48 , wa = 20.71 , wm = 2.65 , group_w = 24 , depth = 27 , se_ratio = 0.25 ),
274
+ "cfg" : _mcfg (w0 = 48 , wa = 20.71 , wm = 2.65 , group_size = 24 , depth = 27 , se_ratio = 0.25 ),
274
275
},
275
276
},
276
277
"timm-regnety_032" : {
277
278
"encoder" : RegNetEncoder ,
278
279
"pretrained_settings" : pretrained_settings ["timm-regnety_032" ],
279
280
"params" : {
280
281
"out_channels" : (3 , 32 , 72 , 216 , 576 , 1512 ),
281
- "cfg" : _mcfg (w0 = 80 , wa = 42.63 , wm = 2.66 , group_w = 24 , depth = 21 , se_ratio = 0.25 ),
282
+ "cfg" : _mcfg (w0 = 80 , wa = 42.63 , wm = 2.66 , group_size = 24 , depth = 21 , se_ratio = 0.25 ),
282
283
},
283
284
},
284
285
"timm-regnety_040" : {
285
286
"encoder" : RegNetEncoder ,
286
287
"pretrained_settings" : pretrained_settings ["timm-regnety_040" ],
287
288
"params" : {
288
289
"out_channels" : (3 , 32 , 128 , 192 , 512 , 1088 ),
289
- "cfg" : _mcfg (w0 = 96 , wa = 31.41 , wm = 2.24 , group_w = 64 , depth = 22 , se_ratio = 0.25 ),
290
+ "cfg" : _mcfg (w0 = 96 , wa = 31.41 , wm = 2.24 , group_size = 64 , depth = 22 , se_ratio = 0.25 ),
290
291
},
291
292
},
292
293
"timm-regnety_064" : {
293
294
"encoder" : RegNetEncoder ,
294
295
"pretrained_settings" : pretrained_settings ["timm-regnety_064" ],
295
296
"params" : {
296
297
"out_channels" : (3 , 32 , 144 , 288 , 576 , 1296 ),
297
- "cfg" : _mcfg (w0 = 112 , wa = 33.22 , wm = 2.27 , group_w = 72 , depth = 25 , se_ratio = 0.25 ),
298
+ "cfg" : _mcfg (w0 = 112 , wa = 33.22 , wm = 2.27 , group_size = 72 , depth = 25 , se_ratio = 0.25 ),
298
299
},
299
300
},
300
301
"timm-regnety_080" : {
301
302
"encoder" : RegNetEncoder ,
302
303
"pretrained_settings" : pretrained_settings ["timm-regnety_080" ],
303
304
"params" : {
304
305
"out_channels" : (3 , 32 , 168 , 448 , 896 , 2016 ),
305
- "cfg" : _mcfg (w0 = 192 , wa = 76.82 , wm = 2.19 , group_w = 56 , depth = 17 , se_ratio = 0.25 ),
306
+ "cfg" : _mcfg (w0 = 192 , wa = 76.82 , wm = 2.19 , group_size = 56 , depth = 17 , se_ratio = 0.25 ),
306
307
},
307
308
},
308
309
"timm-regnety_120" : {
309
310
"encoder" : RegNetEncoder ,
310
311
"pretrained_settings" : pretrained_settings ["timm-regnety_120" ],
311
312
"params" : {
312
313
"out_channels" : (3 , 32 , 224 , 448 , 896 , 2240 ),
313
- "cfg" : _mcfg (w0 = 168 , wa = 73.36 , wm = 2.37 , group_w = 112 , depth = 19 , se_ratio = 0.25 ),
314
+ "cfg" : _mcfg (w0 = 168 , wa = 73.36 , wm = 2.37 , group_size = 112 , depth = 19 , se_ratio = 0.25 ),
314
315
},
315
316
},
316
317
"timm-regnety_160" : {
317
318
"encoder" : RegNetEncoder ,
318
319
"pretrained_settings" : pretrained_settings ["timm-regnety_160" ],
319
320
"params" : {
320
321
"out_channels" : (3 , 32 , 224 , 448 , 1232 , 3024 ),
321
- "cfg" : _mcfg (w0 = 200 , wa = 106.23 , wm = 2.48 , group_w = 112 , depth = 18 , se_ratio = 0.25 ),
322
+ "cfg" : _mcfg (w0 = 200 , wa = 106.23 , wm = 2.48 , group_size = 112 , depth = 18 , se_ratio = 0.25 ),
322
323
},
323
324
},
324
325
"timm-regnety_320" : {
325
326
"encoder" : RegNetEncoder ,
326
327
"pretrained_settings" : pretrained_settings ["timm-regnety_320" ],
327
328
"params" : {
328
329
"out_channels" : (3 , 32 , 232 , 696 , 1392 , 3712 ),
329
- "cfg" : _mcfg (w0 = 232 , wa = 115.89 , wm = 2.53 , group_w = 232 , depth = 20 , se_ratio = 0.25 ),
330
+ "cfg" : _mcfg (w0 = 232 , wa = 115.89 , wm = 2.53 , group_size = 232 , depth = 20 , se_ratio = 0.25 ),
330
331
},
331
332
},
332
333
}
0 commit comments