σ šΔοYc@sOdZddlTddlTddlTddlTddlTddlTd„ZdS(sQModule 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`_ You can construct a model with random weights by calling its constructor: .. code:: import mxnet.gluon.models as models resnet18 = models.resnet18_v1() alexnet = models.alexnet() squeezenet = models.squeezenet1_0() densenet = models.densenet_161() We provide pre-trained models for all the models except ResNet V2. These can constructed by passing ``pretrained=True``: .. code:: import mxnet.gluon.models as models resnet18 = models.resnet18_v1(pretrained=True) alexnet = models.alexnet(pretrained=True) Pretrained models are converted from torchvision. 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])) .. _AlexNet: https://arxiv.org/abs/1404.5997 .. _DenseNet: https://arxiv.org/abs/1608.06993 .. _Inception V3: http://arxiv.org/abs/1512.00567 .. _ResNet V1: https://arxiv.org/abs/1512.03385 .. _ResNet V2: https://arxiv.org/abs/1512.03385 .. _SqueezeNet: https://arxiv.org/abs/1602.07360 .. _VGG: https://arxiv.org/abs/1409.1556 i(t*cKsitd6td6td6td6td6td6td6td6td 6t d 6t d 6t d 6t d 6t d6td6td6td6td6td6td6td6td6td6td6td6td6}|jƒ}||krtd|djt|jƒƒƒfƒ‚n|||S(s?Returns a pre-defined model by name Parameters ---------- name : str Name of the model. pretrained : bool Whether to load the pretrained weights for model. classes : int Number of classes for the output layer. Returns ------- HybridBlock The model. t resnet18_v1t resnet34_v1t resnet50_v1t resnet101_v1t resnet152_v1t resnet18_v2t resnet34_v2t resnet50_v2t resnet101_v2t resnet152_v2tvgg11tvgg13tvgg16tvgg19tvgg11_bntvgg13_bntvgg16_bntvgg19_bntalexnett densenet121t densenet161t densenet169t densenet201s squeezenet1.0s squeezenet1.1t inceptionv3s4Model %s is not supported. Available options are %ss (RRRRRRRRR R R R R RRRRRRRRRRt squeezenet1_0t squeezenet1_1t inception_v3tlowert ValueErrortjointsortedtkeys(tnametkwargstmodels((sEbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/__init__.pyt get_modelTs@    (N(t__doc__Rtdensenett inceptiontresnett squeezenettvggR$(((sEbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/__init__.pytFs