diff --git a/load_model_mnist_keras.py b/load_model_mnist_keras.py index 27ec5e7..42c7523 100644 --- a/load_model_mnist_keras.py +++ b/load_model_mnist_keras.py @@ -44,13 +44,15 @@ print("Training network ...") model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) print("Making predictions...") -t1 = time.time() +t3 = time.time() for i in range(9): img = np.array(X_test[i][np.newaxis,:]) preds = model.predict_classes(img) print("Image[", i, "] - Me thinks me saw a : ", predictions[int(preds[0])] ) -t2 = time.time() -print("Predictions took %.2f sec." % (t2 - t1)) +t4 = time.time() +print("Predictions took %.2f sec." % (t4 - t3)) + +print('Total running time %.2f sec' % (t4 - t1)) diff --git a/save_model_mnist_keras.py b/save_model_mnist_keras.py index 73cf4b5..ce0cd49 100644 --- a/save_model_mnist_keras.py +++ b/save_model_mnist_keras.py @@ -70,13 +70,15 @@ with open("mnist.json", "w") as json_file: model.save_weights('mnist.h5') print("Making predictions...") -t1 = time.time() +t3 = time.time() for i in range(9): img = np.array(X_test[i][np.newaxis,:]) preds = model.predict_classes(img) print("Image[", i, "] - Me thinks me saw a : ", predictions[int(preds[0])] ) -t2 = time.time() -print("Predictions took %.2f sec." % (t2 - t1)) +t4 = time.time() +print("Predictions took %.2f sec." % (t4 - t3)) + +print('Total running time %.2f sec' % (t4 - t1))