-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot_minimal.py
61 lines (45 loc) · 1.7 KB
/
plot_minimal.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import os.path
import shutil
import sys
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
mpl.rcParams['ps.useafm'] = True
mpl.rcParams.update({'font.size': 14})
mpl.rc('axes', labelsize=14)
mpl.rc('ytick', labelsize=14)
mpl.rc('xtick', labelsize=14)
from pylab import *
import experiments
import pickle
################################################################################################
# Read experiment to run
################################################################################################
ID = int(sys.argv[1:][0])
opt = experiments.opt[ID]
crop_size = int(sys.argv[1:][1])
# Skip execution if instructed in experiment
if opt.skip:
print("SKIP")
quit()
for num_iter in range(100):
with open(opt.log_dir_base + opt.name + '/maps/top/' + str(experiments.crop_sizes[crop_size])
+ '/' + str(num_iter) + '.pkl', 'rb') as f:
results = pickle.load(f)
fig, ax = plt.subplots(figsize=(7, 5))
plt.imshow(results)
plt.colorbar()
plt.savefig(opt.log_dir_base + opt.name + '/maps/top/' + str(experiments.crop_sizes[crop_size])
+ '/' + str(num_iter) + '.pdf', format='pdf', dpi=1000)
plt.close('all')
with open(opt.log_dir_base + opt.name + '/maps/confidence/' + str(experiments.crop_sizes[crop_size])
+ '/' + str(num_iter) + '.pkl', 'rb') as f:
results = pickle.load(f)
fig, ax = plt.subplots(figsize=(7, 5))
plt.imshow(results)
plt.colorbar()
plt.savefig(opt.log_dir_base + opt.name + '/maps/confidence/' + str(experiments.crop_sizes[crop_size])
+ '/' + str(num_iter) + '.pdf', format='pdf', dpi=1000)
plt.close('all')
print(num_iter)
sys.stdout.flush()