Deep-Dream - 加载通过迁移学习获得的 Re-trained Inception 模型

Deep-Dream - load Re-trained Inception model obtained with transfer learning

我使用 迁移学习 方法重新调整了 Inception V3 网络的用途,遵循 this article.

为此,我删除了最后的网络层,并将数百张我的脸部图像输入到网络中。

成功生成新模型:inceptionv3-ft.model


现在我想加载这个模型并使用它的固定权重将我的脸作为 'theme' 应用到输入图像上,例如 google-dream.

为此,我正在使用 keras 程序,它会像这样加载模型:

from keras.applications import inception_v3

# Build the InceptionV3 network with our placeholder.
# The model will be loaded with pre-trained ImageNet weights.
model = inception_v3.InceptionV3(weights='imagenet',
                                 include_top=False)
dream = model.input

Full code here: https://github.com/keras-team/keras/blob/master/examples/deep_dream.py

那么,我如何加载和传递不是预训练的而是我重新训练的模型权重

简单地说:

from keras.models import load_model

model = load_model('inceptionv3-ft.model')
dream = model.input