-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
market.py
68 lines (59 loc) · 1.98 KB
/
market.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
62
63
64
65
66
67
68
import os
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from PIL import Image
######################################################################
# Draw Curve
#---------------------------
x_epoch = [2,4,8,12,16]
top1 = {}
top10 = {}
mAP = {}
for i in range(6):
top1[i] = []
top10[i] = []
mAP[i] = []
top1[0] = [92.70, 92.70, 92.70, 92.70, 92.70]
top10[0] =[97.98, 97.98, 97.98, 97.98, 97.98]
mAP[0] = [77.14, 77.14, 77.14, 77.14, 77.14]
with open("./Output.txt", "r") as f:
for line in f:
score = line.split('|')
method_id = int(score[2])
top1_acc, top10_acc, mAP_acc = float(score[3]), float(score[5]), float(score[6])
top1[method_id].append(top1_acc*100)
top10[method_id].append(top10_acc*100)
mAP[method_id].append(mAP_acc*100)
fig = plt.figure(figsize=(15,4), dpi=180)
ax0 = fig.add_subplot(131, ylabel="Rank-1(%)",xlabel='epsilon')
ax0.plot(x_epoch, top1[0], 'k-', label='Clean')
ax0.plot(x_epoch, top1[1], 'b^-', label='Fast')
ax0.plot(x_epoch, top1[2], 'rs-', label='Basic')
ax0.plot(x_epoch, top1[3], 'gv-', label='Least-likely')
ax0.plot(x_epoch, top1[5], 'yo-', label='Ours')
ax0.grid(True)
ax0.legend()
plt.ylim(0.0,100.0)
plt.xlim(1,17)
ax0 = fig.add_subplot(132, ylabel="Rank-10(%)",xlabel='epsilon')
ax0.plot(x_epoch, top10[0], 'k-', label='Clean')
ax0.plot(x_epoch, top10[1], 'b^-', label='Fast')
ax0.plot(x_epoch, top10[2], 'rs-', label='Basic')
ax0.plot(x_epoch, top10[3], 'gv-', label='Least-likely')
ax0.plot(x_epoch, top10[5], 'yo-', label='Ours')
ax0.grid(True)
ax0.legend()
plt.ylim(0,100)
plt.xlim(1,17)
ax0 = fig.add_subplot(133, ylabel="mAP(%)", xlabel='epsilon')
ax0.plot(x_epoch, mAP[0], 'k-', label='Clean')
ax0.plot(x_epoch, mAP[1], 'b^-', label='Fast')
ax0.plot(x_epoch, mAP[2], 'rs-', label='Basic')
ax0.plot(x_epoch, mAP[3], 'gv-', label='Least-likely')
ax0.plot(x_epoch, mAP[5], 'yo-', label='Ours')
ax0.grid(True)
ax0.legend()
plt.ylim(0,100)
plt.xlim(1,17)
fig.savefig('market.jpg')