Table Of Contents
Table Of Contents

model_zoo.vision

Module for pre-defined neural network models.

This module contains definitions for the following model architectures: - AlexNet - DenseNet - Inception V3 - ResNet V1 - ResNet V2 - SqueezeNet - VGG - MobileNet - MobileNetV2

You can construct a model with random weights by calling its constructor:

We provide pre-trained models for all the listed models. These models can constructed by passing pretrained=True:

All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB images of shape (N x 3 x H x W), where N is the batch size, and H and W are expected to be at least 224. The images have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]. The transformation should preferrably happen at preprocessing. You can use mx.image.color_normalize for such transformation:

image = image/255
normalized = mx.image.color_normalize(image,
                                      mean=mx.nd.array([0.485, 0.456, 0.406]),
                                      std=mx.nd.array([0.229, 0.224, 0.225]))
get_model(name, **kwargs) Returns a pre-defined model by name

ResNet

resnet18_v1(**kwargs) ResNet-18 V1 model from “Deep Residual Learning for Image Recognition” paper.
resnet34_v1(**kwargs) ResNet-34 V1 model from “Deep Residual Learning for Image Recognition” paper.
resnet50_v1(**kwargs) ResNet-50 V1 model from “Deep Residual Learning for Image Recognition” paper.
resnet101_v1(**kwargs) ResNet-101 V1 model from “Deep Residual Learning for Image Recognition” paper.
resnet152_v1(**kwargs) ResNet-152 V1 model from “Deep Residual Learning for Image Recognition” paper.
resnet18_v2(**kwargs) ResNet-18 V2 model from “Identity Mappings in Deep Residual Networks” paper.
resnet34_v2(**kwargs) ResNet-34 V2 model from “Identity Mappings in Deep Residual Networks” paper.
resnet50_v2(**kwargs) ResNet-50 V2 model from “Identity Mappings in Deep Residual Networks” paper.
resnet101_v2(**kwargs) ResNet-101 V2 model from “Identity Mappings in Deep Residual Networks” paper.
resnet152_v2(**kwargs) ResNet-152 V2 model from “Identity Mappings in Deep Residual Networks” paper.
ResNetV1(block, layers, channels[, classes, …]) ResNet V1 model from “Deep Residual Learning for Image Recognition” paper.
ResNetV2(block, layers, channels[, classes, …]) ResNet V2 model from “Identity Mappings in Deep Residual Networks” paper.
BasicBlockV1(channels, stride[, downsample, …]) BasicBlock V1 from “Deep Residual Learning for Image Recognition” paper.This is used for ResNet V1 for 18, 34 layers..
BasicBlockV2(channels, stride[, downsample, …]) BasicBlock V2 from “Identity Mappings in Deep Residual Networks” paper.This is used for ResNet V2 for 18, 34 layers..
BottleneckV1(channels, stride[, downsample, …]) Bottleneck V1 from “Deep Residual Learning for Image Recognition” paper.This is used for ResNet V1 for 50, 101, 152 layers..
BottleneckV2(channels, stride[, downsample, …]) Bottleneck V2 from “Identity Mappings in Deep Residual Networks” paper.This is used for ResNet V2 for 50, 101, 152 layers..
get_resnet(version, num_layers[, …]) ResNet V1 model from “Deep Residual Learning for Image Recognition” paper.ResNet V2 model from “Identity Mappings in Deep Residual Networks” paper..

VGG

vgg11(**kwargs) VGG-11 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg13(**kwargs) VGG-13 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg16(**kwargs) VGG-16 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg19(**kwargs) VGG-19 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg11_bn(**kwargs) VGG-11 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg13_bn(**kwargs) VGG-13 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg16_bn(**kwargs) VGG-16 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
vgg19_bn(**kwargs) VGG-19 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
VGG(layers, filters[, classes, batch_norm]) VGG model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
get_vgg(num_layers[, pretrained, ctx, root]) VGG model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.

Alexnet

alexnet([pretrained, ctx, root]) AlexNet model from the “One weird trick…” paper.
AlexNet([classes]) AlexNet model from the “One weird trick…” paper.

DenseNet

densenet121(**kwargs) Densenet-BC 121-layer model from the “Densely Connected Convolutional Networks” paper.
densenet161(**kwargs) Densenet-BC 161-layer model from the “Densely Connected Convolutional Networks” paper.
densenet169(**kwargs) Densenet-BC 169-layer model from the “Densely Connected Convolutional Networks” paper.
densenet201(**kwargs) Densenet-BC 201-layer model from the “Densely Connected Convolutional Networks” paper.
DenseNet(num_init_features, growth_rate, …) Densenet-BC model from the “Densely Connected Convolutional Networks” paper.

SqueezeNet

squeezenet1_0(**kwargs) SqueezeNet 1.0 model from the “SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size” paper.
squeezenet1_1(**kwargs) SqueezeNet 1.1 model from the official SqueezeNet repo.SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters than SqueezeNet 1.0, without sacrificing accuracy..
SqueezeNet(version[, classes]) SqueezeNet model from the “SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size” paper.SqueezeNet 1.1 model from the official SqueezeNet repo.SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters than SqueezeNet 1.0, without sacrificing accuracy..

Inception

inception_v3([pretrained, ctx, root]) Inception v3 model from “Rethinking the Inception Architecture for Computer Vision” paper.
Inception3([classes]) Inception v3 model from “Rethinking the Inception Architecture for Computer Vision” paper.

MobileNet

mobilenet1_0(**kwargs) MobileNet model from the “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications” paper, with width multiplier 1.0.
mobilenet0_75(**kwargs) MobileNet model from the “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications” paper, with width multiplier 0.75.
mobilenet0_5(**kwargs) MobileNet model from the “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications” paper, with width multiplier 0.5.
mobilenet0_25(**kwargs) MobileNet model from the “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications” paper, with width multiplier 0.25.
mobilenet_v2_1_0(**kwargs) MobileNetV2 model from the “Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation” paper.
mobilenet_v2_0_75(**kwargs) MobileNetV2 model from the “Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation” paper.
mobilenet_v2_0_5(**kwargs) MobileNetV2 model from the “Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation” paper.
mobilenet_v2_0_25(**kwargs) MobileNetV2 model from the “Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation” paper.
MobileNet([multiplier, classes]) MobileNet model from the “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications” paper.
MobileNetV2([multiplier, classes]) MobileNetV2 model from the “Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation” paper.