2828# https://github.com/stigma0617/VoVNet.pytorch/blob/master/models_vovnet/vovnet.py
2929model_cfgs = dict (
3030 vovnet39a = dict (
31- stem_ch = [64 , 64 , 128 ],
32- stage_conv_ch = [128 , 160 , 192 , 224 ],
33- stage_out_ch = [256 , 512 , 768 , 1024 ],
31+ stem_chs = [64 , 64 , 128 ],
32+ stage_conv_chs = [128 , 160 , 192 , 224 ],
33+ stage_out_chs = [256 , 512 , 768 , 1024 ],
3434 layer_per_block = 5 ,
3535 block_per_stage = [1 , 1 , 2 , 2 ],
3636 residual = False ,
3737 depthwise = False ,
3838 attn = '' ,
3939 ),
4040 vovnet57a = dict (
41- stem_ch = [64 , 64 , 128 ],
42- stage_conv_ch = [128 , 160 , 192 , 224 ],
43- stage_out_ch = [256 , 512 , 768 , 1024 ],
41+ stem_chs = [64 , 64 , 128 ],
42+ stage_conv_chs = [128 , 160 , 192 , 224 ],
43+ stage_out_chs = [256 , 512 , 768 , 1024 ],
4444 layer_per_block = 5 ,
4545 block_per_stage = [1 , 1 , 4 , 3 ],
4646 residual = False ,
4949
5050 ),
5151 ese_vovnet19b_slim_dw = dict (
52- stem_ch = [64 , 64 , 64 ],
53- stage_conv_ch = [64 , 80 , 96 , 112 ],
54- stage_out_ch = [112 , 256 , 384 , 512 ],
52+ stem_chs = [64 , 64 , 64 ],
53+ stage_conv_chs = [64 , 80 , 96 , 112 ],
54+ stage_out_chs = [112 , 256 , 384 , 512 ],
5555 layer_per_block = 3 ,
5656 block_per_stage = [1 , 1 , 1 , 1 ],
5757 residual = True ,
6060
6161 ),
6262 ese_vovnet19b_dw = dict (
63- stem_ch = [64 , 64 , 64 ],
64- stage_conv_ch = [128 , 160 , 192 , 224 ],
65- stage_out_ch = [256 , 512 , 768 , 1024 ],
63+ stem_chs = [64 , 64 , 64 ],
64+ stage_conv_chs = [128 , 160 , 192 , 224 ],
65+ stage_out_chs = [256 , 512 , 768 , 1024 ],
6666 layer_per_block = 3 ,
6767 block_per_stage = [1 , 1 , 1 , 1 ],
6868 residual = True ,
6969 depthwise = True ,
7070 attn = 'ese' ,
7171 ),
7272 ese_vovnet19b_slim = dict (
73- stem_ch = [64 , 64 , 128 ],
74- stage_conv_ch = [64 , 80 , 96 , 112 ],
75- stage_out_ch = [112 , 256 , 384 , 512 ],
73+ stem_chs = [64 , 64 , 128 ],
74+ stage_conv_chs = [64 , 80 , 96 , 112 ],
75+ stage_out_chs = [112 , 256 , 384 , 512 ],
7676 layer_per_block = 3 ,
7777 block_per_stage = [1 , 1 , 1 , 1 ],
7878 residual = True ,
7979 depthwise = False ,
8080 attn = 'ese' ,
8181 ),
8282 ese_vovnet19b = dict (
83- stem_ch = [64 , 64 , 128 ],
84- stage_conv_ch = [128 , 160 , 192 , 224 ],
85- stage_out_ch = [256 , 512 , 768 , 1024 ],
83+ stem_chs = [64 , 64 , 128 ],
84+ stage_conv_chs = [128 , 160 , 192 , 224 ],
85+ stage_out_chs = [256 , 512 , 768 , 1024 ],
8686 layer_per_block = 3 ,
8787 block_per_stage = [1 , 1 , 1 , 1 ],
8888 residual = True ,
9191
9292 ),
9393 ese_vovnet39b = dict (
94- stem_ch = [64 , 64 , 128 ],
95- stage_conv_ch = [128 , 160 , 192 , 224 ],
96- stage_out_ch = [256 , 512 , 768 , 1024 ],
94+ stem_chs = [64 , 64 , 128 ],
95+ stage_conv_chs = [128 , 160 , 192 , 224 ],
96+ stage_out_chs = [256 , 512 , 768 , 1024 ],
9797 layer_per_block = 5 ,
9898 block_per_stage = [1 , 1 , 2 , 2 ],
9999 residual = True ,
100100 depthwise = False ,
101101 attn = 'ese' ,
102102 ),
103103 ese_vovnet57b = dict (
104- stem_ch = [64 , 64 , 128 ],
105- stage_conv_ch = [128 , 160 , 192 , 224 ],
106- stage_out_ch = [256 , 512 , 768 , 1024 ],
104+ stem_chs = [64 , 64 , 128 ],
105+ stage_conv_chs = [128 , 160 , 192 , 224 ],
106+ stage_out_chs = [256 , 512 , 768 , 1024 ],
107107 layer_per_block = 5 ,
108108 block_per_stage = [1 , 1 , 4 , 3 ],
109109 residual = True ,
112112
113113 ),
114114 ese_vovnet99b = dict (
115- stem_ch = [64 , 64 , 128 ],
116- stage_conv_ch = [128 , 160 , 192 , 224 ],
117- stage_out_ch = [256 , 512 , 768 , 1024 ],
115+ stem_chs = [64 , 64 , 128 ],
116+ stage_conv_chs = [128 , 160 , 192 , 224 ],
117+ stage_out_chs = [256 , 512 , 768 , 1024 ],
118118 layer_per_block = 5 ,
119119 block_per_stage = [1 , 3 , 9 , 3 ],
120120 residual = True ,
121121 depthwise = False ,
122122 attn = 'ese' ,
123123 ),
124124 eca_vovnet39b = dict (
125- stem_ch = [64 , 64 , 128 ],
126- stage_conv_ch = [128 , 160 , 192 , 224 ],
127- stage_out_ch = [256 , 512 , 768 , 1024 ],
125+ stem_chs = [64 , 64 , 128 ],
126+ stage_conv_chs = [128 , 160 , 192 , 224 ],
127+ stage_out_chs = [256 , 512 , 768 , 1024 ],
128128 layer_per_block = 5 ,
129129 block_per_stage = [1 , 1 , 2 , 2 ],
130130 residual = True ,
131131 depthwise = False ,
132132 attn = 'eca' ,
133133 ),
134134)
135+ model_cfgs ['ese_vovnet39b_evos' ] = model_cfgs ['ese_vovnet39b' ]
136+ model_cfgs ['ese_vovnet99b_iabn' ] = model_cfgs ['ese_vovnet99b' ]
135137
136138
137139def _cfg (url = '' ):
@@ -154,6 +156,8 @@ def _cfg(url=''):
154156 ese_vovnet57b = _cfg (url = '' ),
155157 ese_vovnet99b = _cfg (url = '' ),
156158 eca_vovnet39b = _cfg (url = '' ),
159+ ese_vovnet39b_evos = _cfg (url = '' ),
160+ eee_vovnet99b_iabn = _cfg (url = '' ),
157161)
158162
159163
@@ -277,33 +281,33 @@ def __init__(self, cfg, in_chans=3, num_classes=1000, global_pool='avg', drop_ra
277281 self .drop_rate = drop_rate
278282 assert stem_stride in (4 , 2 )
279283
280- stem_ch = cfg ["stem_ch " ]
281- stage_conv_ch = cfg ["stage_conv_ch " ]
282- stage_out_ch = cfg ["stage_out_ch " ]
284+ stem_chs = cfg ["stem_chs " ]
285+ stage_conv_chs = cfg ["stage_conv_chs " ]
286+ stage_out_chs = cfg ["stage_out_chs " ]
283287 block_per_stage = cfg ["block_per_stage" ]
284288 layer_per_block = cfg ["layer_per_block" ]
285289
286290 # Stem module
287291 last_stem_stride = stem_stride // 2
288292 conv_type = SeparableConvBnAct if cfg ["depthwise" ] else ConvBnAct
289293 self .stem = nn .Sequential (* [
290- ConvBnAct (in_chans , stem_ch [0 ], 3 , stride = 2 , norm_layer = norm_layer ),
291- conv_type (stem_ch [0 ], stem_ch [1 ], 3 , stride = 1 , norm_layer = norm_layer ),
292- conv_type (stem_ch [1 ], stem_ch [2 ], 3 , stride = last_stem_stride , norm_layer = norm_layer ),
294+ ConvBnAct (in_chans , stem_chs [0 ], 3 , stride = 2 , norm_layer = norm_layer ),
295+ conv_type (stem_chs [0 ], stem_chs [1 ], 3 , stride = 1 , norm_layer = norm_layer ),
296+ conv_type (stem_chs [1 ], stem_chs [2 ], 3 , stride = last_stem_stride , norm_layer = norm_layer ),
293297 ])
294298
295299 # OSA stages
296- in_ch_list = stem_ch [- 1 :] + stage_out_ch [:- 1 ]
300+ in_ch_list = stem_chs [- 1 :] + stage_out_chs [:- 1 ]
297301 stage_args = dict (
298302 residual = cfg ["residual" ], depthwise = cfg ["depthwise" ], attn = cfg ["attn" ], norm_layer = norm_layer )
299303 stages = []
300304 for i in range (4 ): # num_stages
301305 downsample = stem_stride == 2 or i > 0 # first stage has no stride/downsample if stem_stride is 4
302306 stages += [OsaStage (
303- in_ch_list [i ], stage_conv_ch [i ], stage_out_ch [i ], block_per_stage [i ], layer_per_block ,
307+ in_ch_list [i ], stage_conv_chs [i ], stage_out_chs [i ], block_per_stage [i ], layer_per_block ,
304308 downsample = downsample , ** stage_args )
305309 ]
306- self .num_features = stage_out_ch [i ]
310+ self .num_features = stage_out_chs [i ]
307311 self .stages = nn .Sequential (* stages )
308312
309313 self .head = ClassifierHead (self .num_features , num_classes , pool_type = global_pool , drop_rate = drop_rate )
@@ -398,14 +402,13 @@ def eca_vovnet39b(pretrained=False, **kwargs):
398402
399403# Experimental Models
400404
401- @register_model
402- def ese_vovnet39b_iabn (pretrained = False , ** kwargs ):
403- norm_layer = get_norm_act_layer ('iabn' )
404- return _vovnet ('ese_vovnet39b' , pretrained = pretrained , norm_layer = norm_layer , ** kwargs )
405-
406-
407405@register_model
408406def ese_vovnet39b_evos (pretrained = False , ** kwargs ):
409407 def norm_act_fn (num_features , ** kwargs ):
410408 return create_norm_act ('EvoNormSample' , num_features , jit = False , ** kwargs )
411- return _vovnet ('ese_vovnet39b' , pretrained = pretrained , norm_layer = norm_act_fn , ** kwargs )
409+ return _vovnet ('ese_vovnet39b_evos' , pretrained = pretrained , norm_layer = norm_act_fn , ** kwargs )
410+
411+ @register_model
412+ def ese_vovnet99b_iabn (pretrained = False , ** kwargs ):
413+ norm_layer = get_norm_act_layer ('iabn' )
414+ return _vovnet ('ese_vovnet99b_iabn' , pretrained = pretrained , norm_layer = norm_layer , ** kwargs )
0 commit comments