How to do it...

We proceed with the recipes as follows:

  1. Import numpy for numerical computation, functools to define partial functions with one or more argument already filled in, Pillow for image manipulation, and matplotlib to render images:
import numpy as np from functools import partial import PIL.Image import tensorflow as tf import matplotlib.pyplot as plt
  1. Set up the path for the content image and the pretrained model. Start with a seed image that is just random noise:
content_image = 'data/gulli.jpg' # start with a gray image with a little noise img_noise = np.random.uniform(size=(224,224,3)) + 100.0 model_fn = 'data/tensorflow_inception_graph.pb'
  1. Load the Inception network downloaded from the internet in a graph. Initialize a ...

Get TensorFlow 1.x Deep Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.