ResNeSt feature-extracting backbone (no classification head).
Implements the Split-Attention augmentation of the ResNet topology from Zhang et al., "ResNeSt: Split-Attention Networks", CVPR Workshops 2022 (arXiv:2004.08955). Each bottleneck's is replaced by a Split-Attention block that fuses ResNeXt cardinality, SKNet kernel selection, and SENet channel attention into a single unified primitive. The block splits the feature map into cardinal groups, then further splits each group into parallel radix branches, and computes per-radix softmax attention weights
Two further refinements complete the architecture: a deep stem (three 3×3 convolutions replacing the original 7×7 stem) and an average-pool downsampling path that replaces strided convolutions in residual shortcuts and inside the Split-Attention block itself.
Parameters
configResNeStConfigresnest_50, resnest_101, …) for
paper-cited variants.Attributes
configResNeStConfigconv1nn.Moduleconfig.deep_stem.act1nn.ReLUmaxpoolnn.MaxPool2dlayer1, layer2, layer3, layer4nn.Sequentialfeature_ infolist[FeatureInfo]BackboneMixin.Notes
When the Split-Attention block degenerates to ResNeXt; at it generalises SKNet to arbitrary radix counts with a softmax (rather than two-way sigmoid) gate. ResNeSt-50 outperforms plain ResNet-50 by roughly 3 ImageNet top-1 percentage points at the same parameter count, and serves as a strong backbone for downstream detection / segmentation pipelines.
Examples
Build a ResNeSt-50 backbone and run a forward pass:
>>> import lucid
>>> from lucid.models.vision.resnest import resnest_50
>>> backbone = resnest_50()
>>> x = lucid.randn(2, 3, 224, 224)
>>> out = backbone(x)
>>> out.last_hidden_state.shape
(2, 2048, 7, 7)Used by 2
Constructors
1Instance methods
2forward(x: Tensor)Override in subclasses to define the computation.
Run the backbone's feature-extraction pass.
Parameters
(B, C, H, W).Returns
TensorFeature map at the deepest stage. Concrete subclasses may additionally stash earlier stages on the instance so multi-stage consumers can fetch them.
Examples
The map returned is the one feature_info lists last, so a
neck can size itself from that entry without running the model.
>>> import lucid
>>> from lucid.models import create_model
>>> backbone = create_model("resnet_18").eval()
>>> last = backbone.feature_info[-1]
>>> last.num_channels, last.reduction
(512, 32)
>>> backbone.forward_features(lucid.randn((1, 3, 64, 96))).shape
(1, 512, 2, 3)
Each side is divided by the advertised reduction on its own, so
a non-square input keeps its aspect ratio.