MobileNet family of models

This is the API reference for the MobileNet family of models supported by Metalhead.jl.

The higher-level model constructors

Metalhead.MobileNetv1Type
MobileNetv1(width_mult::Real = 1; pretrain::Bool = false,
            inchannels::Integer = 3, nclasses::Integer = 1000)

Create a MobileNetv1 model with the baseline configuration (reference).

Arguments

  • width_mult: Controls the number of output feature maps in each block (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
  • pretrain: Whether to load the pre-trained weights for ImageNet
  • inchannels: The number of input channels.
  • nclasses: The number of output classes
Warning

MobileNetv1 does not currently support pretrained weights.

See also Metalhead.mobilenetv1.

source
Metalhead.MobileNetv2Type
MobileNetv2(width_mult = 1.0; inchannels::Integer = 3, pretrain::Bool = false,
            nclasses::Integer = 1000)

Create a MobileNetv2 model with the specified configuration. (reference).

Arguments

  • width_mult: Controls the number of output feature maps in each block (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
  • pretrain: Whether to load the pre-trained weights for ImageNet
  • inchannels: The number of input channels.
  • nclasses: The number of output classes
Warning

MobileNetv2 does not currently support pretrained weights.

See also Metalhead.mobilenetv2.

source
Metalhead.MobileNetv3Type
MobileNetv3(config::Symbol; width_mult::Real = 1, pretrain::Bool = false,
            inchannels::Integer = 3, nclasses::Integer = 1000)

Create a MobileNetv3 model with the specified configuration. (reference). Set pretrain = true to load the model with pre-trained weights for ImageNet.

Arguments

  • config: :small or :large for the size of the model (see paper).
  • width_mult: Controls the number of output feature maps in each block (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
  • pretrain: whether to load the pre-trained weights for ImageNet
  • inchannels: number of input channels
  • nclasses: the number of output classes
Warning

MobileNetv3 does not currently support pretrained weights.

See also Metalhead.mobilenetv3.

source
Metalhead.MNASNetType
MNASNet(config::Symbol; width_mult::Real = 1, pretrain::Bool = false,
        inchannels::Integer = 3, nclasses::Integer = 1000)

Creates a MNASNet model with the specified configuration. (reference)

Arguments

  • config: configuration of the model. One of B1, A1 or small. B1 is without squeeze-and-excite layers, A1 is with squeeze-and-excite layers, and small is a smaller version of A1.
  • width_mult: Controls the number of output feature maps in each block (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
  • pretrain: Whether to load the pre-trained weights for ImageNet
  • inchannels: The number of input channels.
  • nclasses: The number of output classes
Warning

MNASNet does not currently support pretrained weights.

See also Metalhead.mnasnet.

source

The mid-level functions

Metalhead.mobilenetv1Function
mobilenetv1(width_mult::Real = 1; inplanes::Integer = 32, dropout_prob = nothing,
            inchannels::Integer = 3, nclasses::Integer = 1000)

Create a MobileNetv1 model. (reference).

Arguments

  • width_mult: Controls the number of output feature maps in each block (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
  • inplanes: Number of input channels to the first convolution layer
  • dropout_prob: Dropout probability for the classifier head. Set to nothing to disable dropout.
  • inchannels: Number of input channels.
  • nclasses: Number of output classes.
source
Metalhead.mobilenetv2Function
mobilenetv2(width_mult::Real = 1; max_width::Integer = 1280,
            inplanes::Integer = 32, dropout_prob = 0.2,
            inchannels::Integer = 3, nclasses::Integer = 1000)

Create a MobileNetv2 model. (reference).

Arguments

- `width_mult`: Controls the number of output feature maps in each block
(with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
- `max_width`: The maximum width of the network.
- `inplanes`: Number of input channels to the first convolution layer
- `dropout_prob`: Dropout probability for the classifier head. Set to `nothing` to disable dropout.
- `inchannels`: Number of input channels.
- `nclasses`: Number of output classes.
source
Metalhead.mobilenetv3Function
mobilenetv3(config::Symbol; width_mult::Real = 1, dropout_prob = 0.2,
            inchannels::Integer = 3, nclasses::Integer = 1000)

Create a MobileNetv3 model with the specified configuration. (reference).

Arguments

- `config`: The configuration of the model. Can be either `small` or `large`.
- `width_mult`: Controls the number of output feature maps in each block
  (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
- `dropout_prob`: Dropout probability for the classifier head. Set to `nothing` to disable dropout.
- `inchannels`: The number of input channels.
- `nclasses`: The number of output classes.
source
Metalhead.mnasnetFunction
mnasnet(config::Symbol; width_mult::Real = 1, max_width::Integer = 1280,
        dropout_prob = 0.2, inchannels::Integer = 3, nclasses::Integer = 1000)

Create an MNasNet model. (reference)

Arguments

  • config: configuration of the model. One of B1, A1 or small. B1 is without squeeze-and-excite layers, A1 is with squeeze-and-excite layers, and small is a smaller version of A1.
  • width_mult: Controls the number of output feature maps in each block (with 1 being the default in the paper; this is usually a value between 0.1 and 1.4)
  • max_width: Controls the maximum number of output feature maps in each block
  • dropout_prob: Dropout probability for the classifier head. Set to nothing to disable dropout.
  • inchannels: Number of input channels.
  • nclasses: Number of output classes.
source