-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
26 lines (20 loc) · 935 Bytes
/
Copy pathtest.py
File metadata and controls
26 lines (20 loc) · 935 Bytes
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
'''This is the repo which contains the original code to the WACV 2021 paper
"Same Same But DifferNet: Semi-Supervised Defect Detection with Normalizing Flows"
by Marco Rudolph, Bastian Wandt and Bodo Rosenhahn.
For further information contact Marco Rudolph (rudolph@tnt.uni-hannover.de)'''
import config as c
from train import *
from utils import load_datasets, make_dataloaders
import time
import gc
import json
_, _, test_set = load_datasets(c.dataset_path, c.class_name, test=True)
_, _, test_loader = make_dataloaders(None, None, test_set, test=True)
model = torch.load("models/" + c.modelname + "", map_location=torch.device('cpu'))
with open('models/' + c.modelname + '.json') as jsonfile:
model_parameters = json.load(jsonfile)
time_start = time.time()
test(model, model_parameters, test_loader)
time_end = time.time()
time_c = time_end - time_start # 运行所花时间
print("test time cost: {:f} s".format(time_c))