vgg等模型下载很慢
vgg等模型由于权限或网速原因无法在云服务器正常下载
可以先下载好放到本地(有时候在云服务器上没有权限下载)
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models #vgg_pretrained_features = models.vgg19(pretrained=True).features #直接下载 #无法直接下载 vgg_pretrained = models.vgg19(pretrained=False) vgg_pretrained.load_state_dict(torch.load('/.../vgg19-dcbb9e9d.pth'))#load内为本地路径 vgg_pretrained_features = vgg_pretrained.features