首页 文章

Deep-Dream - 加载通过转移学习获得的重新训练的初始模型

提问于
浏览
0

我在this article之后使用 transfer learning 方法重新调整了 Inception V3 网络 .

为此,我删除了最终的网络层,并将数百张脸部图像输入网络 .

然后成功生成了一个新模型: 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

完整代码:https://github.com/keras-team/keras/blob/master/examples/deep_dream.py

So, how do I load and pass not a pre-trained but rather my RE-trained model weights?

1 回答

  • 0

    只是:

    from keras.models import load_model
    
    model = load_model('inceptionv3-ft.model')
    dream = model.input
    

相关问题