首页 > 解决方案 > 如何在 pytorch 中加载预训练的 googlenet 模型

问题描述

我正在尝试在特定数据集上微调 GoogleNet 网络,但我无法加载它。我现在尝试的是:

model = torchvision.models.googlenet(pretrained=True)

但是我收到一个错误:

AttributeError: module 'torchvision.models' has no attribute 'googlenet'

我有最新版本的 torchvision 但重新安装以确保错误仍然存​​在。

标签: pythonconv-neural-networkpytorchpre-trained-modeltorchvision

解决方案


您可以改用 GoogLeNetinception_v3模型(“重新思考计算机视觉的初始架构”):

import torchvision
google_net = torchvision.models.inception_v3(pretrained=True)

推荐阅读