forked from dasUtsav/object-detect-disrupt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
31 lines (30 loc) · 1.19 KB
/
plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
import pickle
import pdb
import os
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
from timeit import default_timer as timer
import matplotlib
matplotlib.use('Agg')
#results_file = 'vanilla_entropy_reinforce_results.csv'
results_file = 'DCGAN_attack_results.csv'
base_name = 'att_plots/'
results = pd.read_csv(results_file)
Model, Attacker, eps, test_acc, test_att_acc = results['Model'].convert_objects(convert_numeric=True), \
results['Attacker'].convert_objects(convert_numeric=True),\
results['Epsilon'].convert_objects(convert_numeric=True),\
results['Test_acc'].convert_objects(convert_numeric=True),\
results['Test_att_acc'].convert_objects(convert_numeric=True)
plt.xlabel('Perturbation factor')
plt.ylabel('Model Accuracy')
res18_results = plt.plot(eps[0:5], test_att_acc[0:5], label='Res18')
res18_AT_results = plt.plot(eps[6:11], test_att_acc[6:11], label='Res18_AT')
res18_AT_attacker_results = plt.plot(
eps[12:17], test_att_acc[12:17], label='Res18_AT_attacker')
dense_res_att_results = plt.plot(
eps[18:23], test_att_acc[18:23], label='Dense_and_res_attacker')
plt.legend()
plt.savefig(base_name+'results')
plt.clf()