sk_resnet_18_cls(pretrained: bool | str = False, weights: SKResNet18Weights | None = None, overrides: object = {})SK-ResNet-18 image classifier (backbone + GAP + linear head).
Builds an SKNetForImageClassification with the
SK-ResNet-18 backbone (basic blocks stacked [2, 2, 2, 2];
the first of each block is a Selective Kernel
unit, the second a plain conv) followed by global average pooling
and a linear projection to config.num_classes. Approximately
11.96M parameters.
Model Size
Parameters
pretrainedbool or str= FalsePretrained-weight selector.
False → random init; True
→ the DEFAULT tag (SKResNet18Weights.RA_IN1K); a
tag string (e.g. "RA_IN1K") → that specific checkpoint.
Mutually exclusive with weights (which wins if both are
given).Explicit weights enum member, e.g.
SKResNet18Weights.RA_IN1K. Takes precedence over
pretrained.**overridesobject= {}Keyword overrides forwarded into
SKNetConfig.Returns
SKNetForImageClassificationClassifier with the SK-ResNet-18 configuration applied
(or with overrides merged on top of it), optionally
initialised from pretrained weights.
Notes
See Li et al., "Selective Kernel Networks", CVPR 2019
(arXiv:1903.06586). Pretrained weights are converted from
timm's skresnet18.ra_in1k and hosted on the Hugging Face
Hub under lucid-dl/sk-resnet-18.
Examples
>>> import lucid
>>> from lucid.models.vision.sknet import sk_resnet_18_cls
>>> model = sk_resnet_18_cls(num_classes=10)
>>> x = lucid.randn(2, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(2, 10)
Load ImageNet-pretrained weights:
>>> model = sk_resnet_18_cls(pretrained=True) # DEFAULT tag
>>> from lucid.models.vision.sknet import SKResNet18Weights
>>> model = sk_resnet_18_cls(weights=SKResNet18Weights.RA_IN1K)