PyTorch 1.0 中文文档:torchvision.models

译者:BXuan694

models子包定义了以下模型架构:

  • AlexNet
  • VGG
  • ResNet
  • SqueezeNet
  • DenseNet
  • Inception v3

你可以通过调用以下构造函数构造随机权重的模型:

import torchvision.models as models
resnet18 = models.resnet18()
alexnet = models.alexnet()
vgg16 = models.vgg16()
squeezenet = models.squeezenet1_0()
densenet = models.densenet161()
inception = models.inception_v3()

我们在torch.utils.model_zoo中提供了预训练模型。预训练模型可以通过传递参数pretrained=True构造:

import torchvision.models as models
resnet18 = models.resnet18(pretrained=True)
alexnet = models.alexnet(pretrained=True)
squeezenet = models.squeezenet1_0(pretrained=True)
vgg16 = models.vgg16(pretrained=True)
densenet = models.densenet161(pretrained=True)
inception = models.inception_v3(pretrained=True)

阅读全文/改进本文

转载于:https://www.cnblogs.com/wizardforcel/p/10492673.html

你可能感兴趣的:(人工智能)