Learn R Programming

keras (version 2.8.0)

application_mobilenet_v2: MobileNetV2 model architecture

Description

MobileNetV2 model architecture

Usage

application_mobilenet_v2(
  input_shape = NULL,
  alpha = 1,
  include_top = TRUE,
  weights = "imagenet",
  input_tensor = NULL,
  pooling = NULL,
  classes = 1000,
  classifier_activation = "softmax",
  ...
)

mobilenet_v2_preprocess_input(x)

mobilenet_v2_decode_predictions(preds, top = 5)

mobilenet_v2_load_model_hdf5(filepath)

Arguments

input_shape

optional shape list, 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.

alpha

controls the width of the network.

  • 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

whether to include the fully-connected layer at the top of the network.

weights

NULL (random initialization), imagenet (ImageNet weights), or the path to the weights file to be loaded.

input_tensor

optional Keras tensor (i.e. output of layer_input()) to use as image input for the model.

pooling

Optional pooling mode for feature extraction when include_top is FALSE. - NULL 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.

classifier_activation

A string or callable. The activation function to use on the "top" layer. Ignored unless include_top = TRUE. Set classifier_activation = NULL to return the logits of the "top" layer. Defaults to 'softmax'. When loading pretrained weights, classifier_activation can only be NULL or "softmax".

...

For backwards and forwards compatibility

x

input tensor, 4D

preds

Tensor encoding a batch of predictions.

top

integer, how many top-guesses to return.

filepath

File path

Value

application_mobilenet_v2() and mobilenet_v2_load_model_hdf5() return a Keras model instance. mobilenet_v2_preprocess_input() returns image input suitable for feeding into a mobilenet v2 model. mobilenet_v2_decode_predictions() returns a list of data frames with variables class_name, class_description, and score (one data frame per sample in batch input).

See Also

application_mobilenet