def test(self): # Go back to image folder os.chdir("data/dataset_test_AMLS_19-20/celeba_test") # Split ImageDataGenerator object for the test set into separate X and y test sets X_test, y_test = get_X_y_test_sets(self.test_gen) # Navigate to output folder in parent directory go_up_three_dirs() # Plot top losses plot_top_losses(self.model, X_test, y_test, "output/plot_top_losses_A1_mlp.png") # Get the test accuracy test_accuracy = self.model.evaluate(X_test, y_test)[-1] return test_accuracy
def test(self): # Go back to image folder os.chdir("data/dataset_test_AMLS_19-20/cartoon_set_test") # Split ImageDataGenerator object for the test set into separate X and y test sets X_test, y_test = get_X_y_test_sets(self.test_gen) # Navigate to output folder in parent directory go_up_three_dirs() # Plot top losses plot_top_losses(self.model, X_test, y_test, "output/plot_top_losses_B2_xception.png") # Plot GradCam plot_grad_cam(self.model, X_test, y_test, 3, "block14_sepconv2", "output/plot_top_5_gradcam_B2_xception.png") # Get the test accuracy test_accuracy = self.model.evaluate(X_test, y_test)[-1] return test_accuracy