tensorflowkerasdeep-dream

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


I have repurposed an Inception V3 network using the transfer learning method, following this article.

For that, I removed the final network layer, and fed hundreds of images of my face into the network.

A new model was then sucessfully generated: inceptionv3-ft.model


Now I would like to load this model and use its fixed weights to apply my face as a 'theme' on a input image, like google-dream.

For that I am using a keras program, which loads models like so:

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

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


Solution

  • simply:

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