DarkNetV4¶
The DarkNetV4 model is based on the "CSPNet: A New Backbone that can Enhance Learning Capability of CNN" paper.
Architecture overview¶
This paper makes a more powerful version than its predecedors by increasing depth and using ResNet tricks.
The key takeaways from the paper are the following:
- add cross-path connections to its predecessors
- explores newer non-linearities
Model builders¶
The following model builders can be used to instantiate a DarknetV3 model, with or
without pre-trained weights. All the model builders internally rely on the
DarknetV4 base class.
DarknetV4
¶
DarknetV4(layout: list[tuple[int, int]], num_classes: int = 10, in_channels: int = 3, stem_channels: int = 32, num_features: int = 1, act_layer: Module | None = None, norm_layer: Callable[[int], Module] | None = None, drop_layer: Callable[..., Module] | None = None, conv_layer: Callable[..., Module] | None = None)
Bases: Sequential
Source code in holocron/models/classification/darknetv4.py
cspdarknet53
¶
cspdarknet53(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> DarknetV4
CSP-Darknet-53 from "CSPNet: A New Backbone that can Enhance Learning Capability of CNN"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNet
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 |
|---|---|
DarknetV4
|
classification model |
CSPDarknet53_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='cspdarknet53', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/cspdarknet53_224-7a69463a.pth', acc1=0.945, acc5=0.9964, sha256='7a69463a4bd445beb6691dfd6ef7378efcf941f75d07d60034106ebedfcb82f8', size=106732575, num_params=26627434, commit='6e32c5b578711a2ef3731a8f8c61760ed9f03e58', train_args='./imagenette2-320/ --arch cspdarknet53 --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/darknetv4.py
cspdarknet53_mish
¶
cspdarknet53_mish(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> DarknetV4
Modified version of CSP-Darknet-53 from "CSPNet: A New Backbone that can Enhance Learning Capability of CNN" with Mish as activation layer and DropBlock as regularization layer.
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNet
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 |
|---|---|
DarknetV4
|
classification model |
CSPDarknet53_Mish_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='cspdarknet53_mish', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/cspdarknet53_mish_224-1b660b3c.pth', acc1=0.9465, acc5=0.9969, sha256='1b660b3cb144195100c99ee3b9b863c37a5b5a59619c8de8c588b3d2af954b15', size=106737530, num_params=26627434, commit='6e32c5b578711a2ef3731a8f8c61760ed9f03e58', train_args='./imagenette2-320/ --arch cspdarknet53_mish --batch-size 32 --grad-acc 2 --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')