Module: tf.keras.applications.mobilenet

MobileNet v1 models for Keras.

MobileNet is a general architecture and can be used for multiple use cases. Depending on the use case, it can use different input layer size and different width factors. This allows different width models to reduce the number of multiply-adds and thereby reduce inference cost on mobile devices.

MobileNets support any input size greater than 32 x 32, with larger image sizes offering better performance. The number of parameters and number of multiply-adds can be modified by using the alpha parameter, which increases/decreases the number of filters in each layer. By altering the image size and alpha parameter, all 16 models from the paper can be built, with ImageNet weights provided.

The paper demonstrates the performance of MobileNets using alpha values of 1.0 (also called 100 % MobileNet), 0.75, 0.5 and 0.25. For each of these alpha values, weights for 4 different input image sizes are provided (224, 192, 160, 128).

The following table describes the size and accuracy of the 100% MobileNet

on size 224 x 224:

Width Multiplier (alpha) | ImageNet Acc | Multiply-Adds (M) | Params (M)

| 1.0 MobileNet-224 | 70.6 % | 529 | 4.2 | | 0.75 MobileNet-224 | 68.4 % | 325 | 2.6 | | 0.50 MobileNet-224 | 63.7 % | 149 | 1.3 |

| 0.25 MobileNet-224 | 50.6 % | 41 | 0.5 |

The following table describes the performance of

the 100 % MobileNet on various input sizes:

Resolution      | ImageNet Acc | Multiply-Adds (M) | Params (M)

| 1.0 MobileNet-224 | 70.6 % | 529 | 4.2 | | 1.0 MobileNet-192 | 69.1 % | 529 | 4.2 | | 1.0 MobileNet-160 | 67.2 % | 529 | 4.2 |

| 1.0 MobileNet-128 | 64.4 % | 529 | 4.2 |

Reference:

Functions

MobileNet(...): Instantiates the MobileNet architecture.

decode_predictions(...): Decodes the prediction of an ImageNet model.

preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/keras/applications/mobilenet