-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluate.py
62 lines (51 loc) · 1.85 KB
/
evaluate.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
'''
This script is used to run single evaluation cycle to
calculate the metrics, and save the numbers in csv.
'''
import os, subprocess, sys, datetime, signal, shutil
hdd_dir = "../../../mnt/external2/tunjian"
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
# runcase = int(sys.argv[1])
# print ("Testing test case %d" % runcase)
def preexec(): # Don't forward signals.
os.setpgrp()
def mycall(cmd, block=False):
if not block:
return subprocess.Popen(cmd)
else:
return subprocess.Popen(cmd, preexec_fn = preexec)
# def folder_check(path):
# try_num = 1
# oripath = path[:-1] if path.endswith('/') else path
# while os.path.exists(path):
# print("Delete existing folder " + path + "?(Y/N)")
# decision = input()
# if decision == "Y":
# shutil.rmtree(path, ignore_errors=True)
# break
# else:
# path = oripath + "_%d/"%try_num
# try_num += 1
# print(path)
# return path
if __name__ == "__main__":
# testpre = ["calendar"] # just put more scenes to evaluate all of them
# dirstr = "/home/tunjian/oriTecoGAN/results/" # the outputs
# tarstr = hdd_dir+"/HR/" # the GT
tarstr = 'D:\\Github\\SuperResolutionOutputFromServer\\EDVR\\Vid4\\edvr150k'
dirstr = 'D:\\Github\\SuperResolutionOutputFromServer\\EDVR\\Vid4\\edvr50k'
# tar_list = [(tarstr+_) for _ in testpre]
# out_list = [(dirstr+_) for _ in testpre]
tar_list = tarstr
out_list = dirstr
cmd1 = ["python", "metrics.py",
"--output", dirstr+"metric_log/",
"--results", out_list,
"--targets", tar_list,
]
# cmd1 = ["python", "metrics.py",
# "--output", dirstr+"metric_log/",
# "--results", ",".join(out_list),
# "--targets", ",".join(tar_list),
# ]
mycall(cmd1).communicate()