import numpy as np from keras.models import Model from keras.utils import to_categorical pred_y = np.load("predicted_results.npy") test_y = np.load("Waldo_test_lbl.npy") test_y = to_categorical(test_y) f = open("test_output.txt", 'w') z = 0 for i in range(0, len(test_y)): print(pred_y[i], test_y[i], file=f) # Calculates correct predictions if pred_y[i][0] == test_y[i][0]: z+=1 print("Accuracy: {}%".format(z/len(test_y)*100)) f.close()