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.MobileNetv1
— TypeMobileNetv1(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 ImageNetinchannels
: The number of input channels.nclasses
: The number of output classes
MobileNetv1
does not currently support pretrained weights.
See also Metalhead.mobilenetv1
.
Metalhead.MobileNetv2
— TypeMobileNetv2(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 ImageNetinchannels
: The number of input channels.nclasses
: The number of output classes
MobileNetv2
does not currently support pretrained weights.
See also Metalhead.mobilenetv2
.
Metalhead.MobileNetv3
— TypeMobileNetv3(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 ImageNetinchannels
: number of input channelsnclasses
: the number of output classes
MobileNetv3
does not currently support pretrained weights.
See also Metalhead.mobilenetv3
.
Metalhead.MNASNet
— TypeMNASNet(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 ofB1
,A1
orsmall
.B1
is without squeeze-and-excite layers,A1
is with squeeze-and-excite layers, andsmall
is a smaller version ofA1
.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 ImageNetinchannels
: The number of input channels.nclasses
: The number of output classes
MNASNet
does not currently support pretrained weights.
See also Metalhead.mnasnet
.
The mid-level functions
Metalhead.mobilenetv1
— Functionmobilenetv1(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 layerdropout_prob
: Dropout probability for the classifier head. Set tonothing
to disable dropout.inchannels
: Number of input channels.nclasses
: Number of output classes.
Metalhead.mobilenetv2
— Functionmobilenetv2(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.
Metalhead.mobilenetv3
— Functionmobilenetv3(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.
Metalhead.mnasnet
— Functionmnasnet(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 ofB1
,A1
orsmall
.B1
is without squeeze-and-excite layers,A1
is with squeeze-and-excite layers, andsmall
is a smaller version ofA1
.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 blockdropout_prob
: Dropout probability for the classifier head. Set tonothing
to disable dropout.inchannels
: Number of input channels.nclasses
: Number of output classes.