May 2019
Intermediate to advanced
272 pages
7h 19m
English
We randomly sample the generator to informally evaluate image quality with respect to the constraints described in the text. Inference is straightforward and is described in the following code block:
def infer(data_filepath='data/flowers.hdf5', z_dim=128, out_dir='gan', n_samples=5): # we load the saved model G = load_model(out_dir) # get text embeddings and text from the validation set val_data = get_data(data_filepath, 'train') val_data = next(iterate_minibatches(val_data, n_samples)) emb, txts = val_data[1], val_data[2] # we sample a z to produce fake images with the text embeddings z = np.random.uniform(-1, 1, size=(n_samples, z_dim)) G.trainable = False fake_images = G.predict([z, emb]) # generate n_samples for ...
Read now
Unlock full access