Discriminator class preparation

The Discriminator class will start by gathering imports and initializing the class:

  1. Define all of the imports needed for this class:
#!/usr/bin/env python3
import sys
import numpy as np
from keras.layers import Input, Dense, Reshape, Flatten, Dropout,
BatchNormalization
from keras.layers.convolutional import Conv3D, Deconv3D
from keras.layers.core import Activation
from keras.layers.advanced_activations import LeakyReLU
from keras.models import Sequential, Model
from keras.optimizers import Adam
from keras.utils import plot_model

  1. Create the Discriminator class with the side length (assuming our 3D object is cubic) as the only input:
class Discriminator(object):
def __init__(self, side=16):
self.INPUT_SHAPE = (side,side,side,3)
We also define the input shape as a cube with the defined side as the length and a three channel color representation for every pixel.
  1. Define the Adam optimizer and create the model:
self.OPTIMIZER = Adam(lr=0.000001, beta_1=0.5)
self.Discriminator = self.model()
  1. Now that the model is created, we'll compile the model in the initialization step:
self.Discriminator.compile(loss='binary_crossentropy', 
optimizer=self.OPTIMIZER, metrics=['accuracy'] )
  1. Print the summary of the model to the screen:
self.summary()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.122.244