mobilenet_cls(pretrained: bool | str = False, weights: MobileNetWeights | None = None, overrides: object = {})MobileNet-v1 image classifier at width multiplier .
Builds a MobileNetForImageClassification with the
canonical paper topology (13 depthwise+pointwise blocks) followed
by global average pooling and a linear projection to
config.num_classes (default 1000 for ImageNet-1k).
Approximately 4.2M parameters and 70.6% ImageNet-1k top-1 in
Howard et al., 2017 (Table 6).
Model Size
Parameters
pretrainedbool or str= FalseFalse → random init; True
→ the DEFAULT tag (MobileNetWeights.RA4_E3600_R224_IN1K);
a tag string → that specific checkpoint. Mutually exclusive with
weights (which wins if both are given).pretrained.**overridesobject= {}MobileNetConfig
(typically num_classes to retarget the classifier).Returns
MobileNetForImageClassificationClassifier with the MobileNet-v1 ()
configuration applied (or with overrides merged on top
of it).
Notes
See Howard et al., "MobileNets: Efficient Convolutional Neural
Networks for Mobile Vision Applications", arXiv:1704.04861, 2017,
Table 6. Pretrained weights are converted from timm's
mobilenetv1_100.ra4_e3600_r224_in1k (75.4% top-1 at 224x224
under the RA4 recipe) and hosted under lucid-dl/mobilenet-v1.
Examples
>>> import lucid
>>> from lucid.models.vision.mobilenet import mobilenet_cls
>>> model = mobilenet_cls(num_classes=10)
>>> x = lucid.randn(2, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(2, 10)