-
Notifications
You must be signed in to change notification settings - Fork 432
/
Copy pathtest_megaface.py
43 lines (41 loc) · 1.91 KB
/
test_megaface.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
"""
@author: Jun Wang
@date: 20201012
@contact: [email protected]
"""
import argparse
import yaml
from megaface.megaface_evaluator import CommonMegaFaceEvaluator
from megaface.megaface_evaluator import MaskedMegaFaceEvaluator
if __name__ == '__main__':
conf = argparse.ArgumentParser(description='megaface test protocal in python.')
conf.add_argument("--data_conf_file", type = str,
help = "The path of data_conf.yaml.")
conf.add_argument("--max_rank", type = int,
help = "Rank N accuray..")
conf.add_argument("--facescrub_feature_dir", type = str,
help = "The dir of facescrub features.")
conf.add_argument("--megaface_feature_dir", type = str,
help = "The dir of megaface features.")
conf.add_argument("--masked_facescrub_feature_dir", type = str,
help = "The dir of masked facescrub features.")
conf.add_argument("--is_concat", type = int,
help = "If the feature is concated by two nomalized features.")
args = conf.parse_args()
with open(args.data_conf_file) as f:
data_conf = yaml.load(f)['MegaFace']
facescrub_json_list = data_conf['facescrub_list']
megaface_json_list = data_conf['megaceface_list']
megaface_mask = data_conf['megaface-mask']
is_concat = True if args.is_concat == 1 else False
if megaface_mask == 0:
megaFaceEvaluator = CommonMegaFaceEvaluator(
facescrub_json_list, megaface_json_list,
args.facescrub_feature_dir, args.megaface_feature_dir,
is_concat)
elif megaface_mask == 1:
megaFaceEvaluator = MaskedMegaFaceEvaluator(
facescrub_json_list, megaface_json_list,
args.facescrub_feature_dir, args.megaface_feature_dir,
args.masked_facescrub_feature_dir, is_concat)
megaFaceEvaluator.test_cmc(args.max_rank)