Face generation is implemented in code as follows (the code file is available as Face_generation.ipynb in GitHub):
- Download the dataset. The recommended dataset to be downloaded and the associated code is provided in GitHub. A sample of images is as follows:
- Define the model architecture:
def generator(): model = Sequential() model.add(Dense(input_dim=100, output_dim=1024)) model.add(Activation('tanh')) model.add(Dense(128*7*7)) model.add(BatchNormalization()) model.add(Activation('tanh')) model.add(Reshape((7, 7, 128), input_shape=(128*7*7,))) model.add(UpSampling2D(size=(2, 2))) model.add(Conv2D(64, (5, 5), padding='same')) ...