from keras.layers.convolutional import Convolution2D from keras.layers.convolutional import MaxPooling2D from keras.utils import np_utils from sklearn.metrics import confusion_matrix import imageDataExtract as dataset # fix random seed for reproducibility seed = 7 numpy.random.seed(seed) # load data matrix_path = 'numpy-matrix/main-0.npy' label_path = 'numpy-matrix/label-0.npy' X_train, y_train, X_test, y_test = dataset.load_matrix(matrix_path, label_path) # normalize inputs from 0-255 to 0.0-1.0 X_train = X_train.astype('float32') X_test = X_test.astype('float32') print X_train.shape print X_test.shape X_train = X_train / 255.0 X_test = X_test / 255.0 # one hot encode outputs y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) num_classes = y_test.shape[1]
from keras.layers.convolutional import Convolution2D from keras.layers.convolutional import MaxPooling2D from keras.utils import np_utils from sklearn.metrics import confusion_matrix import imageDataExtract as dataset # fix random seed for reproducibility seed = 7 numpy.random.seed(seed) # load data matrix_path = 'numpy-matrix/main-0.npy' label_path = 'numpy-matrix/label-0.npy' X_train, y_train, X_test, y_test = dataset.load_matrix(matrix_path, label_path) # normalize inputs from 0-255 to 0.0-1.0 X_train = X_train.astype('float32') X_test = X_test.astype('float32') print X_train.shape print X_test.shape X_train = X_train / 255.0 X_test = X_test / 255.0 # one hot encode outputs