forked from yuxiwang66/Iris-Recognition-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify.py
54 lines (38 loc) · 1.54 KB
/
verify.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
##-----------------------------------------------------------------------------
## Import
##-----------------------------------------------------------------------------
import argparse
from time import time
from fnc.extractFeature import extractFeature
from fnc.matching import matching
#------------------------------------------------------------------------------
# Argument parsing
#------------------------------------------------------------------------------
parser = argparse.ArgumentParser()
parser.add_argument("--file", type=str,
help="Path to the file that you want to verify.")
parser.add_argument("--temp_dir", type=str, default="./templates/",
help="Path to the directory containing templates.")
parser.add_argument("--thres", type=float, default=0.38,
help="Threshold for matching.")
args = parser.parse_args()
##-----------------------------------------------------------------------------
## Execution
##-----------------------------------------------------------------------------
# Extract feature
start = time()
print('>>> Start verifying {}\n'.format(args.file))
template, mask, file = extractFeature(args.file)
# Matching
result = matching(template, mask, args.temp_dir, args.thres)
if result == -1:
print('>>> No registered sample.')
elif result == 0:
print('>>> No sample matched.')
else:
print('>>> {} samples matched (descending reliability):'.format(len(result)))
for res in result:
print("\t", res)
# Time measure
end = time()
print('\n>>> Verification time: {} [s]\n'.format(end - start))