ConvNeXt¶
The ConvNeXt model is based on the "A ConvNet for the 2020s" paper.
Architecture overview¶
This architecture compiles tricks from transformer-based vision models to improve a pure convolutional model.

The key takeaways from the paper are the following:
- update the stem convolution to act like a patchify layer of transformers
- increase block kernel size to 7
- switch to depth-wise convolutions
- reduce the amount of activations and normalization layers
Model builders¶
The following model builders can be used to instantiate a ConvNeXt model, with or
without pre-trained weights. All the model builders internally rely on the ConvNeXt base class.
ConvNeXt
¶
ConvNeXt(num_blocks: list[int], planes: list[int], num_classes: int = 10, in_channels: int = 3, conv_layer: Callable[..., Module] | None = None, act_layer: Module | None = None, norm_layer: Callable[[int], Module] | None = None, drop_layer: Callable[..., Module] | None = None, stochastic_depth_prob: float = 0.0)
Bases: Sequential
Source code in holocron/models/classification/convnext.py
convnext_atto
¶
convnext_atto(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-Atto variant of Ross Wightman inspired by "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
ConvNeXt_Atto_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='convnext_atto', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/convnext_atto_224-f38217e7.pth', acc1=0.8759, acc5=0.9832, sha256='f38217e7361060e6fe00e8fa95b0e8774150190eed9e55c812bbd3b6ab378ce9', size=13535258, num_params=3377730, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch convnext_atto --batch-size 64 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')
Source code in holocron/models/classification/convnext.py
convnext_femto
¶
convnext_femto(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-Femto variant of Ross Wightman inspired by "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_pico
¶
convnext_pico(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-Pico variant of Ross Wightman inspired by "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_nano
¶
convnext_nano(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-Nano variant of Ross Wightman inspired by "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_tiny
¶
convnext_tiny(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-T from "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_small
¶
convnext_small(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-S from "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_base
¶
convnext_base(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-B from "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_large
¶
convnext_large(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-L from "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |
Source code in holocron/models/classification/convnext.py
convnext_xl
¶
convnext_xl(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> ConvNeXt
ConvNeXt-XL from "A ConvNet for the 2020s"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConvNeXt
|
classification model |