Models
The API reference for available models in Metalhead.jl
.
Metalhead.VGG
— TypeVGG(imsize::Dims{2}; config, inchannels, batchnorm = false, nclasses, fcsize, dropout_rate)
Construct a VGG model with the specified input image size. Typically, the image size is (224, 224)
.
Keyword Arguments:
config
: VGG convolutional block configuration. It is defined as a vector of tuples(output_channels, num_convolutions)
for each blockinchannels
: number of input channelsbatchnorm
: set totrue
to use batch normalization after each convolutionnclasses
: number of output classesfcsize
: intermediate fully connected layer size (seeMetalhead.vgg_classifier_layers
)dropout_rate
: dropout level between fully connected layers
Metalhead.ResNet
— TypeResNet(depth::Integer; pretrain::Bool = false, inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a ResNet model with the specified depth. ((reference)[https://arxiv.org/abs/1512.03385])
Arguments
depth
: one of[18, 34, 50, 101, 152]
. The depth of the ResNet model.pretrain
: set totrue
to load the model with pre-trained weights for ImageNetinchannels
: The number of input channels.nclasses
: the number of output classes
Advanced users who want more configuration options will be better served by using resnet
.
Metalhead.WideResNet
— TypeWideResNet(depth::Integer; pretrain::Bool = false, inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a Wide ResNet model with the specified depth. The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same. ((reference)[https://arxiv.org/abs/1605.07146])
Arguments
depth
: one of[18, 34, 50, 101, 152]
. The depth of the Wide ResNet model.pretrain
: set totrue
to load the model with pre-trained weights for ImageNetinchannels
: The number of input channels.nclasses
: the number of output classes
Advanced users who want more configuration options will be better served by using resnet
.
Metalhead.GoogLeNet
— TypeGoogLeNet(; pretrain::Bool = false, inchannels::Integer = 3, nclasses::Integer = 1000)
Create an Inception-v1 model (commonly referred to as GoogLeNet
) (reference).
Arguments
pretrain
: set totrue
to load the model with pre-trained weights for ImageNetnclasses
: the number of output classes
GoogLeNet
does not currently support pretrained weights.
See also googlenet
.
Missing docstring for Inception-v3
. Check Documenter's build log for details.
Missing docstring for Inception-v4
. Check Documenter's build log for details.
Missing docstring for InceptionResNet-v2
. Check Documenter's build log for details.
Metalhead.SqueezeNet
— TypeSqueezeNet(; pretrain::Bool = false, inchannels::Integer = 3,
nclasses::Integer = 1000)
Create a SqueezeNet (reference).
Arguments
pretrain
: set totrue
to load the pre-trained weights for ImageNetinchannels
: number of input channels.nclasses
: the number of output classes.
See also squeezenet
.
Metalhead.DenseNet
— TypeDenseNet(config::Integer; pretrain::Bool = false, nclasses::Integer = 1000)
DenseNet(transition_configs::NTuple{N,Integer})
Create a DenseNet model with specified configuration. Currently supported values are (121, 161, 169, 201) (reference). Set pretrain = true
to load the model with pre-trained weights for ImageNet.
DenseNet
does not currently support pretrained weights.
See also Metalhead.densenet
.
Metalhead.ResNeXt
— TypeResNeXt(depth::Integer; pretrain::Bool = false, cardinality::Integer = 32,
base_width::Integer = 4, inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a ResNeXt model with the specified depth, cardinality, and base width. ((reference)[https://arxiv.org/abs/1611.05431])
Arguments
depth
: one of[18, 34, 50, 101, 152]
. The depth of the ResNet model.pretrain
: set totrue
to load the model with pre-trained weights for ImageNet. Supported configurations are:- depth 50, cardinality of 32 and base width of 4.
- depth 101, cardinality of 32 and base width of 8.
- depth 101, cardinality of 64 and base width of 4.
cardinality
: the number of groups to be used in the 3x3 convolution in each block.base_width
: the number of feature maps in each group.inchannels
: the number of input channels.nclasses
: the number of output classes
Advanced users who want more configuration options will be better served by using resnet
.
Metalhead.MobileNetv1
— TypeMobileNetv1(width_mult = 1; inchannels::Integer = 3, pretrain::Bool = false,
nclasses::Integer = 1000)
Create a MobileNetv1 model with the baseline configuration (reference). Set pretrain
to true
to load the pretrained weights for ImageNet.
Arguments
width_mult
: Controls the number of output feature maps in each block (with 1.0 being the default in the paper; this is usually a value between 0.1 and 1.4)inchannels
: The number of input channels.pretrain
: Whether to load the pre-trained weights for ImageNetnclasses
: The number of output classes
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). Set pretrain
to true
to load the pretrained weights for ImageNet.
Arguments
width_mult
: Controls the number of output feature maps in each block (with 1.0 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
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.0 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 channels in the input.nclasses
: the number of output classes
See also Metalhead.mobilenetv3
.
Metalhead.EfficientNet
— TypeEfficientNet(config::Symbol; pretrain::Bool = false)
Create an EfficientNet model (reference). See also efficientnet
.
Arguments
config
: name of default configuration (can be:b0
,:b1
,:b2
,:b3
,:b4
,:b5
,:b6
,:b7
,:b8
)pretrain
: set totrue
to load the pre-trained weights for ImageNet
Metalhead.MLPMixer
— TypeMLPMixer(config::Symbol; patch_size::Dims{2} = (16, 16), imsize::Dims{2} = (224, 224),
inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a model with the MLPMixer architecture. (reference).
Arguments
config
: the size of the model - one ofsmall
,base
,large
orhuge
patch_size
: the size of the patchesimsize
: the size of the input imagedrop_path_rate
: Stochastic depth rateinchannels
: the number of input channelsnclasses
: number of output classes
See also Metalhead.mlpmixer
.
Metalhead.ResMLP
— TypeResMLP(config::Symbol; patch_size::Dims{2} = (16, 16), imsize::Dims{2} = (224, 224),
inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a model with the ResMLP architecture. (reference).
Arguments
config
: the size of the model - one ofsmall
,base
,large
orhuge
patch_size
: the size of the patchesimsize
: the size of the input imageinchannels
: the number of input channelsnclasses
: number of output classes
See also Metalhead.mlpmixer
.
Metalhead.gMLP
— TypegMLP(config::Symbol; patch_size::Dims{2} = (16, 16), imsize::Dims{2} = (224, 224),
inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a model with the gMLP architecture. (reference).
Arguments
config
: the size of the model - one ofsmall
,base
,large
orhuge
patch_size
: the size of the patchesimsize
: the size of the input imageinchannels
: the number of input channelsnclasses
: number of output classes
See also Metalhead.mlpmixer
.
Metalhead.ViT
— TypeViT(config::Symbol = base; imsize::Dims{2} = (256, 256), inchannels::Integer = 3,
patch_size::Dims{2} = (16, 16), pool = :class, nclasses::Integer = 1000)
Creates a Vision Transformer (ViT) model. (reference).
Arguments
config
: the model configuration, one of[:tiny, :small, :base, :large, :huge, :giant, :gigantic]
imsize
: image sizeinchannels
: number of input channelspatch_size
: size of the patchespool
: pooling type, either :class or :meannclasses
: number of classes in the output
See also Metalhead.vit
.
Metalhead.ConvNeXt
— TypeConvNeXt(config::Symbol; inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a ConvNeXt model. (reference)
Arguments
config
: The size of the model, one oftiny
,small
,base
,large
orxlarge
.inchannels
: The number of channels in the input.nclasses
: number of output classes
See also Metalhead.convnext
.
Metalhead.ConvMixer
— TypeConvMixer(config::Symbol; inchannels::Integer = 3, nclasses::Integer = 1000)
Creates a ConvMixer model. (reference)
Arguments
config
: the size of the model, either:base
,:small
or:large
inchannels
: The number of channels in the input.nclasses
: number of classes in the output