Other models
This is the API reference for some of the other models supported by Metalhead.jl that do not fit into the other categories.
The higher-level model constructors
Metalhead.AlexNet — TypeAlexNet(; pretrain::Bool = false, inchannels::Integer = 3,
nclasses::Integer = 1000)Create a AlexNet. (reference).
Arguments
pretrain: set totrueto load pre-trained weights for ImageNetinchannels: The number of input channels.nclasses: the number of output classes
AlexNet does not currently support pretrained weights.
See also alexnet.
Metalhead.VGG — TypeVGG(imsize::Dims{2}; config, inchannels, batchnorm = false, nclasses, fcsize, dropout_prob)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 totrueto use batch normalization after each convolutionnclasses: number of output classesfcsize: intermediate fully connected layer size (seeMetalhead.vgg_classifier_layers)dropout_prob: dropout level between fully connected layers
Metalhead.SqueezeNet — TypeSqueezeNet(; pretrain::Bool = false, inchannels::Integer = 3,
nclasses::Integer = 1000)Create a SqueezeNet (reference).
Arguments
pretrain: set totrueto load the pre-trained weights for ImageNetinchannels: number of input channels.nclasses: the number of output classes.
See also squeezenet.
Metalhead.UNet — TypeUNet(imsize::Dims{2} = (256, 256), inchannels::Integer = 3, outplanes::Integer = 3,
encoder_backbone = Metalhead.backbone(DenseNet(121)); pretrain::Bool = false)Creates a UNet model with an encoder built of specified backbone. By default it uses DenseNet backbone, but any ResNet-like Metalhead model can be used for the encoder. (reference).
Arguments
imsize: size of input imageinchannels: number of channels in input imageoutplanes: number of output feature planes.encoder_backbone: The backbone layers of specified model to be used as encoder. For example,Metalhead.backbone(Metalhead.ResNet(18))can be passed to instantiate a UNet with layers of resnet18 as encoder.pretrain: Whether to load the pre-trained weights for ImageNet
UNet does not currently support pretrained weights.
See also Metalhead.unet.
The mid-level functions
Metalhead.alexnet — Functionalexnet(; dropout_prob = 0.5, inchannels::Integer = 3, nclasses::Integer = 1000)Create an AlexNet model (reference).
Arguments
dropout_prob: dropout probability for the classifierinchannels: The number of input channels.nclasses: the number of output classes
Metalhead.vgg — Functionvgg(imsize; config, inchannels, batchnorm = false, nclasses, fcsize, dropout_prob)Create a VGG model (reference).
Arguments
imsize: input image width and height as a tupleconfig: the configuration for the convolution layers (seeMetalhead.vgg_convolutional_layers)inchannels: number of input channelsbatchnorm: set totrueto use batch normalization after each convolutionnclasses: number of output classesfcsize: intermediate fully connected layer size (seeMetalhead.vgg_classifier_layers)dropout_prob: dropout level between fully connected layers
Metalhead.squeezenet — Functionsqueezenet(; dropout_prob = 0.5, inchannels::Integer = 3, nclasses::Integer = 1000)Create a SqueezeNet model. (reference).
Arguments
dropout_prob: dropout probability for the classifier head. Set tonothingto disable dropout.inchannels: number of input channels.nclasses: the number of output classes.
Metalhead.unet — Functionunet(encoder_backbone, imgdims, outplanes::Integer, final::Any = unet_final_block,
fdownscale::Integer = 0)Creates a UNet model with specified convolutional backbone. Backbone of any Metalhead ResNet-like model can be used as encoder (reference).
Arguments
- `encoder_backbone`: The backbone layers of specified model to be used as encoder.
For example, `Metalhead.backbone(Metalhead.ResNet(18))` can be passed
to instantiate a UNet with layers of resnet18 as encoder.
- `inputsize`: size of input image
- `outplanes`: number of output feature planes
- `final`: final block as described in original paper
- `fdownscale`: downscale factor