<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/modeling/backbones/mobilenet.py#L1216-L1588) |

Creates a MobileNet family model.

    tfm.vision.backbones.MobileNet(
        model_id: str = 'MobileNetV2',
        filter_size_scale: float = 1.0,
        input_specs: tf_keras.layers.InputSpec = layers.InputSpec(shape=[None, None, None, 3]),
        norm_momentum: float = 0.99,
        norm_epsilon: float = 0.001,
        kernel_initializer: str = 'VarianceScaling',
        kernel_regularizer: (tf_keras.regularizers.Regularizer | None) = None,
        bias_regularizer: (tf_keras.regularizers.Regularizer | None) = None,
        output_stride: (int | None) = None,
        min_depth: int = 8,
        divisible_by: int = 8,
        stochastic_depth_drop_rate: float = 0.0,
        flat_stochastic_depth_drop_rate: bool = True,
        regularize_depthwise: bool = False,
        use_sync_bn: bool = False,
        finegrain_classification_mode: bool = True,
        output_intermediate_endpoints: bool = False,
        **kwargs
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `model_id` | A `str` of MobileNet version. The supported values are `MobileNetV1`, `MobileNetV2`, `MobileNetV3Large`, `MobileNetV3Small`, `MobileNetV3EdgeTPU`, `MobileNetMultiMAX` and `MobileNetMultiAVG`. |
| `filter_size_scale` | A `float` of multiplier for the filters (number of channels) for all convolution ops. The value must be greater than zero. Typical usage will be to set this value in (0, 1) to reduce the number of parameters or computation cost of the model. |
| `input_specs` | A `tf_keras.layers.InputSpec` of specs of the input tensor. |
| `norm_momentum` | A `float` of normalization momentum for the moving average. |
| `norm_epsilon` | A `float` added to variance to avoid dividing by zero. |
| `kernel_initializer` | A `str` for kernel initializer of convolutional layers. |
| `kernel_regularizer` | A `tf_keras.regularizers.Regularizer` object for Conv2D. Default to None. |
| `bias_regularizer` | A `tf_keras.regularizers.Regularizer` object for Conv2D. Default to None. |
| `output_stride` | An `int` that specifies the requested ratio of input to output spatial resolution. If not None, then we invoke atrous convolution if necessary to prevent the network from reducing the spatial resolution of activation maps. Allowed values are 8 (accurate fully convolutional mode), 16 (fast fully convolutional mode), 32 (classification mode). |
| `min_depth` | An `int` of minimum depth (number of channels) for all convolution ops. Enforced when filter_size_scale \< 1, and not an active constraint when filter_size_scale \>= 1. |
| `divisible_by` | An `int` that ensures all inner dimensions are divisible by this number. |
| `stochastic_depth_drop_rate` | A `float` of drop rate for drop connect layer. |
| `flat_stochastic_depth_drop_rate` | A `bool`, indicating that the stochastic depth drop rate will be fixed and equal to all blocks. |
| `regularize_depthwise` | If Ture, apply regularization on depthwise. |
| `use_sync_bn` | If True, use synchronized batch normalization. |
| `finegrain_classification_mode` | If True, the model will keep the last layer large even for small multipliers, following https://arxiv.org/abs/1801.04381. |
| `output_intermediate_endpoints` | A `bool` of whether or not output the intermediate endpoints. |
| `**kwargs` | Additional keyword arguments to be passed. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `output_specs` | A dict of {level: TensorShape} pairs for the model output. |

<br />

## Methods

### `call`

    call(
        inputs, training=None, mask=None
    )

Calls the model on new inputs and returns the outputs as tensors.

In this case `call()` just reapplies
all ops in the graph to the new inputs
(e.g. build a new computational graph from the provided inputs).

> [!NOTE]
> **Note:** This method should not be called directly. It is only meant to be overridden when subclassing [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model). To call a model on an input, always use the `__call__()` method, i.e. `model(inputs)`, which relies on the underlying `call()` method.

<br />

<br />

<br />

| Args ||
|---|---|
| `inputs` | Input tensor, or dict/list/tuple of input tensors. |
| `training` | Boolean or boolean scalar tensor, indicating whether to run the `Network` in training mode or inference mode. |
| `mask` | A mask or list of masks. A mask can be either a boolean tensor or None (no mask). For more details, check the guide [here](https://www.tensorflow.org/guide/keras/masking_and_padding). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A tensor if there is a single output, or a list of tensors if there are more than one outputs. ||

<br />