译者:BXuan694
models子包定义了以下模型架构:
- AlexNet
- VGG
- ResNet
- SqueezeNet
- DenseNet
- Inception v3
你可以通过调用以下构造函数构造随机权重的模型:
代码语言:javascript复制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)
阅读全文/改进本文