mobilenet_v3: MobileNetV3 model

mobilenet_v3R Documentation

MobileNetV3 model

Description

MobileNetV3 model

Usage

mobilenet_v3(
  include_top = TRUE,
  weights = "imagenet",
  input_tensor = NULL,
  input_shape = NULL,
  classes = 1000,
  classifier_activation = "softmax",
  type = c("large", "small"),
  minimalistic = FALSE,
  alpha = 1
)

Arguments

include_top

Whether to include the fully-connected layer at the top of the network. A model without a top will output activations from the last convolutional or pooling layer directly.

weights

One of NULL (random initialization), 'imagenet' (pre-trained weights), an array, or the path to the weights file to be loaded.

input_tensor

Optional tensor to use as image input for the model.

input_shape

Dimensionality of the input not including the samples axis.

classes

Optional number of classes or labels to classify images into, only to be specified if include_top = TRUE.

classifier_activation

A string or callable for the activation function to use on top layer, only if include_top = TRUE.

type

Model type either large (default) or small. These models are targeted at high and low resource use cases respectively.

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 (graphics processor unit)/DSP (digital signal processor).

alpha

Controls the width of the network. This is known as the width multiplier in the MobileNetV3 paper, but the name is kept for consistency with MobileNetV1.

  • 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.0, default number of filters from the paper are used at each layer.

Details

The input shape is usually c(height, width, channels) for a 2D image. If no input shape is specified the default shape 224x224x3 is used.
The number of classes can be computed in three steps. First, build a factor of the labels (classes). Second, use as_CNN_image_Y to one-hot encode the outcome created in the first step. Third, use nunits to get the number of classes. The result is equal to nlevels used on the result of the first step.

For a n-ary classification problem with single-label associations, the output is either one-hot encoded with categorical_crossentropy loss function or binary encoded (0,1) with sparse_categorical_crossentropy loss function. In both cases, the output activation function is softmax.
For a n-ary classification problem with multi-label associations, the output is one-hot encoded with sigmoid activation function and binary_crossentropy loss function.

For a task with another top layer block, e.g. a regression problem, use the following code template:

base_model <- mobilenet_v3(include_top = FALSE)
base_model$trainable <- FALSE
outputs <- base_model$output %>%
layer_flatten()
layer_dense(units = 1, activation = "linear")
model <- keras_model(inputs = base_model$input, outputs = outputs)

inputs <- layer_input(shape = c(256, 256, 3))
blocks <- inputs %>%
layer_conv_2d_transpose(filters = 3, kernel_size = c(1, 1)) %>%
layer_max_pooling_2d()
model <- mobilenet_v3(input_tensor = blocks)

Value

A CNN model object from type MobileNetV3.

References

Howard, A., Sandler, M., Chu, G., Chen, L.-C., Chen, B., Tan, M., Wang, W., Zhu, Y., Pang, R., Vasudevan, V., Le, Q. V., Adam, H. (2019): Searching for MobileNetV3. arXiv:1905.02244v5 cs. https://arxiv.org/abs/1905.02244.
https://arxiv.org/pdf/1905.02244.pdf

see also https://github.com/keras-team/keras-applications/blob/master/keras_applications/mobilenet_v3.py

See Also

Other Convolutional Neural Network (CNN): alexnet(), as_CNN_image_X(), as_CNN_image_Y(), as_CNN_temp_X(), as_CNN_temp_Y(), as_images_array(), as_images_tensor(), images_load(), images_resize(), inception_resnet_v2(), inception_v3(), lenet5(), mobilenet(), mobilenet_v2(), nasnet(), resnet, unet(), vgg, xception(), zfnet()


stschn/deepANN documentation built on June 25, 2024, 7:27 a.m.