text: import numpy as np
  np.random.seed(123)  # for reproducibility
   
  from keras.models import Sequential
  from keras.layers import Dense, Dropout, Activation, Flatten
  from keras.layers import Convolution2D, MaxPooling2D
  from keras.utils import np_utils
  from dataset_pothole import pothole
  from keras.models import model_from_json
  
  # 4. Load pre-shuffled MNIST data into train and test sets
  (X_train, y_train), (X_test, y_test) = pothole.load_data()
   
  print(X_train.shape)
  print()
  print (y_train.shape)
  print()
  
  # 5. Preprocess input data
  X_train = X_train.reshape(X_train.shape[0], 200, 200, 1)
  X_test = X_test.reshape(X_test.shape[0], 200, 200, 1)
  X_train = X_train.astype('float32')
  X_test = X_test.astype('float32')
  X_train /= 3380
  X_test /= 3380
   
  # 6. Preprocess class labels
  Y_train = np_utils.to_categorical(y_train, 4)
  Y_test = np_utils.to_categorical(y_test, 4)
   
  # 7. Define model architecture
  
  nb_classes = 4
  # number of epochs to train
  
  
  # number of convolutional filters to use
  nb_filters = 32
  # size of pooling area for max pooling
  nb_pool = 2
  # convolution kernel size
  nb_conv = 3
  
  model = Sequential()
  
  model.add(Convolution2D(nb_filters, nb_conv, nb_conv,
                          border_mode='valid',
                          input_shape=(200, 200, 1)))
  convout1 = Activation('relu')
  model.add(convout1)
  model.add(Convolution2D(nb_filters, nb_conv, nb_conv))
  convout2 = Activation('relu')
  model.add(convout2)
  model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))
  model.add(Dropout(0.5))
  
  model.add(Flatten())
  model.add(Dense(128))
  model.add(Activation('relu'))
  model.add(Dropout(0.5))
  model.add(Dense(nb_classes))
  model.add(Activation('softmax'))
  model.compile(loss='categorical_crossentropy', optimizer='adadelta')
   
  # 9. Fit model on training data
  model.fit(X_train, Y_train, 
            batch_size=32, nb_epoch=2, verbose=1)
   
  # 10. Evaluate model on test data
  score = model.evaluate(X_test, Y_test, verbose=0)
  # serialize model to JSON
  model_json = model.to_json()
  with open("model.json", "w") as json_file:
      json_file.write(model_json)
  # serialize weights to HDF5
  model.save_weights("model.h5")
  print("Saved model to disk")
  print('Test loss: ', score[0])
  print('Test accuracy: ', score[1])
  