Module keras.api.keras.applications.mobilenet_v3

Public API for tf.keras.applications.mobilenet_v3 namespace.

Expand source code
# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""Public API for tf.keras.applications.mobilenet_v3 namespace.
"""

from __future__ import print_function as _print_function

import sys as _sys

from keras.applications.mobilenet_v3 import decode_predictions
from keras.applications.mobilenet_v3 import preprocess_input

del _print_function

from tensorflow.python.util import module_wrapper as _module_wrapper

if not isinstance(_sys.modules[__name__], _module_wrapper.TFModuleWrapper):
  _sys.modules[__name__] = _module_wrapper.TFModuleWrapper(
      _sys.modules[__name__], "keras.applications.mobilenet_v3", public_apis=None, deprecation=True,
      has_lite=False)

Functions

def decode_predictions(preds, top=5)

Decodes the prediction of an ImageNet model.

Args

preds
Numpy array encoding a batch of predictions.
top
Integer, how many top-guesses to return. Defaults to 5.

Returns

A list of lists of top class prediction tuples (class_name, class_description, score). One list of tuples per sample in batch input.

Raises

ValueError
In case of invalid shape of the pred array (must be 2D).
Expand source code
@keras_export('keras.applications.mobilenet_v3.decode_predictions')
def decode_predictions(preds, top=5):
  return imagenet_utils.decode_predictions(preds, top=top)
def preprocess_input(x, data_format=None)

A placeholder method for backward compatibility.

The preprocessing logic has been included in the mobilenet_v3 model implementation. Users are no longer required to call this method to normalize the input data. This method does nothing and only kept as a placeholder to align the API surface between old and new version of model.

Args

x
A floating point numpy.array or a tf.Tensor.
data_format
Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").{mode}

Returns

Unchanged numpy.array or tf.Tensor.

Expand source code
@keras_export('keras.applications.mobilenet_v3.preprocess_input')
def preprocess_input(x, data_format=None):  # pylint: disable=unused-argument
  """A placeholder method for backward compatibility.

  The preprocessing logic has been included in the mobilenet_v3 model
  implementation. Users are no longer required to call this method to normalize
  the input data. This method does nothing and only kept as a placeholder to
  align the API surface between old and new version of model.

  Args:
    x: A floating point `numpy.array` or a `tf.Tensor`.
    data_format: Optional data format of the image tensor/array. Defaults to
      None, in which case the global setting
      `tf.keras.backend.image_data_format()` is used (unless you changed it,
      it defaults to "channels_last").{mode}

  Returns:
    Unchanged `numpy.array` or `tf.Tensor`.
  """
  return x