tf.keras.applications.EfficientNetB1 Instantiates the EfficientNetB1 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB1 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB1, tf.compat.v1.keras.applications.efficientnet.EfficientNetB1
tf.keras.applications.EfficientNetB1(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


tf.keras.applications.EfficientNetB2 Instantiates the EfficientNetB2 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB2 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB2, tf.compat.v1.keras.applications.efficientnet.EfficientNetB2
tf.keras.applications.EfficientNetB2(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


tf.keras.applications.EfficientNetB3 Instantiates the EfficientNetB3 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB3 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB3, tf.compat.v1.keras.applications.efficientnet.EfficientNetB3
tf.keras.applications.EfficientNetB3(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


tf.keras.applications.EfficientNetB4 Instantiates the EfficientNetB4 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB4 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB4, tf.compat.v1.keras.applications.efficientnet.EfficientNetB4
tf.keras.applications.EfficientNetB4(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


tf.keras.applications.EfficientNetB5 Instantiates the EfficientNetB5 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB5 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB5, tf.compat.v1.keras.applications.efficientnet.EfficientNetB5
tf.keras.applications.EfficientNetB5(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


tf.keras.applications.EfficientNetB6 Instantiates the EfficientNetB6 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB6 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB6, tf.compat.v1.keras.applications.efficientnet.EfficientNetB6
tf.keras.applications.EfficientNetB6(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


tf.keras.applications.EfficientNetB7 Instantiates the EfficientNetB7 architecture.  View aliases  Main aliases
tf.keras.applications.efficientnet.EfficientNetB7 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.EfficientNetB7, tf.compat.v1.keras.applications.efficientnet.EfficientNetB7
tf.keras.applications.EfficientNetB7(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (ICML 2019)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. If you have never configured it, it defaults to "channels_last".

 Arguments
  include_top   Whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   One of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded. Defaults to 'imagenet'.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   Optional shape tuple, only to be specified if include_top is False. It should have exactly 3 inputs channels.
  pooling   Optional pooling mode for feature extraction when include_top is False. Defaults to None.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Defaults to 1000 (number of ImageNet classes).
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer. Defaults to 'softmax'.

 Returns   A keras.Model instance.


Module: tf.keras.applications.imagenet_utils Utilities for ImageNet data preprocessing & prediction decoding. Functions decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.imagenet_utils.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.imagenet_utils.decode_predictions
tf.keras.applications.imagenet_utils.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.imagenet_utils.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.imagenet_utils.preprocess_input
tf.keras.applications.imagenet_utils.preprocess_input(
    x, data_format=None, mode='caffe'
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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   One of "caffe", "tf" or "torch". Defaults to "caffe".  caffe: will convert the images from RGB to BGR, then will zero-center each color channel with respect to the ImageNet dataset, without scaling. tf: will scale pixels between -1 and 1, sample-wise. torch: will scale pixels between 0 and 1 and then will normalize each channel with respect to the ImageNet dataset.

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32.

 Raises
  ValueError   In case of unknown mode or data_format argument.


tf.keras.applications.InceptionResNetV2     View source on GitHub    Instantiates the Inception-ResNet v2 architecture.  View aliases  Main aliases
tf.keras.applications.inception_resnet_v2.InceptionResNetV2 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.InceptionResNetV2, tf.compat.v1.keras.applications.inception_resnet_v2.InceptionResNetV2
tf.keras.applications.InceptionResNetV2(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning (AAAI 2017)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For InceptionResNetV2, call tf.keras.applications.inception_resnet_v2.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   whether to include the fully-connected layer at the top of the network.
  weights   one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (299, 299, 3) (with 'channels_last' data format) or (3, 299, 299) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 75. E.g. (150, 150, 3) would be one valid value.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
'avg' means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
'max' means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.
  **kwargs   For backwards compatibility only.

 Returns   A keras.Model instance.

 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape.
  ValueError   if classifier_activation is not softmax or None when using a pretrained top layer.


tf.keras.applications.InceptionV3     View source on GitHub    Instantiates the Inception v3 architecture.  View aliases  Main aliases
tf.keras.applications.inception_v3.InceptionV3 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.InceptionV3, tf.compat.v1.keras.applications.inception_v3.InceptionV3
tf.keras.applications.InceptionV3(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax'
)
 Reference:
Rethinking the Inception Architecture for Computer Vision (CVPR 2016)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in the tf.keras.backend.image_data_format().
Note: each Keras Application expects a specific kind of input preprocessing. For InceptionV3, call tf.keras.applications.inception_v3.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   Boolean, whether to include the fully-connected layer at the top, as the last layer of the network. Default to True.
  weights   One of None (random initialization), imagenet (pre-training on ImageNet), or the path to the weights file to be loaded. Default to imagenet.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model. input_tensor is useful for sharing inputs between multiple different networks. Default to None.
  input_shape   Optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (299, 299, 3) (with channels_last data format) or (3, 299, 299) (with channels_first data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 75. E.g. (150, 150, 3) would be one valid value. input_shape will be ignored if the input_tensor is provided.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None (default) means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified. Default to 1000.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.

 Returns   A keras.Model instance.

 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape.
  ValueError   if classifier_activation is not softmax or None when using a pretrained top layer.


Module: tf.keras.applications.inception_resnet_v2 Inception-ResNet V2 model for Keras. Reference:
Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning (AAAI 2017)  Functions InceptionResNetV2(...): Instantiates the Inception-ResNet v2 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.inception_resnet_v2.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.inception_resnet_v2.decode_predictions
tf.keras.applications.inception_resnet_v2.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.inception_resnet_v2.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.inception_resnet_v2.preprocess_input
tf.keras.applications.inception_resnet_v2.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.applications.inception_v3 Inception V3 model for Keras. Reference:
Rethinking the Inception Architecture for Computer Vision (CVPR 2016)  Functions InceptionV3(...): Instantiates the Inception v3 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.inception_v3.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.inception_v3.decode_predictions
tf.keras.applications.inception_v3.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.inception_v3.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.inception_v3.preprocess_input
tf.keras.applications.inception_v3.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


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:  MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications  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.


tf.keras.applications.mobilenet.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet.decode_predictions
tf.keras.applications.mobilenet.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.mobilenet.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet.preprocess_input
tf.keras.applications.mobilenet.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


tf.keras.applications.MobileNetV2     View source on GitHub    Instantiates the MobileNetV2 architecture.  View aliases  Main aliases
tf.keras.applications.mobilenet_v2.MobileNetV2 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.MobileNetV2, tf.compat.v1.keras.applications.mobilenet_v2.MobileNetV2
tf.keras.applications.MobileNetV2(
    input_shape=None, alpha=1.0, include_top=True, weights='imagenet',
    input_tensor=None, pooling=None, classes=1000,
    classifier_activation='softmax', **kwargs
)
 Reference:
MobileNetV2: Inverted Residuals and Linear Bottlenecks (CVPR 2018)  Optionally loads weights pre-trained on ImageNet.
Note: each Keras Application expects a specific kind of input preprocessing. For MobileNetV2, call tf.keras.applications.mobilenet_v2.preprocess_input on your inputs before passing them to the model.

 Arguments
  input_shape   Optional shape tuple, to be specified if you would like to use a model with an input image resolution that is not (224, 224, 3). It should have exactly 3 inputs channels (224, 224, 3). You can also omit this option if you would like to infer input_shape from an input_tensor. If you choose to include both input_tensor and input_shape then input_shape will be used if they match, if the shapes do not match then we will throw an error. E.g. (160, 160, 3) would be one valid value.
  alpha   Float between 0 and 1. controls the width of the network. This is known as the width multiplier in the MobileNetV2 paper, but the name is kept for consistency with applications.MobileNetV1 model in Keras.  If alpha < 1.0, proportionally decreases the number of filters in each layer. If alpha > 1.0, proportionally increases the number of filters in each layer. If alpha = 1, default number of filters from the paper are used at each layer.

  include_top   Boolean, whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   String, one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  pooling   String, optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Integer, optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.
  **kwargs   For backwards compatibility only.

 Returns   A keras.Model instance.

 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape or invalid alpha, rows when weights='imagenet'
  ValueError   if classifier_activation is not softmax or None when using a pretrained top layer.


tf.keras.applications.MobileNetV3Large Instantiates the MobileNetV3Large architecture.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.MobileNetV3Large
tf.keras.applications.MobileNetV3Large(
    input_shape=None, alpha=1.0, minimalistic=False, include_top=True,
    weights='imagenet', input_tensor=None, classes=1000, pooling=None,
    dropout_rate=0.2, classifier_activation='softmax'
)
 Reference:
Searching for MobileNetV3 (ICCV 2019)  The following table describes the performance of MobileNets: MACs stands for Multiply Adds    Classification Checkpoint MACs(M) Parameters(M) Top1 Accuracy Pixel1 CPU(ms)     mobilenet_v3_large_1.0_224 217 5.4 75.6 51.2   mobilenet_v3_large_0.75_224 155 4.0 73.3 39.8   mobilenet_v3_large_minimalistic_1.0_224 209 3.9 72.3 44.1   mobilenet_v3_small_1.0_224 66 2.9 68.1 15.8   mobilenet_v3_small_0.75_224 44 2.4 65.4 12.8   mobilenet_v3_small_minimalistic_1.0_224 65 2.0 61.9 12.2    The weights for all 6 models are obtained and translated from the Tensorflow checkpoints from TensorFlow checkpoints found here. Optionally loads weights pre-trained on ImageNet.
Note: each Keras Application expects a specific kind of input preprocessing. For MobileNetV3, call tf.keras.applications.mobilenet_v3.preprocess_input on your inputs before passing them to the model.

 Arguments
  input_shape   Optional shape tuple, to be specified if you would like to use a model with an input image resolution that is not (224, 224, 3). It should have exactly 3 inputs channels (224, 224, 3). You can also omit this option if you would like to infer input_shape from an input_tensor. If you choose to include both input_tensor and input_shape then input_shape will be used if they match, if the shapes do not match then we will throw an error. E.g. (160, 160, 3) would be one valid value.
  alpha   controls the width of the network. This is known as the depth multiplier in the MobileNetV3 paper, but the name is kept for consistency with MobileNetV1 in Keras.  If alpha < 1.0, proportionally decreases the number of filters in each layer. If alpha > 1.0, proportionally increases the number of filters in each layer. If alpha = 1, default number of filters from the paper are used at each layer.

  minimalistic   In addition to large and small models this module also contains so-called minimalistic models, these models have the same per-layer dimensions characteristic as MobilenetV3 however, they don't utilize any of the advanced blocks (squeeze-and-excite units, hard-swish, and 5x5 convolutions). While these models are less efficient on CPU, they are much more performant on GPU/DSP.
  include_top   Boolean, whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   String, one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  pooling   String, optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Integer, optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  dropout_rate   fraction of the input units to drop on the last layer.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.

 Returns   A keras.Model instance.

 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape or invalid alpha, rows when weights='imagenet'
  ValueError   if classifier_activation is not softmax or None when using a pretrained top layer.


tf.keras.applications.MobileNetV3Small Instantiates the MobileNetV3Small architecture.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.MobileNetV3Small
tf.keras.applications.MobileNetV3Small(
    input_shape=None, alpha=1.0, minimalistic=False, include_top=True,
    weights='imagenet', input_tensor=None, classes=1000, pooling=None,
    dropout_rate=0.2, classifier_activation='softmax'
)
 Reference:
Searching for MobileNetV3 (ICCV 2019)  The following table describes the performance of MobileNets: MACs stands for Multiply Adds    Classification Checkpoint MACs(M) Parameters(M) Top1 Accuracy Pixel1 CPU(ms)     mobilenet_v3_large_1.0_224 217 5.4 75.6 51.2   mobilenet_v3_large_0.75_224 155 4.0 73.3 39.8   mobilenet_v3_large_minimalistic_1.0_224 209 3.9 72.3 44.1   mobilenet_v3_small_1.0_224 66 2.9 68.1 15.8   mobilenet_v3_small_0.75_224 44 2.4 65.4 12.8   mobilenet_v3_small_minimalistic_1.0_224 65 2.0 61.9 12.2    The weights for all 6 models are obtained and translated from the Tensorflow checkpoints from TensorFlow checkpoints found here. Optionally loads weights pre-trained on ImageNet.
Note: each Keras Application expects a specific kind of input preprocessing. For MobileNetV3, call tf.keras.applications.mobilenet_v3.preprocess_input on your inputs before passing them to the model.

 Arguments
  input_shape   Optional shape tuple, to be specified if you would like to use a model with an input image resolution that is not (224, 224, 3). It should have exactly 3 inputs channels (224, 224, 3). You can also omit this option if you would like to infer input_shape from an input_tensor. If you choose to include both input_tensor and input_shape then input_shape will be used if they match, if the shapes do not match then we will throw an error. E.g. (160, 160, 3) would be one valid value.
  alpha   controls the width of the network. This is known as the depth multiplier in the MobileNetV3 paper, but the name is kept for consistency with MobileNetV1 in Keras.  If alpha < 1.0, proportionally decreases the number of filters in each layer. If alpha > 1.0, proportionally increases the number of filters in each layer. If alpha = 1, default number of filters from the paper are used at each layer.

  minimalistic   In addition to large and small models this module also contains so-called minimalistic models, these models have the same per-layer dimensions characteristic as MobilenetV3 however, they don't utilize any of the advanced blocks (squeeze-and-excite units, hard-swish, and 5x5 convolutions). While these models are less efficient on CPU, they are much more performant on GPU/DSP.
  include_top   Boolean, whether to include the fully-connected layer at the top of the network. Defaults to True.
  weights   String, one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  pooling   String, optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Integer, optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  dropout_rate   fraction of the input units to drop on the last layer.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.

 Returns   A keras.Model instance.

 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape or invalid alpha, rows when weights='imagenet'
  ValueError   if classifier_activation is not softmax or None when using a pretrained top layer.


Module: tf.keras.applications.mobilenet_v2 MobileNet v2 models for Keras. MobileNetV2 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. MobileNetV2 is very similar to the original MobileNet, except that it uses inverted residual blocks with bottlenecking features. It has a drastically lower parameter count than the original MobileNet. 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 22 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.35, 0.5, 0.75, 1.0, 1.3, and 1.4 For each of these alpha values, weights for 5 different input image sizes are provided (224, 192, 160, 128, and 96). The following table describes the performance of MobileNet on various input sizes: MACs stands for Multiply Adds Classification Checkpoint|MACs (M)|Parameters (M)|Top 1 Accuracy|Top 5 Accuracy --------------------------|------------|---------------|---------|----|--------- | [mobilenet_v2_1.4_224] | 582 | 6.06 | 75.0 | 92.5 | | [mobilenet_v2_1.3_224] | 509 | 5.34 | 74.4 | 92.1 | | [mobilenet_v2_1.0_224] | 300 | 3.47 | 71.8 | 91.0 | | [mobilenet_v2_1.0_192] | 221 | 3.47 | 70.7 | 90.1 | | [mobilenet_v2_1.0_160] | 154 | 3.47 | 68.8 | 89.0 | | [mobilenet_v2_1.0_128] | 99 | 3.47 | 65.3 | 86.9 | | [mobilenet_v2_1.0_96] | 56 | 3.47 | 60.3 | 83.2 | | [mobilenet_v2_0.75_224] | 209 | 2.61 | 69.8 | 89.6 | | [mobilenet_v2_0.75_192] | 153 | 2.61 | 68.7 | 88.9 | | [mobilenet_v2_0.75_160] | 107 | 2.61 | 66.4 | 87.3 | | [mobilenet_v2_0.75_128] | 69 | 2.61 | 63.2 | 85.3 | | [mobilenet_v2_0.75_96] | 39 | 2.61 | 58.8 | 81.6 | | [mobilenet_v2_0.5_224] | 97 | 1.95 | 65.4 | 86.4 | | [mobilenet_v2_0.5_192] | 71 | 1.95 | 63.9 | 85.4 | | [mobilenet_v2_0.5_160] | 50 | 1.95 | 61.0 | 83.2 | | [mobilenet_v2_0.5_128] | 32 | 1.95 | 57.7 | 80.8 | | [mobilenet_v2_0.5_96] | 18 | 1.95 | 51.2 | 75.8 | | [mobilenet_v2_0.35_224] | 59 | 1.66 | 60.3 | 82.9 | | [mobilenet_v2_0.35_192] | 43 | 1.66 | 58.2 | 81.2 | | [mobilenet_v2_0.35_160] | 30 | 1.66 | 55.7 | 79.1 | | [mobilenet_v2_0.35_128] | 20 | 1.66 | 50.8 | 75.0 | | [mobilenet_v2_0.35_96] | 11 | 1.66 | 45.5 | 70.4 | Reference:
MobileNetV2: Inverted Residuals and Linear Bottlenecks (CVPR 2018)  Functions MobileNetV2(...): Instantiates the MobileNetV2 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.mobilenet_v2.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v2.decode_predictions
tf.keras.applications.mobilenet_v2.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.mobilenet_v2.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v2.preprocess_input
tf.keras.applications.mobilenet_v2.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.applications.mobilenet_v3 MobileNet v3 models for Keras. Functions decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.mobilenet_v3.decode_predictions Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v3.decode_predictions
tf.keras.applications.mobilenet_v3.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.mobilenet_v3.preprocess_input Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v3.preprocess_input
tf.keras.applications.mobilenet_v3.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.applications.nasnet NASNet-A models for Keras. NASNet refers to Neural Architecture Search Network, a family of models that were designed automatically by learning the model architectures directly on the dataset of interest. Here we consider NASNet-A, the highest performance model that was found for the CIFAR-10 dataset, and then extended to ImageNet 2012 dataset, obtaining state of the art performance on CIFAR-10 and ImageNet 2012. Only the NASNet-A models, and their respective weights, which are suited for ImageNet 2012 are provided. The below table describes the performance on ImageNet 2012: Architecture       | Top-1 Acc | Top-5 Acc |  Multiply-Adds |  Params (M)
 | NASNet-A (4 @ 1056) | 74.0 % | 91.6 % | 564 M | 5.3 | | NASNet-A (6 @ 4032) | 82.7 % | 96.2 % | 23.8 B | 88.9 | Reference:
Learning Transferable Architectures for Scalable Image Recognition (CVPR 2018)  Functions NASNetLarge(...): Instantiates a NASNet model in ImageNet mode. NASNetMobile(...): Instantiates a Mobile NASNet model in ImageNet mode. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.nasnet.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.nasnet.decode_predictions
tf.keras.applications.nasnet.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.nasnet.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.nasnet.preprocess_input
tf.keras.applications.nasnet.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


tf.keras.applications.NASNetLarge     View source on GitHub    Instantiates a NASNet model in ImageNet mode.  View aliases  Main aliases
tf.keras.applications.nasnet.NASNetLarge Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.NASNetLarge, tf.compat.v1.keras.applications.nasnet.NASNetLarge
tf.keras.applications.NASNetLarge(
    input_shape=None, include_top=True, weights='imagenet',
    input_tensor=None, pooling=None, classes=1000
)
 Reference:
Learning Transferable Architectures for Scalable Image Recognition (CVPR 2018)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For NASNet, call tf.keras.applications.nasnet.preprocess_input on your inputs before passing them to the model.

 Arguments
  input_shape   Optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (331, 331, 3) for NASNetLarge. It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (224, 224, 3) would be one valid value.
  include_top   Whether to include the fully-connected layer at the top of the network.
  weights   None (random initialization) or imagenet (ImageNet weights) For loading imagenet weights, input_shape should be (331, 331, 3)
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.

 Returns   A Keras model instance.

 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape.
  RuntimeError   If attempting to run this model with a backend that does not support separable convolutions.


tf.keras.applications.NASNetMobile     View source on GitHub    Instantiates a Mobile NASNet model in ImageNet mode.  View aliases  Main aliases
tf.keras.applications.nasnet.NASNetMobile Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.NASNetMobile, tf.compat.v1.keras.applications.nasnet.NASNetMobile
tf.keras.applications.NASNetMobile(
    input_shape=None, include_top=True, weights='imagenet',
    input_tensor=None, pooling=None, classes=1000
)
 Reference:
Learning Transferable Architectures for Scalable Image Recognition (CVPR 2018)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For NASNet, call tf.keras.applications.nasnet.preprocess_input on your inputs before passing them to the model.

 Arguments
  input_shape   Optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) for NASNetMobile It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (224, 224, 3) would be one valid value.
  include_top   Whether to include the fully-connected layer at the top of the network.
  weights   None (random initialization) or imagenet (ImageNet weights) For loading imagenet weights, input_shape should be (224, 224, 3)
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional layer.
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.

 Returns   A Keras model instance.

 Raises
  ValueError   In case of invalid argument for weights, or invalid input shape.
  RuntimeError   If attempting to run this model with a backend that does not support separable convolutions.


Module: tf.keras.applications.resnet ResNet models for Keras. Reference:
Deep Residual Learning for Image Recognition (CVPR 2015)  Functions ResNet101(...): Instantiates the ResNet101 architecture. ResNet152(...): Instantiates the ResNet152 architecture. ResNet50(...): Instantiates the ResNet50 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.resnet.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Main aliases
tf.keras.applications.resnet50.decode_predictions Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.resnet.decode_predictions, tf.compat.v1.keras.applications.resnet50.decode_predictions
tf.keras.applications.resnet.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.resnet.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Main aliases
tf.keras.applications.resnet50.preprocess_input Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.resnet.preprocess_input, tf.compat.v1.keras.applications.resnet50.preprocess_input
tf.keras.applications.resnet.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The images are converted from RGB to BGR, then each color channel is zero-centered with respect to the ImageNet dataset, without scaling.

 Raises
  ValueError   In case of unknown data_format argument.


tf.keras.applications.ResNet101     View source on GitHub    Instantiates the ResNet101 architecture.  View aliases  Main aliases
tf.keras.applications.resnet.ResNet101 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.ResNet101, tf.compat.v1.keras.applications.resnet.ResNet101
tf.keras.applications.ResNet101(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000, **kwargs
)
 Reference:
Deep Residual Learning for Image Recognition (CVPR 2015)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For ResNet, call tf.keras.applications.resnet.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   whether to include the fully-connected layer at the top of the network.
  weights   one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) (with 'channels_last' data format) or (3, 224, 224) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.

 Returns   A Keras model instance.


tf.keras.applications.ResNet101V2     View source on GitHub    Instantiates the ResNet101V2 architecture.  View aliases  Main aliases
tf.keras.applications.resnet_v2.ResNet101V2 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.ResNet101V2, tf.compat.v1.keras.applications.resnet_v2.ResNet101V2
tf.keras.applications.ResNet101V2(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax'
)
 Reference:
Identity Mappings in Deep Residual Networks (CVPR 2016)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For ResNetV2, call tf.keras.applications.resnet_v2.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   whether to include the fully-connected layer at the top of the network.
  weights   one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) (with 'channels_last' data format) or (3, 224, 224) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.

 Returns   A keras.Model instance.


tf.keras.applications.ResNet152     View source on GitHub    Instantiates the ResNet152 architecture.  View aliases  Main aliases
tf.keras.applications.resnet.ResNet152 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.ResNet152, tf.compat.v1.keras.applications.resnet.ResNet152
tf.keras.applications.ResNet152(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000, **kwargs
)
 Reference:
Deep Residual Learning for Image Recognition (CVPR 2015)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For ResNet, call tf.keras.applications.resnet.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   whether to include the fully-connected layer at the top of the network.
  weights   one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) (with 'channels_last' data format) or (3, 224, 224) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.

 Returns   A Keras model instance.


tf.keras.applications.ResNet152V2     View source on GitHub    Instantiates the ResNet152V2 architecture.  View aliases  Main aliases
tf.keras.applications.resnet_v2.ResNet152V2 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.ResNet152V2, tf.compat.v1.keras.applications.resnet_v2.ResNet152V2
tf.keras.applications.ResNet152V2(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax'
)
 Reference:
Identity Mappings in Deep Residual Networks (CVPR 2016)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For ResNetV2, call tf.keras.applications.resnet_v2.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   whether to include the fully-connected layer at the top of the network.
  weights   one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) (with 'channels_last' data format) or (3, 224, 224) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.

 Returns   A keras.Model instance.


Module: tf.keras.applications.resnet50 Public API for tf.keras.applications.resnet50 namespace. Functions ResNet50(...): Instantiates the ResNet50 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.ResNet50V2     View source on GitHub    Instantiates the ResNet50V2 architecture.  View aliases  Main aliases
tf.keras.applications.resnet_v2.ResNet50V2 Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.ResNet50V2, tf.compat.v1.keras.applications.resnet_v2.ResNet50V2
tf.keras.applications.ResNet50V2(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax'
)
 Reference:
Identity Mappings in Deep Residual Networks (CVPR 2016)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json.
Note: each Keras Application expects a specific kind of input preprocessing. For ResNetV2, call tf.keras.applications.resnet_v2.preprocess_input on your inputs before passing them to the model.

 Arguments
  include_top   whether to include the fully-connected layer at the top of the network.
  weights   one of None (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.
  input_tensor   optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  input_shape   optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) (with 'channels_last' data format) or (3, 224, 224) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.
  pooling   Optional pooling mode for feature extraction when include_top is False.
None means that the output of the model will be the 4D tensor output of the last convolutional block.
avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max means that global max pooling will be applied.

  classes   optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.
  classifier_activation   A str or callable. The activation function to use on the "top" layer. Ignored unless include_top=True. Set classifier_activation=None to return the logits of the "top" layer.

 Returns   A keras.Model instance.


Module: tf.keras.applications.resnet_v2 ResNet v2 models for Keras. Reference:
Identity Mappings in Deep Residual Networks (CVPR 2016)  Functions ResNet101V2(...): Instantiates the ResNet101V2 architecture. ResNet152V2(...): Instantiates the ResNet152V2 architecture. ResNet50V2(...): Instantiates the ResNet50V2 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.resnet_v2.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.resnet_v2.decode_predictions
tf.keras.applications.resnet_v2.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.resnet_v2.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.resnet_v2.preprocess_input
tf.keras.applications.resnet_v2.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.applications.vgg16 VGG16 model for Keras. Reference:
Very Deep Convolutional Networks for Large-Scale Image Recognition (ICLR 2015)  Functions VGG16(...): Instantiates the VGG16 model. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.vgg16.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.vgg16.decode_predictions
tf.keras.applications.vgg16.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.vgg16.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.vgg16.preprocess_input
tf.keras.applications.vgg16.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The images are converted from RGB to BGR, then each color channel is zero-centered with respect to the ImageNet dataset, without scaling.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.applications.vgg19 VGG19 model for Keras. Reference:
Very Deep Convolutional Networks for Large-Scale Image Recognition (ICLR 2015)  Functions VGG19(...): Instantiates the VGG19 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.vgg19.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.vgg19.decode_predictions
tf.keras.applications.vgg19.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.vgg19.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.vgg19.preprocess_input
tf.keras.applications.vgg19.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The images are converted from RGB to BGR, then each color channel is zero-centered with respect to the ImageNet dataset, without scaling.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.applications.xception Xception V1 model for Keras. On ImageNet, this model gets to a top-1 validation accuracy of 0.790 and a top-5 validation accuracy of 0.945. Reference:
Xception: Deep Learning with Depthwise Separable Convolutions (CVPR 2017)  Functions Xception(...): Instantiates the Xception architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.


tf.keras.applications.xception.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.xception.decode_predictions
tf.keras.applications.xception.decode_predictions(
    preds, top=5
)

 Arguments
  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).


tf.keras.applications.xception.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.applications.xception.preprocess_input
tf.keras.applications.xception.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.
  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").

 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise.

 Raises
  ValueError   In case of unknown data_format argument.


Module: tf.keras.backend Keras backend API. Functions clear_session(...): Resets all state generated by Keras. epsilon(...): Returns the value of the fuzz factor used in numeric expressions. floatx(...): Returns the default float type, as a string. get_uid(...): Associates a string prefix with an integer counter in a TensorFlow graph. image_data_format(...): Returns the default image data format convention. is_keras_tensor(...): Returns whether x is a Keras tensor. reset_uids(...): Resets graph identifiers. rnn(...): Iterates over the time dimension of a tensor. set_epsilon(...): Sets the value of the fuzz factor used in numeric expressions. set_floatx(...): Sets the default float type. set_image_data_format(...): Sets the value of the image data format convention.


tf.keras.backend.clear_session     View source on GitHub    Resets all state generated by Keras.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.clear_session
tf.keras.backend.clear_session()
 Keras manages a global state, which it uses to implement the Functional model-building API and to uniquify autogenerated layer names. If you are creating many models in a loop, this global state will consume an increasing amount of memory over time, and you may want to clear it. Calling clear_session() releases the global state: this helps avoid clutter from old models and layers, especially when memory is limited. Example 1: calling clear_session() when creating models in a loop for _ in range(100):
  # Without `clear_session()`, each iteration of this loop will
  # slightly increase the size of the global state managed by Keras
  model = tf.keras.Sequential([tf.keras.layers.Dense(10) for _ in range(10)])

for _ in range(100):
  # With `clear_session()` called at the beginning,
  # Keras starts with a blank state at each iteration
  # and memory consumption is constant over time.
  tf.keras.backend.clear_session()
  model = tf.keras.Sequential([tf.keras.layers.Dense(10) for _ in range(10)])
 Example 2: resetting the layer name generation counter
import tensorflow as tf
layers = [tf.keras.layers.Dense(10) for _ in range(10)]
new_layer = tf.keras.layers.Dense(10)
print(new_layer.name)
dense_10
tf.keras.backend.set_learning_phase(1)
print(tf.keras.backend.learning_phase())
1
tf.keras.backend.clear_session()
new_layer = tf.keras.layers.Dense(10)
print(new_layer.name)
dense


tf.keras.backend.epsilon     View source on GitHub    Returns the value of the fuzz factor used in numeric expressions.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.epsilon
tf.keras.backend.epsilon()

 Returns   A float.
 Example:
tf.keras.backend.epsilon()
1e-07


tf.keras.backend.floatx     View source on GitHub    Returns the default float type, as a string.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.floatx
tf.keras.backend.floatx()
 E.g. 'float16', 'float32', 'float64'.

 Returns   String, the current default float type.
 Example:
tf.keras.backend.floatx()
'float32'


tf.keras.backend.get_uid     View source on GitHub    Associates a string prefix with an integer counter in a TensorFlow graph.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.get_uid
tf.keras.backend.get_uid(
    prefix=''
)

 Arguments
  prefix   String prefix to index.

 Returns   Unique integer ID.
 Example:
get_uid('dense')
1
get_uid('dense')
2


tf.keras.backend.image_data_format     View source on GitHub    Returns the default image data format convention.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.image_data_format
tf.keras.backend.image_data_format()

 Returns   A string, either 'channels_first' or 'channels_last'
 Example:
tf.keras.backend.image_data_format()
'channels_last'


tf.keras.backend.is_keras_tensor Returns whether x is a Keras tensor.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.is_keras_tensor
tf.keras.backend.is_keras_tensor(
    x
)
 A "Keras tensor" is a tensor that was returned by a Keras layer, (Layer class) or by Input.

 Arguments
  x   A candidate tensor.

 Returns   A boolean: Whether the argument is a Keras tensor.

 Raises
  ValueError   In case x is not a symbolic tensor.    Examples:
np_var = np.array([1, 2])
# A numpy array is not a symbolic tensor.
tf.keras.backend.is_keras_tensor(np_var)
Traceback (most recent call last):

ValueError: Unexpectedly found an instance of type `<class 'numpy.ndarray'>`.
Expected a symbolic tensor instance.
keras_var = tf.keras.backend.variable(np_var)
# A variable created with the keras backend is not a Keras tensor.
tf.keras.backend.is_keras_tensor(keras_var)
False
keras_placeholder = tf.keras.backend.placeholder(shape=(2, 4, 5))
# A placeholder is a Keras tensor.
tf.keras.backend.is_keras_tensor(keras_placeholder)
True
keras_input = tf.keras.layers.Input([10])
# An Input is a Keras tensor.
tf.keras.backend.is_keras_tensor(keras_input)
True
keras_layer_output = tf.keras.layers.Dense(10)(keras_input)
# Any Keras layer output is a Keras tensor.
tf.keras.backend.is_keras_tensor(keras_layer_output)
True


tf.keras.backend.reset_uids     View source on GitHub    Resets graph identifiers.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.reset_uids
tf.keras.backend.reset_uids()


tf.keras.backend.rnn     View source on GitHub    Iterates over the time dimension of a tensor.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.rnn
tf.keras.backend.rnn(
    step_function, inputs, initial_states, go_backwards=False, mask=None,
    constants=None, unroll=False, input_length=None, time_major=False,
    zero_output_for_mask=False
)

 Arguments
  step_function   RNN step function. Args; input; Tensor with shape (samples, ...) (no time dimension), representing input for the batch of samples at a certain time step. states; List of tensors. Returns; output; Tensor with shape (samples, output_dim) (no time dimension). new_states; List of tensors, same length and shapes as 'states'. The first state in the list must be the output tensor at the previous timestep.
  inputs   Tensor of temporal data of shape (samples, time, ...) (at least 3D), or nested tensors, and each of which has shape (samples, time, ...).
  initial_states   Tensor with shape (samples, state_size) (no time dimension), containing the initial values for the states used in the step function. In the case that state_size is in a nested shape, the shape of initial_states will also follow the nested structure.
  go_backwards   Boolean. If True, do the iteration over the time dimension in reverse order and return the reversed sequence.
  mask   Binary tensor with shape (samples, time, 1), with a zero for every element that is masked.
  constants   List of constant values passed at each step.
  unroll   Whether to unroll the RNN or to use a symbolic while_loop.
  input_length   An integer or a 1-D Tensor, depending on whether the time dimension is fixed-length or not. In case of variable length input, it is used for masking in case there's no mask specified.
  time_major   Boolean. If true, the inputs and outputs will be in shape (timesteps, batch, ...), whereas in the False case, it will be (batch, timesteps, ...). Using time_major = True is a bit more efficient because it avoids transposes at the beginning and end of the RNN calculation. However, most TensorFlow data is batch-major, so by default this function accepts input and emits output in batch-major form.
  zero_output_for_mask   Boolean. If True, the output for masked timestep will be zeros, whereas in the False case, output from previous timestep is returned.

 Returns   A tuple, (last_output, outputs, new_states). last_output: the latest output of the rnn, of shape (samples, ...) outputs: tensor with shape (samples, time, ...) where each entry outputs[s, t] is the output of the step function at time t for sample s. new_states: list of tensors, latest states returned by the step function, of shape (samples, ...).

 Raises
  ValueError   if input dimension is less than 3.
  ValueError   if unroll is True but input timestep is not a fixed number.
  ValueError   if mask is provided (not None) but states is not provided (len(states) == 0).


tf.keras.backend.set_epsilon     View source on GitHub    Sets the value of the fuzz factor used in numeric expressions.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.set_epsilon
tf.keras.backend.set_epsilon(
    value
)

 Arguments
  value   float. New value of epsilon.    Example:
tf.keras.backend.epsilon()
1e-07
tf.keras.backend.set_epsilon(1e-5)
tf.keras.backend.epsilon()
1e-05
tf.keras.backend.set_epsilon(1e-7)


tf.keras.backend.set_floatx     View source on GitHub    Sets the default float type.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.set_floatx
tf.keras.backend.set_floatx(
    value
)

Note: It is not recommended to set this to float16 for training, as this will likely cause numeric stability issues. Instead, mixed precision, which is using a mix of float16 and float32, can be used by calling tf.keras.mixed_precision.experimental.set_policy('mixed_float16'). See the mixed precision guide for details.

 Arguments
  value   String; 'float16', 'float32', or 'float64'.    Example:
tf.keras.backend.floatx()
'float32'
tf.keras.backend.set_floatx('float64')
tf.keras.backend.floatx()
'float64'
tf.keras.backend.set_floatx('float32')

 Raises
  ValueError   In case of invalid value.


tf.keras.backend.set_image_data_format     View source on GitHub    Sets the value of the image data format convention.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.backend.set_image_data_format
tf.keras.backend.set_image_data_format(
    data_format
)

 Arguments
  data_format   string. 'channels_first' or 'channels_last'.    Example:
tf.keras.backend.image_data_format()
'channels_last'
tf.keras.backend.set_image_data_format('channels_first')
tf.keras.backend.image_data_format()
'channels_first'
tf.keras.backend.set_image_data_format('channels_last')

 Raises
  ValueError   In case of invalid data_format value.


Module: tf.keras.callbacks Callbacks: utilities called at certain points during model training. Modules experimental module: Public API for tf.keras.callbacks.experimental namespace. Classes class BaseLogger: Callback that accumulates epoch averages of metrics. class CSVLogger: Callback that streams epoch results to a CSV file. class Callback: Abstract base class used to build new callbacks. class CallbackList: Container abstracting a list of callbacks. class EarlyStopping: Stop training when a monitored metric has stopped improving. class History: Callback that records events into a History object. class LambdaCallback: Callback for creating simple, custom callbacks on-the-fly. class LearningRateScheduler: Learning rate scheduler. class ModelCheckpoint: Callback to save the Keras model or model weights at some frequency. class ProgbarLogger: Callback that prints metrics to stdout. class ReduceLROnPlateau: Reduce learning rate when a metric has stopped improving. class RemoteMonitor: Callback used to stream events to a server. class TensorBoard: Enable visualizations for TensorBoard. class TerminateOnNaN: Callback that terminates training when a NaN loss is encountered.


tf.keras.callbacks.BaseLogger     View source on GitHub    Callback that accumulates epoch averages of metrics. Inherits From: Callback  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.keras.callbacks.BaseLogger
tf.keras.callbacks.BaseLogger(
    stateful_metrics=None
)
 This callback is automatically applied to every Keras model.

 Arguments
  stateful_metrics   Iterable of string names of metrics that should not be averaged over an epoch. Metrics in this list will be logged as-is in on_epoch_end. All others will be averaged in on_epoch_end.    Methods set_model View source
set_model(
    model
)
 set_params View source
set_params(
    params
)