-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.py
28 lines (19 loc) · 795 Bytes
/
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
from options.test_parser import TestParser
from models import create_model, get_model_parsing_modifier
from datasets import create_dataset, get_dataset_parsing_modifier
parser = TestParser()
model_name = parser.get_model_name()
dataset_name = parser.get_dataset_name()
print('Model name: {}'.format(model_name))
print('Dataset name: {}'.format(dataset_name))
model_parser_modifier = get_model_parsing_modifier(model_name)
model_parser_modifier(parser, is_train=False)
dataset_parser_modifier = get_dataset_parsing_modifier(dataset_name)
dataset_parser_modifier(parser, is_train=False)
opts, _ = parser.parse_options()
opts_str = parser.make_opts_string(opts, verbose=True)
model = create_model(opts)
dataset = create_dataset(opts)
if opts.eval:
model.set_eval()
model.test(dataset)