timm documentation

CSPNet (CSPResNet, CSPDarkNet, DarkNet)

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v1.0.30).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

CSPNet (CSPResNet, CSPDarkNet, DarkNet)

Category: CNN · Code: timm/models/cspnet.py · Architectures: 23 · Pretrained weights: 15 (15 with ImageNet-1k results)

Cross Stage Partial Networks split the features of each stage into two parts, one passing through the stage blocks and one merged back at the end of the stage. This module holds CSPResNet, CSPResNeXt, CSPDarkNet, DarkNet and the timm cs3* variants.

Papers

Usage

See the Quickstart for loading pretrained weights, image preprocessing and fine-tuning, and Feature Extraction for using the models as backbones.

>>> import timm
>>> model = timm.create_model('cspdarknet53.ra_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)

Model API support

FeatureCspNet
features_only=True feature maps✓ (strides 2, 4, 8, 16, 32)
forward_intermediates()✗
prune_intermediate_layers()✗
Any input size, no changes needed✓
set_input_size()–
dynamic_img_size=True–
set_grad_checkpointing()✗
Layer-wise LR decay (group_matcher())✓
reset_classifier()✓

✓ supported, ✓ (square) works for square sizes only, ✗ not supported, – not needed (the model already accepts any input size). Checked by running each feature on a randomly initialized model (CspNet with cs3darknet_focus_s at 256), other architectures of the same class are expected to behave the same. See the Model API page for details.

Architectures

ArchitectureParams (M)GMACsInput sizePretrained weights
cs3darknet_focus_l21.154.662561
cs3darknet_focus_m9.301.982561
cs3darknet_focus_s3.270.692561
cs3darknet_focus_x35.028.032560
cs3darknet_l21.164.862561
cs3darknet_m9.312.082561
cs3darknet_s3.280.722560
cs3darknet_x35.058.382561
cs3edgenet_x47.8211.532561
cs3se_edgenet_x50.7211.532561
cs3sedarknet_l21.914.862561
cs3sedarknet_x35.408.382561
cs3sedarknet_xdw21.605.972560
cspdarknet5327.646.572561
cspresnet5021.624.542561
cspresnet50d21.644.862560
cspresnet50w28.125.042560
cspresnext5020.574.052561
darknet1714.303.262560
darknet2120.863.932560
darknet5341.619.312561
darknetaa5336.027.972561
sedarknet2120.953.932560

GMACs and parameter counts are for the default input size and classifier of each architecture, from the benchmark results.

Pretrained weights

Top-1 is ImageNet-1k validation accuracy from results-imagenet.csv at the listed eval size, - if the weight has no ImageNet-1k result (e.g. pretraining or image-text weights). Classes is the size of the pretrained classifier, none for weights without one.

Weights are grouped by source: the paper or origin given in the pretrained config, else a Hub organization other than timm, else the first part of the pretrained tag (architecture.tag). Sources with a single weight are listed under other.

c2ns tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
cs3darknet_focus_l.c2ns_in1k256 (test 288)80.8942881000apache-2.0timm
cs3darknet_focus_m.c2ns_in1k256 (test 288)77.2862881000apache-2.0timm
cs3darknet_l.c2ns_in1k256 (test 288)80.8822881000apache-2.0timm
cs3darknet_m.c2ns_in1k256 (test 288)77.6362881000apache-2.0timm
cs3darknet_x.c2ns_in1k256 (test 288)82.2342881000apache-2.0timm
cs3se_edgenet_x.c2ns_in1k256 (test 320)83.5503201000apache-2.0timm
cs3sedarknet_l.c2ns_in1k256 (test 288)81.7702881000apache-2.0timm
cs3sedarknet_x.c2ns_in1k256 (test 288)82.6542881000apache-2.0timm
darknet53.c2ns_in1k256 (test 288)80.5422881000apache-2.0timm
darknetaa53.c2ns_in1k256 (test 288)80.5282881000apache-2.0timm

ra tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
cspdarknet53.ra_in1k25680.0782561000apache-2.0timm
cspresnet50.ra_in1k25679.5782561000apache-2.0timm
cspresnext50.ra_in1k25680.5482561000apache-2.0timm

Other

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
cs3darknet_focus_s.ra4_e3600_r256_in1k256 (test 320)73.1583201000apache-2.0timm
cs3edgenet_x.c2_in1k256 (test 288)82.7342881000apache-2.0timm
Update on GitHub