作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客
本文网址:https://blog.csdn.net/HiWangWenBing/article/details/121184391
目录
步骤1:torchvision概述
步骤2:如何获取框架提供的预训练模型
步骤3:常见预训练模型地址
步骤4:通过IE浏览器手工下载模型
步骤5:模型加载
[Pytorch系列-37]:工具集 - torchvision库详解(数据集、数据预处理、模型)_文火冰糖(王文兵)的博客-CSDN博客作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客本文网址:目录第1章Pytorch常见的工具集简介第2章Pytorch的torchvision工具集简介第3章torchvision.datasets 简介3.1 简介3.2 支持的数据集列表第4章torchvision.models简介4.1 简介4.2 支持的模型4.3构造具有随机权重的模型4.4 使用预预训练好的模型第5章 torchvision.tr...https://blog.csdn.net/HiWangWenBing/article/details/121149809
import torchvision.models as models
alexnet = models.alexnet(pretrained=True) # AlexNet
vgg16 = models.vgg16(pretrained=True) # VGG16
resnet18 = models.resnet18(pretrained=True) # ResetNet模型
googlenet = models.googlenet(pretrained=True) # googlenet
inception = models.inception_v3(pretrained=True) # inception
squeezenet = models.squeezenet1_0(pretrained=True) # 序列网络
densenet = models.densenet161(pretrained=True) # 稠密网络
shufflenet = models.shufflenet_v2_x1_0(pretrained=True)
mobilenet_v2 = models.mobilenet_v2(pretrained=True)
mobilenet_v3_large = models.mobilenet_v3_large(pretrained=True)
mobilenet_v3_small = models.mobilenet_v3_small(pretrained=True)
resnext50_32x4d = models.resnext50_32x4d(pretrained=True)
wide_resnet50_2 = models.wide_resnet50_2(pretrained=True)
mnasnet = models.mnasnet1_0(pretrained=True)
#efficientnet_b0 = models.efficientnet_b0()
#efficientnet_b1 = models.efficientnet_b1()
#efficientnet_b2 = models.efficientnet_b2()
#efficientnet_b3 = models.efficientnet_b3()
#efficientnet_b4 = models.efficientnet_b4()
#efficientnet_b5 = models.efficientnet_b5()
#efficientnet_b6 = models.efficientnet_b6()
#efficientnet_b7 = models.efficientnet_b7()
#regnet_y_400mf = models.regnet_y_400mf()
#regnet_y_800mf = models.regnet_y_800mf()
#regnet_y_1_6gf = models.regnet_y_1_6gf()
#regnet_y_3_2gf = models.regnet_y_3_2gf()
#regnet_y_8gf = models.regnet_y_8gf()
#regnet_y_16gf = models.regnet_y_16gf()
#regnet_y_32gf = models.regnet_y_32gf()
#regnet_x_400mf = models.regnet_x_400mf()
#regnet_x_800mf = models.regnet_x_800mf()
#regnet_x_1_6gf = models.regnet_x_1_6gf()
#regnet_x_3_2gf = models.regnet_x_3_2gf()
#regnet_x_8gf = models.regnet_x_8gf()
#regnet_x_16gf = models.regnet_x_16gf()
#regnet_x_32gf = models.regnet_x_32gf()
下列链接就是框架提供的预训练模型:
Downloading: "https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth" to C:\Users\Administrator/.cache\torch\hub\checkpoints\alexnet-owt-4df8aa71.pth
将下载好的模型放在~/.cache/torch/checkpoints文件夹中即可(windows为C:\用户名\.cache\torch\.checkpoints)
Resnet:
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth',
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth',
'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth',
}
inception:
model_urls = {
# Inception v3 ported from TensorFlow
'inception_v3_google': 'https://download.pytorch.org/models/inception_v3_google-1a9a5a14.pth',
}
Densenet:
model_urls = {
'densenet121': 'https://download.pytorch.org/models/densenet121-a639ec97.pth',
'densenet169': 'https://download.pytorch.org/models/densenet169-b2777c0a.pth',
'densenet201': 'https://download.pytorch.org/models/densenet201-c1103571.pth',
'densenet161': 'https://download.pytorch.org/models/densenet161-8d451a50.pth',
}
Alexnet:
model_urls = {
'alexnet': 'https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth',
}
vggnet:
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth',
'vgg16': 'https://download.pytorch.org/models/vgg16-397923af.pth',
'vgg19': 'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth',
'vgg11_bn': 'https://download.pytorch.org/models/vgg11_bn-6002323d.pth',
'vgg13_bn': 'https://download.pytorch.org/models/vgg13_bn-abd245e5.pth',
'vgg16_bn': 'https://download.pytorch.org/models/vgg16_bn-6c64b313.pth',
'vgg19_bn': 'https://download.pytorch.org/models/vgg19_bn-c79401a0.pth',
}
https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth
[Pytorch系列-40]:卷积神经网络 - 模型的恢复/加载 - 搭建LeNet-5网络与MNIST数据集手写数字识别_文火冰糖(王文兵)的博客-CSDN博客作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客本文网址:https://blog.csdn.net/HiWangWenBing/article/details/121132377目录第1章 模型的恢复与加载1.1 概述1.2模型的恢复与加载类型1.3模型的保存的API函数:代码示例1.4模型的恢复与加载的API函数:代码示例第2章 定义前向运算:加载CFAR10数据集2.1 前置条件2.2 定义数据预处理(数据强化)...https://blog.csdn.net/HiWangWenBing/article/details/121181287
作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客
本文网址:https://blog.csdn.net/HiWangWenBing/article/details/121184391