def Plotting(): """ Function: Plot all adv samples. """ # reset graph tf.keras.backend.clear_session() epsilon = 1.0 # max value of the images is 1.0 alpha = 0.5 noise_type = 'gaussian' batch_size = 1 img_num = 50 folder_name = 'plots_double/' env = Environment(batch_size) _, _, x_test, y_test = env.MnistDataset() x_select, y_select = ShuffleAndSelect(x_test, y_test, img_num) img_index = SecondAgentPlots(x_select, folder_name) x_select_new = x_select[img_index] y_select_new = y_select[img_index] OriginalPlot(x_select_new, folder_name) FirstAgentPlots(epsilon, alpha, env, x_select_new, y_select_new, noise_type, folder_name)
def Plotting(epsilons, alphas, noise_type): """ Function: Plot all adv samples. """ # reset graph tf.keras.backend.clear_session() batch_size = 1 img_num = 10 folder_name = 'plots_' + noise_type + '/' env = Environment(batch_size) _, _, x_test, y_test = env.MnistDataset() x_select, y_select = ShuffleAndSelect(x_test, y_test, img_num) OriginalPlot(x_select, folder_name) for ind in tqdm(range(len(epsilons))): epsilon = epsilons[ind] for alpha in alphas: ResultsOnCurrentPara(epsilon, alpha, env, x_select, y_select, noise_type, folder_name)