-
Notifications
You must be signed in to change notification settings - Fork 47
/
dump_convex_hull.py
executable file
·62 lines (50 loc) · 1.6 KB
/
dump_convex_hull.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
#!/usr/bin/env python3
from __future__ import print_function
import argparse
import json
import numpy as np
import xlrd
from numpy import *
from scipy import *
from scipy._lib._util import _asarray_validated
from scipy.interpolate import BPoly, interp1d, pchip
parser = argparse.ArgumentParser(description="Dump convex hull")
parser.add_argument("xls", nargs=1, help="xls file to dump")
args = parser.parse_args()
met_index_as = {
"PSNR Y (libvmaf)": 11,
"PSNR Cb (libvmaf)": 18,
"PSNR Cr (libvmaf)": 25,
"CIEDE2000 (libvmaf)": 74,
"SSIM (libvmaf)": 39,
"MS-SSIM (libvmaf)": 46,
"PSNR-HVS (libvmaf)": 67,
"VMAF": 53,
"VMAF-NEG": 60,
}
resolutions = ["3840x2160", "2560x1440", "1920x1080", "1280x720", "960x540", "640x360"]
error_strings = []
def dump_as(file1):
ret = {}
a_xls = xlrd.open_workbook(file1)
a_sh = a_xls.sheet_by_index(0)
for metric in met_index_as:
if metric not in met_index_as:
return
ra = []
ya = []
for c in range(1, a_sh.ncols):
y = a_sh.cell_value(colx=c, rowx=met_index_as[metric] - 1 + 4)
if y == "":
continue
ya.append(y)
ra.append(a_sh.cell_value(colx=c, rowx=met_index_as[metric] - 1 + 5))
ra = np.flipud(ra)
ya = np.flipud(ya)
ret[metric] = {"Bitrate": ra.tolist(), "Metric": ya.tolist()}
return ret
# generate xls for each of the two runs:
# or run in args.run:
# subprocess.run(['python3', 'convexhull_framework/src/AWCYConvexHullTest.py', run], check=True)
ret = dump_as(args.xls[0])
print(json.dumps(ret))