mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
Add gc_efficientnetv2_rw_t weights (global context instead of SE attn). Add TF XL weights even though the fine-tuned ones don't validate that well. Change default arg for GlobalContext to use scal (mul) mode.
This commit is contained in:
parent
bd56946676
commit
01cb46a9a5
@ -25,7 +25,7 @@ if 'GITHUB_ACTIONS' in os.environ: # and 'Linux' in platform.system():
|
|||||||
# GitHub Linux runner is slower and hits memory limits sooner than MacOS, exclude bigger models
|
# GitHub Linux runner is slower and hits memory limits sooner than MacOS, exclude bigger models
|
||||||
EXCLUDE_FILTERS = [
|
EXCLUDE_FILTERS = [
|
||||||
'*efficientnet_l2*', '*resnext101_32x48d', '*in21k', '*152x4_bitm', '*101x3_bitm', '*50x3_bitm',
|
'*efficientnet_l2*', '*resnext101_32x48d', '*in21k', '*152x4_bitm', '*101x3_bitm', '*50x3_bitm',
|
||||||
'*nfnet_f3*', '*nfnet_f4*', '*nfnet_f5*', '*nfnet_f6*', '*nfnet_f7*',
|
'*nfnet_f3*', '*nfnet_f4*', '*nfnet_f5*', '*nfnet_f6*', '*nfnet_f7*', '*efficientnetv2_xl*',
|
||||||
'*resnetrs350*', '*resnetrs420*', 'xcit_large_24_p8*']
|
'*resnetrs350*', '*resnetrs420*', 'xcit_large_24_p8*']
|
||||||
else:
|
else:
|
||||||
EXCLUDE_FILTERS = []
|
EXCLUDE_FILTERS = []
|
||||||
|
@ -92,11 +92,6 @@ default_cfgs = {
|
|||||||
interpolation='bilinear'),
|
interpolation='bilinear'),
|
||||||
|
|
||||||
# NOTE experimenting with alternate attention
|
# NOTE experimenting with alternate attention
|
||||||
'eca_efficientnet_b0': _cfg(
|
|
||||||
url=''),
|
|
||||||
'gc_efficientnet_b0': _cfg(
|
|
||||||
url=''),
|
|
||||||
|
|
||||||
'efficientnet_b0': _cfg(
|
'efficientnet_b0': _cfg(
|
||||||
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b0_ra-3dd342df.pth'),
|
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b0_ra-3dd342df.pth'),
|
||||||
'efficientnet_b1': _cfg(
|
'efficientnet_b1': _cfg(
|
||||||
@ -169,7 +164,7 @@ default_cfgs = {
|
|||||||
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnetv2_t_agc-3620981a.pth',
|
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnetv2_t_agc-3620981a.pth',
|
||||||
input_size=(3, 224, 224), test_input_size=(3, 288, 288), pool_size=(7, 7), crop_pct=1.0),
|
input_size=(3, 224, 224), test_input_size=(3, 288, 288), pool_size=(7, 7), crop_pct=1.0),
|
||||||
'gc_efficientnetv2_rw_t': _cfg(
|
'gc_efficientnetv2_rw_t': _cfg(
|
||||||
url='',
|
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/gc_efficientnetv2_rw_t_agc-927a0bde.pth',
|
||||||
input_size=(3, 224, 224), test_input_size=(3, 288, 288), pool_size=(7, 7), crop_pct=1.0),
|
input_size=(3, 224, 224), test_input_size=(3, 288, 288), pool_size=(7, 7), crop_pct=1.0),
|
||||||
'efficientnetv2_rw_s': _cfg(
|
'efficientnetv2_rw_s': _cfg(
|
||||||
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_v2s_ra2_288-a6477665.pth',
|
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_v2s_ra2_288-a6477665.pth',
|
||||||
@ -362,7 +357,7 @@ default_cfgs = {
|
|||||||
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5),
|
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5),
|
||||||
input_size=(3, 384, 384), test_input_size=(3, 480, 480), pool_size=(12, 12), crop_pct=1.0),
|
input_size=(3, 384, 384), test_input_size=(3, 480, 480), pool_size=(12, 12), crop_pct=1.0),
|
||||||
'tf_efficientnetv2_xl_in21ft1k': _cfg(
|
'tf_efficientnetv2_xl_in21ft1k': _cfg(
|
||||||
url='',
|
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-effv2-weights/tf_efficientnetv2_xl_in21ft1k-06c35c48.pth',
|
||||||
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5),
|
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5),
|
||||||
input_size=(3, 384, 384), test_input_size=(3, 512, 512), pool_size=(12, 12), crop_pct=1.0),
|
input_size=(3, 384, 384), test_input_size=(3, 512, 512), pool_size=(12, 12), crop_pct=1.0),
|
||||||
|
|
||||||
@ -379,7 +374,7 @@ default_cfgs = {
|
|||||||
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), num_classes=21843,
|
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), num_classes=21843,
|
||||||
input_size=(3, 384, 384), test_input_size=(3, 480, 480), pool_size=(12, 12), crop_pct=1.0),
|
input_size=(3, 384, 384), test_input_size=(3, 480, 480), pool_size=(12, 12), crop_pct=1.0),
|
||||||
'tf_efficientnetv2_xl_in21k': _cfg(
|
'tf_efficientnetv2_xl_in21k': _cfg(
|
||||||
url='',
|
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-effv2-weights/tf_efficientnetv2_xl_in21k-fd7e8abf.pth',
|
||||||
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), num_classes=21843,
|
mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), num_classes=21843,
|
||||||
input_size=(3, 384, 384), test_input_size=(3, 512, 512), pool_size=(12, 12), crop_pct=1.0),
|
input_size=(3, 384, 384), test_input_size=(3, 512, 512), pool_size=(12, 12), crop_pct=1.0),
|
||||||
|
|
||||||
@ -1276,26 +1271,6 @@ def efficientnet_b0(pretrained=False, **kwargs):
|
|||||||
return model
|
return model
|
||||||
|
|
||||||
|
|
||||||
@register_model
|
|
||||||
def eca_efficientnet_b0(pretrained=False, **kwargs):
|
|
||||||
""" EfficientNet-B0 w/ ECA attn """
|
|
||||||
# NOTE experimental config
|
|
||||||
model = _gen_efficientnet(
|
|
||||||
'eca_efficientnet_b0', se_layer='ecam', channel_multiplier=1.0, depth_multiplier=1.0,
|
|
||||||
pretrained=pretrained, **kwargs)
|
|
||||||
return model
|
|
||||||
|
|
||||||
|
|
||||||
@register_model
|
|
||||||
def gc_efficientnet_b0(pretrained=False, **kwargs):
|
|
||||||
""" EfficientNet-B0 w/ GlobalContext """
|
|
||||||
# NOTE experminetal config
|
|
||||||
model = _gen_efficientnet(
|
|
||||||
'gc_efficientnet_b0', se_layer='gc', channel_multiplier=1.0, depth_multiplier=1.0,
|
|
||||||
pretrained=pretrained, **kwargs)
|
|
||||||
return model
|
|
||||||
|
|
||||||
|
|
||||||
@register_model
|
@register_model
|
||||||
def efficientnet_b1(pretrained=False, **kwargs):
|
def efficientnet_b1(pretrained=False, **kwargs):
|
||||||
""" EfficientNet-B1 """
|
""" EfficientNet-B1 """
|
||||||
|
@ -18,7 +18,7 @@ from .norm import LayerNorm2d
|
|||||||
|
|
||||||
class GlobalContext(nn.Module):
|
class GlobalContext(nn.Module):
|
||||||
|
|
||||||
def __init__(self, channels, use_attn=True, fuse_add=True, fuse_scale=False, init_last_zero=False,
|
def __init__(self, channels, use_attn=True, fuse_add=False, fuse_scale=True, init_last_zero=False,
|
||||||
rd_ratio=1./8, rd_channels=None, rd_divisor=1, act_layer=nn.ReLU, gate_layer='sigmoid'):
|
rd_ratio=1./8, rd_channels=None, rd_divisor=1, act_layer=nn.ReLU, gate_layer='sigmoid'):
|
||||||
super(GlobalContext, self).__init__()
|
super(GlobalContext, self).__init__()
|
||||||
act_layer = get_act_layer(act_layer)
|
act_layer = get_act_layer(act_layer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user