Update sotabench.py, tweak VovNet cfg

pull/155/head
Ross Wightman 4 years ago
parent d3ee3de96a
commit 6c7932fe75

@ -135,6 +135,12 @@ model_list = [
_entry('resnetblur50', 'ResNet-Blur-50', '1904.11486'),
_entry('densenet121', 'DenseNet-121', '1608.06993'),
_entry('densenetblur121d', 'DenseNet-Blur-121D', '1904.11486',
model_desc='DenseNet with blur pooling and deep stem'),
_entry('ese_vovnet39b', 'VoVNet-39-V2', '1911.06667'),
_entry('tf_efficientnet_b0', 'EfficientNet-B0 (AutoAugment)', '1905.11946',
model_desc='Ported from official Google AI Tensorflow weights'),
_entry('tf_efficientnet_b1', 'EfficientNet-B1 (AutoAugment)', '1905.11946',
@ -389,6 +395,34 @@ model_list = [
model_desc='Originally from https://github.com/mehtadushy/SelecSLS-Pytorch'),
_entry('selecsls60b', 'SelecSLS-60_B', '1907.00837',
model_desc='Originally from https://github.com/mehtadushy/SelecSLS-Pytorch'),
## RegNet official impl weighs
_entry('regnetx_002', 'RegNetX-200MF', '2003.13678'),
_entry('regnetx_004', 'RegNetX-400MF', '2003.13678'),
_entry('regnetx_006', 'RegNetX-600MF', '2003.13678'),
_entry('regnetx_008', 'RegNetX-800MF', '2003.13678'),
_entry('regnetx_016', 'RegNetX-1.6GF', '2003.13678'),
_entry('regnetx_032', 'RegNetX-3.2GF', '2003.13678'),
_entry('regnetx_040', 'RegNetX-4.0GF', '2003.13678'),
_entry('regnetx_064', 'RegNetX-6.4GF', '2003.13678'),
_entry('regnetx_080', 'RegNetX-8.0GF', '2003.13678'),
_entry('regnetx_120', 'RegNetX-12GF', '2003.13678'),
_entry('regnetx_160', 'RegNetX-16GF', '2003.13678'),
_entry('regnetx_320', 'RegNetX-32GF', '2003.13678', batch_size=BATCH_SIZE // 2),
_entry('regnety_002', 'RegNetY-200MF', '2003.13678'),
_entry('regnety_004', 'RegNetY-400MF', '2003.13678'),
_entry('regnety_006', 'RegNetY-600MF', '2003.13678'),
_entry('regnety_008', 'RegNetY-800MF', '2003.13678'),
_entry('regnety_016', 'RegNetY-1.6GF', '2003.13678'),
_entry('regnety_032', 'RegNetY-3.2GF', '2003.13678'),
_entry('regnety_040', 'RegNetY-4.0GF', '2003.13678'),
_entry('regnety_064', 'RegNetY-6.4GF', '2003.13678'),
_entry('regnety_080', 'RegNetY-8.0GF', '2003.13678'),
_entry('regnety_120', 'RegNetY-12GF', '2003.13678'),
_entry('regnety_160', 'RegNetY-16GF', '2003.13678'),
_entry('regnety_320', 'RegNetY-32GF', '2003.13678', batch_size=BATCH_SIZE // 2),
]
for m in model_list:

@ -28,9 +28,9 @@ from .layers import ConvBnAct, SeparableConvBnAct, BatchNormAct2d, SelectAdaptiv
# https://github.com/stigma0617/VoVNet.pytorch/blob/master/models_vovnet/vovnet.py
model_cfgs = dict(
vovnet39a=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=5,
block_per_stage=[1, 1, 2, 2],
residual=False,
@ -38,9 +38,9 @@ model_cfgs = dict(
attn='',
),
vovnet57a=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=5,
block_per_stage=[1, 1, 4, 3],
residual=False,
@ -49,9 +49,9 @@ model_cfgs = dict(
),
ese_vovnet19b_slim_dw=dict(
stem_ch=[64, 64, 64],
stage_conv_ch=[64, 80, 96, 112],
stage_out_ch=[112, 256, 384, 512],
stem_chs=[64, 64, 64],
stage_conv_chs=[64, 80, 96, 112],
stage_out_chs=[112, 256, 384, 512],
layer_per_block=3,
block_per_stage=[1, 1, 1, 1],
residual=True,
@ -60,9 +60,9 @@ model_cfgs = dict(
),
ese_vovnet19b_dw=dict(
stem_ch=[64, 64, 64],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 64],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=3,
block_per_stage=[1, 1, 1, 1],
residual=True,
@ -70,9 +70,9 @@ model_cfgs = dict(
attn='ese',
),
ese_vovnet19b_slim=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[64, 80, 96, 112],
stage_out_ch=[112, 256, 384, 512],
stem_chs=[64, 64, 128],
stage_conv_chs=[64, 80, 96, 112],
stage_out_chs=[112, 256, 384, 512],
layer_per_block=3,
block_per_stage=[1, 1, 1, 1],
residual=True,
@ -80,9 +80,9 @@ model_cfgs = dict(
attn='ese',
),
ese_vovnet19b=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=3,
block_per_stage=[1, 1, 1, 1],
residual=True,
@ -91,9 +91,9 @@ model_cfgs = dict(
),
ese_vovnet39b=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=5,
block_per_stage=[1, 1, 2, 2],
residual=True,
@ -101,9 +101,9 @@ model_cfgs = dict(
attn='ese',
),
ese_vovnet57b=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=5,
block_per_stage=[1, 1, 4, 3],
residual=True,
@ -112,9 +112,9 @@ model_cfgs = dict(
),
ese_vovnet99b=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=5,
block_per_stage=[1, 3, 9, 3],
residual=True,
@ -122,9 +122,9 @@ model_cfgs = dict(
attn='ese',
),
eca_vovnet39b=dict(
stem_ch=[64, 64, 128],
stage_conv_ch=[128, 160, 192, 224],
stage_out_ch=[256, 512, 768, 1024],
stem_chs=[64, 64, 128],
stage_conv_chs=[128, 160, 192, 224],
stage_out_chs=[256, 512, 768, 1024],
layer_per_block=5,
block_per_stage=[1, 1, 2, 2],
residual=True,
@ -132,6 +132,8 @@ model_cfgs = dict(
attn='eca',
),
)
model_cfgs['ese_vovnet39b_evos'] = model_cfgs['ese_vovnet39b']
model_cfgs['ese_vovnet99b_iabn'] = model_cfgs['ese_vovnet99b']
def _cfg(url=''):
@ -154,6 +156,8 @@ default_cfgs = dict(
ese_vovnet57b=_cfg(url=''),
ese_vovnet99b=_cfg(url=''),
eca_vovnet39b=_cfg(url=''),
ese_vovnet39b_evos=_cfg(url=''),
eee_vovnet99b_iabn=_cfg(url=''),
)
@ -277,9 +281,9 @@ class VovNet(nn.Module):
self.drop_rate = drop_rate
assert stem_stride in (4, 2)
stem_ch = cfg["stem_ch"]
stage_conv_ch = cfg["stage_conv_ch"]
stage_out_ch = cfg["stage_out_ch"]
stem_chs = cfg["stem_chs"]
stage_conv_chs = cfg["stage_conv_chs"]
stage_out_chs = cfg["stage_out_chs"]
block_per_stage = cfg["block_per_stage"]
layer_per_block = cfg["layer_per_block"]
@ -287,23 +291,23 @@ class VovNet(nn.Module):
last_stem_stride = stem_stride // 2
conv_type = SeparableConvBnAct if cfg["depthwise"] else ConvBnAct
self.stem = nn.Sequential(*[
ConvBnAct(in_chans, stem_ch[0], 3, stride=2, norm_layer=norm_layer),
conv_type(stem_ch[0], stem_ch[1], 3, stride=1, norm_layer=norm_layer),
conv_type(stem_ch[1], stem_ch[2], 3, stride=last_stem_stride, norm_layer=norm_layer),
ConvBnAct(in_chans, stem_chs[0], 3, stride=2, norm_layer=norm_layer),
conv_type(stem_chs[0], stem_chs[1], 3, stride=1, norm_layer=norm_layer),
conv_type(stem_chs[1], stem_chs[2], 3, stride=last_stem_stride, norm_layer=norm_layer),
])
# OSA stages
in_ch_list = stem_ch[-1:] + stage_out_ch[:-1]
in_ch_list = stem_chs[-1:] + stage_out_chs[:-1]
stage_args = dict(
residual=cfg["residual"], depthwise=cfg["depthwise"], attn=cfg["attn"], norm_layer=norm_layer)
stages = []
for i in range(4): # num_stages
downsample = stem_stride == 2 or i > 0 # first stage has no stride/downsample if stem_stride is 4
stages += [OsaStage(
in_ch_list[i], stage_conv_ch[i], stage_out_ch[i], block_per_stage[i], layer_per_block,
in_ch_list[i], stage_conv_chs[i], stage_out_chs[i], block_per_stage[i], layer_per_block,
downsample=downsample, **stage_args)
]
self.num_features = stage_out_ch[i]
self.num_features = stage_out_chs[i]
self.stages = nn.Sequential(*stages)
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):
# Experimental Models
@register_model
def ese_vovnet39b_iabn(pretrained=False, **kwargs):
norm_layer = get_norm_act_layer('iabn')
return _vovnet('ese_vovnet39b', pretrained=pretrained, norm_layer=norm_layer, **kwargs)
@register_model
def ese_vovnet39b_evos(pretrained=False, **kwargs):
def norm_act_fn(num_features, **kwargs):
return create_norm_act('EvoNormSample', num_features, jit=False, **kwargs)
return _vovnet('ese_vovnet39b', pretrained=pretrained, norm_layer=norm_act_fn, **kwargs)
return _vovnet('ese_vovnet39b_evos', pretrained=pretrained, norm_layer=norm_act_fn, **kwargs)
@register_model
def ese_vovnet99b_iabn(pretrained=False, **kwargs):
norm_layer = get_norm_act_layer('iabn')
return _vovnet('ese_vovnet99b_iabn', pretrained=pretrained, norm_layer=norm_layer, **kwargs)

Loading…
Cancel
Save