【发布时间】:2021-08-19 21:58:04
【问题描述】:
我想使用 keras 库将预训练的网络加载到我的 Google Colab 笔记本中。
我为此使用以下代码:
import keras
from keras.applications import VGG16, InceptionResNetV2, ResNet50
我收到以下错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-52-9c551e8fe84f> in <module>()
15 from keras.preprocessing.image import ImageDataGenerator
16
---> 17 from keras.applications import VGG16, InceptionResNetV2, ResNet50
ImportError: cannot import name 'VGG16' from 'keras.applications' (/usr/local/lib/python3.7/dist-packages/keras/applications/__init__.py)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
我曾经这样做并且效果很好,但现在它给出了错误。不知道是什么问题!
应该注意的是,当我使用 Jupyter notebook 在我的设备上执行此操作时,它运行良好并且网络加载,但在 Google Colab 中会出错。
【问题讨论】:
标签: keras jupyter-notebook google-colaboratory transfer-learning pre-trained-model