MobileNet v2 feature-extracting backbone (no classification head).
Implements the inverted-residual / linear-bottleneck topology
from Sandler et al., "MobileNetV2: Inverted Residuals and Linear
Bottlenecks", CVPR 2018 (arXiv:1801.04381). Each block expands
a low-dimensional input up by an integer expand_ratio, runs
a depthwise convolution in the wider interior
space, then projects back to a narrow bottleneck — without a
final non-linearity (the "linear bottleneck"). When stride and
channel counts match, an identity shortcut is added around the
whole block:
The body is a 3×3 stem (stride 2) followed by seven inverted-residual stages and a final 1×1 head expansion to 1280 channels. A global average pool collapses the final feature map to a single 1×1 descriptor.
Parameters
configMobileNetV2Configmobilenet_v2, mobilenet_v2_075) for
paper-cited width-multiplier variants.Attributes
configMobileNetV2Configfeaturesnn.Sequentialconfig.width_mult.avgpoolnn.AdaptiveAvgPool2d(B, C, 1, 1).feature_infolist[FeatureInfo]BackboneMixin for downstream FPN / decoder
modules.Notes
The inverted-residual block is the inverse of the classical bottleneck shape: instead of wide → narrow → wide, it does narrow → wide → narrow, with the residual connection on the narrow (low-dimensional) tensor. Combined with the linear bottleneck (no ReLU on the projection), this preserves the representational capacity of the narrow channels while letting the wide interior use ReLU6 freely. The result is roughly fewer parameters and FLOPs than MobileNet-v1 at comparable accuracy.
Examples
Build a MobileNet-v2 backbone and run a forward pass:
>>> import lucid
>>> from lucid.models.vision.mobilenet_v2 import mobilenet_v2
>>> backbone = mobilenet_v2()
>>> x = lucid.randn(2, 3, 224, 224)
>>> out = backbone(x)
>>> out.last_hidden_state.shape
(2, 1280, 1, 1)Used by 2
Constructors
1Properties
1feature_info: list[FeatureInfo]