mobilenet_v2¶
- paddle.vision.models. mobilenet_v2 ( pretrained=False, scale=1.0, **kwargs ) [source]
-
MobileNetV2 from “MobileNetV2: Inverted Residuals and Linear Bottlenecks”.
- Parameters
-
pretrained (bool, optional) – Whether to load pre-trained weights. If True, returns a model pre-trained on ImageNet. Default: False.
scale (float, optional) – Scale of channels in each layer. Default: 1.0.
**kwargs (optional) – Additional keyword arguments. For details, please refer to MobileNetV2.
- Returns
-
Layer. An instance of MobileNetV2 model.
Examples
>>> import paddle >>> from paddle.vision.models import mobilenet_v2 >>> # Build model >>> model = mobilenet_v2() >>> # Build model and load imagenet pretrained weight >>> # model = mobilenet_v2(pretrained=True) >>> # Build mobilenet v2 with scale=0.5 >>> model = mobilenet_v2(scale=0.5) >>> x = paddle.rand([1, 3, 224, 224]) >>> out = model(x) >>> print(out.shape) [1, 1000]