Skip to content

Commit 6f103a4

Browse files
committed
Add convnext_nano weights, 80.8 @ 224, 81.5 @ 288
1 parent 4042a94 commit 6f103a4

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

timm/models/convnext.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ def _cfg(url='', **kwargs):
4242
convnext_base=_cfg(url="https://dl.fbaipublicfiles.com/convnext/convnext_base_1k_224_ema.pth"),
4343
convnext_large=_cfg(url="https://dl.fbaipublicfiles.com/convnext/convnext_large_1k_224_ema.pth"),
4444

45+
# timm specific variants
46+
convnext_nano=_cfg(
47+
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/convnext_nano_d1h-7eb4bdea.pth',
48+
crop_pct=0.95, test_input_size=(3, 288, 288), test_crop_pct=1.0),
4549
convnext_nano_hnf=_cfg(url=''),
4650
convnext_nano_ols=_cfg(url=''),
4751
convnext_tiny_hnf=_cfg(
4852
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/convnext_tiny_hnf_a2h-ab7e9df2.pth',
49-
crop_pct=0.95),
53+
crop_pct=0.95, test_input_size=(3, 288, 288), test_crop_pct=1.0),
5054

5155
convnext_tiny_in22ft1k=_cfg(
5256
url='https://dl.fbaipublicfiles.com/convnext/convnext_tiny_22k_1k_224.pth'),
@@ -410,8 +414,18 @@ def _create_convnext(variant, pretrained=False, **kwargs):
410414
return model
411415

412416

417+
@register_model
418+
def convnext_nano(pretrained=False, **kwargs):
419+
# timm nano variant with standard stem and head
420+
model_args = dict(
421+
depths=(2, 2, 8, 2), dims=(80, 160, 320, 640), conv_mlp=True, **kwargs)
422+
model = _create_convnext('convnext_nano', pretrained=pretrained, **model_args)
423+
return model
424+
425+
413426
@register_model
414427
def convnext_nano_hnf(pretrained=False, **kwargs):
428+
# experimental nano variant with normalization before pooling in head (head norm first)
415429
model_args = dict(
416430
depths=(2, 2, 8, 2), dims=(80, 160, 320, 640), head_norm_first=True, conv_mlp=True, **kwargs)
417431
model = _create_convnext('convnext_nano_hnf', pretrained=pretrained, **model_args)
@@ -420,23 +434,17 @@ def convnext_nano_hnf(pretrained=False, **kwargs):
420434

421435
@register_model
422436
def convnext_nano_ols(pretrained=False, **kwargs):
437+
# experimental nano variant with overlapping conv stem
423438
model_args = dict(
424-
depths=(2, 2, 8, 2), dims=(80, 160, 320, 640), head_norm_first=True, conv_mlp=True,
425-
conv_bias=False, stem_type='overlap', stem_kernel_size=9, **kwargs)
439+
depths=(2, 2, 8, 2), dims=(80, 160, 320, 640), conv_mlp=True,
440+
stem_type='overlap', stem_kernel_size=9, **kwargs)
426441
model = _create_convnext('convnext_nano_ols', pretrained=pretrained, **model_args)
427442
return model
428443

429444

430445
@register_model
431446
def convnext_tiny_hnf(pretrained=False, **kwargs):
432-
model_args = dict(
433-
depths=(3, 3, 9, 3), dims=(96, 192, 384, 768), head_norm_first=True, conv_mlp=True, **kwargs)
434-
model = _create_convnext('convnext_tiny_hnf', pretrained=pretrained, **model_args)
435-
return model
436-
437-
438-
@register_model
439-
def convnext_tiny_hnfd(pretrained=False, **kwargs):
447+
# experimental tiny variant with norm before pooling in head (head norm first)
440448
model_args = dict(
441449
depths=(3, 3, 9, 3), dims=(96, 192, 384, 768), head_norm_first=True, conv_mlp=True, **kwargs)
442450
model = _create_convnext('convnext_tiny_hnf', pretrained=pretrained, **model_args)

0 commit comments

Comments
 (0)