forked from RICKIE777/ovmtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark_vis.py
executable file
·42 lines (32 loc) · 1.07 KB
/
benchmark_vis.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
#!/usr/bin/python3
import numpy as np
#import matplotlib.pyplot as plt
import sys, os
log_file = sys.argv[1]
stat = {}
with open(log_file,"r") as f:
for l in f.readlines():
logs = l.split(' ')
if len(logs) != 3:
print("[ERROR] {}".format(l.rstrip("\n").rstrip("\r")))
continue
fpsA, fpsB, xml = l.split(' ')
ratio = (float(fpsB)/float(fpsA)) - 1.0
fullpath = xml.rstrip("\n").rstrip("\r")
if not fullpath in stat:
stat[fullpath] = [[],[]]
stat[fullpath][0].append(ratio)
stat[fullpath][1].append([fpsA, fpsB])
summary = sorted(stat.items(), key=lambda d: np.mean(d[1][0]), reverse=True)
cnt = 0
for k, v in summary:
ratios = np.array(v[0])
r_mean = np.mean(ratios)
r_min = np.amin(ratios)
r_max = np.amax(ratios)
name = os.path.split(k)[1]
print("[{}] {:>8.1f}% {}% {}".format(cnt, r_mean*100, (ratios*100).astype(np.int32), k))
for fps in v[1]:
print(" {} : {}".format(fps[0], fps[1]))
cnt+=1
print("Total {} modles".format(cnt))