Skip to content
class

ResNeStForImageClassification

extendsImageClassificationModelClassificationHeadMixin
ResNeStForImageClassification(config: ResNeStConfig)

ResNeSt with global-average-pooled linear classification head.

Combines a ResNeSt backbone with global average pooling, an optional lucid.nn.Dropout (probability config.dropout), and a linear projection to config.num_classes logits. When labels are supplied to forward, a cross-entropy loss is computed and returned alongside the logits.

Parameters

Architecture spec. Use the *_cls factory functions (resnest_50_cls, resnest_101_cls, …) for paper-cited configurations.

Attributes

Stored copy of the config that built this model.
conv1, bn1, act1, maxpool, layer1, layer2, layer3, layer4
Same backbone components as on ResNeSt; see that class for shape semantics.
Global average pool collapsing the final feature map to 1 × 1.
classifiernn.Module
Built by ClassificationHeadMixin._build_classifier — a lucid.nn.Linear (or lucid.nn.Sequential with dropout) projecting from 2048 channels to config.num_classes.

Notes

The classification flow is

logits=W Drop⁡ ⁣(GAP⁡( backbone(x) ))+b.\text{logits} = W \,\operatorname{Drop}\!\left( \operatorname{GAP}(\,\mathrm{backbone}(x)\,) \right) + b.

Examples

Run inference on a batch of 224×224 RGB images:
>>> import lucid
>>> from lucid.models.vision.resnest import resnest_50_cls
>>> model = resnest_50_cls()
>>> x = lucid.randn(4, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(4, 1000)

Used by 2

Constructors

1
dunder

__init__

→None
__init__(config: ResNeStConfig)

Instance methods

1