forked from SunskyF/EasyPR-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
func_test.py
58 lines (46 loc) · 1.11 KB
/
func_test.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
# @Time : 2018/2/7
# @Author : fh
# @File : func_test.py
# @Desc :
"""
Functional test
"""
from lib.config import cfg_from_file
from plate import *
import sys
import argparse
test_menu = (
'-' * 8 + '\n' +
'功能测试:\n' +
'1. test plate_detect(车牌检测);\n' +
'2. test chars_recognize(字符识别);\n' +
'3. test plate_recognize(车牌识别);\n' +
'-' * 8
)
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Func test ULPR')
parser.add_argument('--cfg', dest='cfg_file',
help='must have a config file', default=None, type=str)
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
return args
def main():
while True:
print(test_menu)
select = input()
test_op[select]()
test_op = {
'1': test_plate_detect,
'2': test_chars_recognize,
'3': test_plate_recognize,
}
if __name__ == "__main__":
args = parse_args()
if args.cfg_file is not None:
cfg_from_file(args.cfg_file)
main()