SE-ResNet feature-extracting backbone (no classification head).
Implements the Squeeze-and-Excitation augmentation of the ResNet topology from Hu et al., "Squeeze-and-Excitation Networks", CVPR 2018 (arXiv:1709.01507) — winner of the ILSVRC 2017 classification challenge. Each residual block in the four-stage ResNet body is followed by a lightweight SE module that recalibrates the relative importance of each feature-map channel:
where is ReLU and is the sigmoid. The two-layer FC bottleneck has reduction ratio (default 16), making the SE module add only ~10% extra parameters relative to ResNet while reducing ImageNet top-5 error by roughly 1.5 percentage points.
Block topology follows config.block_type: "basic"
selects two-conv _SEBasicBlocks (SE-ResNet-18/34) and
"bottleneck" selects three-conv _SEBottlenecks
(SE-ResNet-50/101/152).
Parameters
configSENetConfigse_resnet_18, se_resnet_50, …) for
paper-cited variants.Attributes
configSENetConfigconv1nn.Conv2dmaxpoolnn.Modulenn.MaxPool2d for the modern
stem, or _LegacyStemPool when config.legacy_pool.layer1, layer2, layer3, layer4nn.Sequentialfeature_infolist[FeatureInfo]BackboneMixin.Notes
State-dict keys follow timm's seresnet layout
(conv1.*, bn1.*, layer{1-4}.*) so that pretrained
weight files round-trip without renaming.
Examples
Build an SE-ResNet-50 backbone and run a forward pass:
>>> import lucid
>>> from lucid.models.vision.senet import se_resnet_50
>>> backbone = se_resnet_50()
>>> x = lucid.randn(2, 3, 224, 224)
>>> out = backbone(x)
>>> out.last_hidden_state.shape
(2, 2048, 7, 7)