SKNet
15 memberslucid.models.vision.sknetSKNet / SK-ResNet family — backbone + image classification.
Li, Xiang, et al. "Selective Kernel Networks." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019, pp. 510–519.
SKNet builds on the biological observation that the receptive field size of cortical neurons is not fixed but is modulated by the stimulus. Standard ConvNets bake the receptive field into the architecture (a kernel always sees a neighbourhood); SKNet replaces that with a Selective Kernel unit that dynamically chooses how much of each receptive-field size to use for every input, on a per-channel basis.
A Selective Kernel block runs the input through two (or more) parallel branches with different effective receptive fields — typically a convolution and a dilation-2 convolution (giving an effective receptive field). Their outputs and are summed and pooled to produce a compact channel descriptor, which is then passed through a lightweight SE-style bottleneck and a per-branch softmax to yield soft attention weights:
The final output of the block is the channel-wise convex combination
Because and are computed from the input itself, every channel of every feature map can effectively choose its own receptive field at every spatial location — a form of soft kernel selection driven by data.
Plugging Selective Kernel units into the ResNet bottleneck in
place of the central convolution gives the
SK-ResNet family (SKNet-50 / 101 / 200 in the paper). An
aggressive ResNeXt-style cardinality / base-width split lets
the same block scale up to SK-ResNeXt-50 32×4d. In Lucid these
are all parameterised by SKNetConfig's cardinality,
base_width, split_input and rd_ratio fields.
Classes
Functions
sk_resnet_18→ SKNetSK-ResNet-18 feature-extracting backbone (no classification head).
sk_resnet_18_cls→ SKNetForImageClassificationSK-ResNet-18 image classifier (backbone + GAP + linear head).
sk_resnet_34→ SKNetSK-ResNet-34 feature-extracting backbone (no classification head).
sk_resnet_34_cls→ SKNetForImageClassificationSK-ResNet-34 image classifier (backbone + GAP + linear head).
sk_resnet_50→ SKNetSK-ResNet-50 feature-extracting backbone (no classification head).
sk_resnet_50_cls→ SKNetForImageClassificationSK-ResNet-50 image classifier (backbone + GAP + linear head).
sk_resnet_101→ SKNetSK-ResNet-101 feature-extracting backbone (no classification head).
sk_resnet_101_cls→ SKNetForImageClassificationSK-ResNet-101 image classifier (backbone + GAP + linear head).
sk_resnext_50_32x4d→ SKNetSK-ResNeXt-50 32×4d feature-extracting backbone (the paper's SKNet-50).
sk_resnext_50_32x4d_cls→ SKNetForImageClassificationSK-ResNeXt-50 32×4d image classifier — the paper's SKNet-50.