text: import numpy
  import matplotlib.pyplot as plt
  from keras.layers import Dropout
  from keras.layers import Flatten
  from keras.constraints import maxnorm
  from keras.optimizers import SGD
  from keras.layers import Conv2D
  from keras.layers.convolutional import MaxPooling2D
  from keras.utils import np_utils
  from keras import backend as K
  import load_data
  from keras.models import Sequential
  from keras.layers import Dense
  from sklearn.model_selection import train_test_split
  
  K.set_image_dim_ordering('tf')
  # fix random seed for reproducibility
  seed = 7
  numpy.random.seed(seed)
  
  def pre_process(X):
  
      # normalize inputs from 0-255 to 0.0-1.0
      X=X.astype('float32')
      X = X / 255.0
      return X
  
  def one_hot_encode(y):
  
      # one hot encode outputs
      y = np_utils.to_categorical(y)
      num_classes = y.shape[1]
      return y,num_classes
  
  def define_model(num_classes,epochs):
      # Create the model
      model = Sequential()
      model.add(Conv2D(64, (3, 3), input_shape=(64, 64, 3), padding='same', activation='relu', kernel_constraint=maxnorm(3)))
      model.add(Dropout(0.5))
      model.add(Conv2D(32, (3, 3), activation='relu', padding='same', kernel_constraint=maxnorm(3)))
      model.add(MaxPooling2D(pool_size=(2, 2)))
      model.add(Flatten())
      model.add(Dense(512, activation='relu', kernel_constraint=maxnorm(3)))
      model.add(Dropout(0.5))
      model.add(Dense(num_classes, activation='softmax'))
      # Compile model
      lrate = 0.001
      decay = lrate/epochs
      sgd = SGD(lr=lrate, momentum=0.7, decay=decay, nesterov=False)
      model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
      print(model.summary())
      return model
  
  
  # load data
  X,y=load_data.load_datasets()
  
  # pre process
  X=pre_process(X)
  
  #one hot encode
  y,num_classes=one_hot_encode(y)
  
  
  #split dataset
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=7)
  
  epochs = 100
  #define model
  model=define_model(num_classes,epochs)
  
  
  # Fit the model
  history=model.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=epochs, batch_size=32)
  
  # list all data in history
  print(history.history.keys())
  # summarize history for accuracy
  plt.plot(history.history['acc'])
  plt.plot(history.history['val_acc'])
  plt.title('model accuracy')
  plt.ylabel('accuracy')
  plt.xlabel('epoch')
  plt.legend(['train', 'test'], loc='upper left')
  plt.show()
  # summarize history for loss
  plt.plot(history.history['loss'])
  plt.plot(history.history['val_loss'])
  plt.title('model loss')
  plt.ylabel('loss')
  plt.xlabel('epoch')
  plt.legend(['train', 'test'], loc='upper left')
  plt.show()
  
  
  
  
  # Final evaluation of the model
  scores = model.evaluate(X_test, y_test, verbose=0)
  print("Accuracy: %.2f%%" % (scores[1]*100))
  
  # serialize model to JSONx
  model_json = model.to_json()
  with open("model_face.json", "w") as json_file:
      json_file.write(model_json)
  # serialize weights to HDF5
  model.save_weights("model_face.h5")
  print("Saved model to disk")
  