Skip to content
Snippets Groups Projects
Commit ab17f3f1 authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Fixing LeNet model

parent 09a7c251
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ class LeNet_MNIST(Benchmark): ...@@ -26,7 +26,7 @@ class LeNet_MNIST(Benchmark):
def buildModel(self): def buildModel(self):
# Network Compostion: 3 Conv Layers, 2 Dense Layers # Network Compostion: 2 Conv Layers, 2 Dense Layers
model = Sequential() model = Sequential()
# ConvLayer1 # ConvLayer1
...@@ -40,10 +40,10 @@ class LeNet_MNIST(Benchmark): ...@@ -40,10 +40,10 @@ class LeNet_MNIST(Benchmark):
model.add(Flatten()) model.add(Flatten())
# DenseLayer1 # DenseLayer1
model.add(Dense(1024, activation='relu')) model.add(Dense(1024, activation='tanh'))
# DenseLayer2 # DenseLayer2
model.add(Dense(self.num_classes, activation='relu')) model.add(Dense(self.num_classes, activation='tanh'))
# Softmax Layer # Softmax Layer
model.add(Activation('softmax')) model.add(Activation('softmax'))
...@@ -55,18 +55,16 @@ class LeNet_MNIST(Benchmark): ...@@ -55,18 +55,16 @@ class LeNet_MNIST(Benchmark):
test_labels = y_val test_labels = y_val
X_train = X_train.reshape(X_train.shape[0], 1, 28, 28) X_train = X_train.reshape(X_train.shape[0], 1, 28, 28)
X_val = X_val.reshape(X_val.shape[0], 1, 28, 28)
X_train = X_train.astype('float32') X_train = X_train.astype('float32')
X_val = X_val.astype('float32')
X_train /= 255 X_train /= 255
X_val /= 255
X_test = X_val[0:5000] X_test = np.fromfile(MODEL_PARAMS_DIR + '/lenet_mnist/test_input.bin', dtype=np.float32)
y_test = y_val[0:5000] X_test = X_test.reshape((-1, 1, 28, 28))
X_tuner = X_val[5000:] y_test = np.fromfile(MODEL_PARAMS_DIR + '/lenet_mnist/test_labels.bin', dtype=np.uint32)
y_tuner = y_val[5000:]
X_tuner = np.fromfile(MODEL_PARAMS_DIR + '/lenet_mnist/tune_input.bin', dtype=np.float32)
X_tuner = X_tuner.reshape((-1, 1, 28, 28))
y_tuner = np.fromfile(MODEL_PARAMS_DIR + '/lenet_mnist/tune_labels.bin', dtype=np.uint32)
return X_train, y_train, X_test, y_test, X_tuner, y_tuner return X_train, y_train, X_test, y_test, X_tuner, y_tuner
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment