Skip to content
fn

mobilenet_v2

→MobileNetV22.2M
mobilenet_v2(pretrained: bool = False, overrides: object = {})

MobileNet-v2 backbone at width multiplier α=1.0\alpha = 1.0.

Builds a MobileNetV2 with the canonical paper topology from Sandler et al., 2018 (Table 2): seven inverted-residual stages with block repeats (1, 2, 3, 4, 3, 3, 1) and channel progression 16 → 24 → 32 → 64 → 96 → 160 → 320, followed by a 1×1 head expansion to 1280 channels. Approximately 3.5M parameters and 72.0% ImageNet-1k top-1 accuracy (Table 4).

Model Size

Parameters

pretrainedbool= False
No checkpoint is published for mobilenet_v2, so True raises NotImplementedError rather than return randomly initialised weights. mobilenet_v2_cls is the checkpointed variant.
**overridesobject= {}
Keyword overrides forwarded into MobileNetV2Config (e.g. in_channels=1 for grayscale input).

Returns

MobileNetV2

Backbone with the MobileNet-v2 (α=1.0\alpha = 1.0) configuration applied (or with overrides merged on top of it).

Notes

See Sandler et al., "MobileNetV2: Inverted Residuals and Linear Bottlenecks", CVPR 2018 (arXiv:1801.04381), Table 2 and Table 4.

Examples

>>> import lucid
>>> from lucid.models.vision.mobilenet_v2 import mobilenet_v2
>>> model = mobilenet_v2()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.last_hidden_state.shape
(1, 1280, 1, 1)

Used by 1