-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.py
32 lines (24 loc) · 956 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
29
30
31
32
from net_utils.train_test_utils import load_device, get_model, \
get_dataloader,CheckpointIO,get_tester
def run(cfg):
'''Load save path'''
cfg.log_string('Data save path: %s' % (cfg.save_path))
checkpoint=CheckpointIO(cfg)
'''Load device'''
cfg.log_string('Loading device settings.')
device = load_device(cfg)
'''Load data'''
cfg.log_string('Loading dataset.')
train_loader = get_dataloader(cfg.config, mode='test')
#test_loader = get_dataloader(cfg.config, mode='test')
'''Load net'''
cfg.log_string('Loading model.')
net = get_model(cfg.config, device=device).cuda().float()
checkpoint.register_modules(net=net)
'''Load tester'''
cfg.log_string('Loading tester.')
tester = get_tester(cfg.config)
'''Start to Test'''
cfg.log_string('Start to test.')
tester(cfg, net, loader=train_loader,device=device,checkpoint=checkpoint)
cfg.log_string('Testing finished.')