forked from rohban-lab/Knowledge_Distillation_AD
-
Notifications
You must be signed in to change notification settings - Fork 22
/
test.py
31 lines (24 loc) · 1.12 KB
/
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
from argparse import ArgumentParser
from utils.utils import get_config
from dataloader import load_data, load_localization_data
from test_functions import detection_test, localization_test
from models.network import get_networks
parser = ArgumentParser()
parser.add_argument('--config', type=str, default='configs/config.yaml', help="training configuration")
def main():
args = parser.parse_args()
config = get_config(args.config)
vgg, model = get_networks(config, load_checkpoint=True)
# Localization test
if config['localization_test']:
test_dataloader, ground_truth = load_localization_data(config)
roc_auc = localization_test(model=model, vgg=vgg, test_dataloader=test_dataloader, ground_truth=ground_truth,
config=config)
# Detection test
else:
_, test_dataloader = load_data(config)
roc_auc = detection_test(model=model, vgg=vgg, test_dataloader=test_dataloader, config=config)
last_checkpoint = config['last_checkpoint']
print("RocAUC after {} epoch:".format(last_checkpoint), roc_auc)
if __name__ == '__main__':
main()