16.03.2021 Views

Advanced Deep Learning with Keras

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6

Figure 6.2.7: A StackedGAN Generator model in Keras

Listing 6.2.2, stackedgan-mnist-6.2.1.py shows us generator implementation

in Keras:

def build_generator(latent_codes, image_size, feature1_dim=256):

"""Build Generator Model sub networks

Two sub networks: 1) Class and noise to feature1 (intermediate

feature)

2) feature1 to image

# Arguments

latent_codes (Layers): discrete code (labels), noise and

feature1 features

image_size (int): Target size of one side (assuming square

image)

[ 187 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!