<filename>Autopilot/Evaluation.py
from Autopilot.config import *
from Autopilot.TrainModel import *
from tensorflow.keras.models import load_model


def summaryFor(modelPath, test_x, test_y):
    model = load_model(modelPath)
    model.compile(optimizer="Adam", loss='mse')
    score = model.evaluate(test_x, test_y, verbose=0)
    print('Test loss for model (' + modelPath + ') is: ' + str(score))
    print('Test accuracy for model (' + modelPath + ') is: ' + str(1 - score))


def evaluateMyModel():
    features, labels = loadFromPickle()
    features, labels = augmentData(features, labels)
    features, labels = shuffle(features, labels)
    _, test_x, _, test_y = train_test_split(features, labels, random_state=0,
                                            test_size=0.1)
    test_x = test_x.reshape(test_x.shape[0], 40, 40, 1)
    summaryFor(modelPathFoggy, test_x, test_y)
    summaryFor(modelPathSunOnly, test_x, test_y)


if __name__ == '__main__':
    evaluateMyModel()

"""
Test loss for model (models/MsAutopilot_foggy.h5) is: 0.009795374237000942
Test accuracy for model (models/MsAutopilot_foggy.h5) is: 0.9902046257629991
Test loss for model (models/MsAutopilot_sun_only.h5) is: 0.02327766828238964
Test accuracy for model (models/MsAutopilot_sun_only.h5) is: 0.9767223317176104
"""

<filename>Autopilot/Evaluation.py
from Autopilot.config import *
from Autopilot.TrainModel import *
from tensorflow.keras.models import load_model


def summaryFor(modelPath, test_x, test_y):
    model = load_model(modelPath)
    model.compile(optimizer="Adam", loss='mse')
    score = model.evaluate(test_x, test_y, verbose=0)
    print('Test loss for model (' + modelPath + ') is: ' + str(score))
    print('Test accuracy for model (' + modelPath + ') is: ' + str(1 - score))


def evaluateMyModel():
    features, labels = loadFromPickle()
    features, labels = augmentData(features, labels)
    features, labels = shuffle(features, labels)
    _, test_x, _, test_y = train_test_split(features, labels, random_state=0,
                                            test_size=0.1)
    test_x = test_x.reshape(test_x.shape[0], 40, 40, 1)
    summaryFor(modelPathFoggy, test_x, test_y)
    summaryFor(modelPathSunOnly, test_x, test_y)


if __name__ == '__main__':
    evaluateMyModel()

"""
Test loss for model (models/MsAutopilot_foggy.h5) is: 0.009795374237000942
Test accuracy for model (models/MsAutopilot_foggy.h5) is: 0.9902046257629991
Test loss for model (models/MsAutopilot_sun_only.h5) is: 0.02327766828238964
Test accuracy for model (models/MsAutopilot_sun_only.h5) is: 0.9767223317176104
"""

Test loss for model (models/MsAutopilot_foggy.h5) is: 0.009795374237000942 Test accuracy for model (models/MsAutopilot_foggy.h5) is: 0.9902046257629991 Test loss for model (models/MsAutopilot_sun_only.h5) is: 0.02327766828238964 Test accuracy for model (models/MsAutopilot_sun_only.h5) is: 0.9767223317176104