forked from ShuangXieIrene/ssds.pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
44 lines (36 loc) · 1.17 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
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import print_function
import sys
import os
import argparse
import numpy as np
if '/data/software/opencv-3.4.0/lib/python2.7/dist-packages' in sys.path:
sys.path.remove('/data/software/opencv-3.4.0/lib/python2.7/dist-packages')
if '/data/software/opencv-3.3.1/lib/python2.7/dist-packages' in sys.path:
sys.path.remove('/data/software/opencv-3.3.1/lib/python2.7/dist-packages')
import cv2
from datetime import datetime
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from lib.utils.config_parse import cfg_from_file
from lib.ssds_train import test_model
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Train a ssds.pytorch network')
parser.add_argument('--cfg', dest='config_file',
help='optional config file', default=None, type=str)
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
return args
def test():
args = parse_args()
if args.config_file is not None:
cfg_from_file(args.config_file)
test_model()
if __name__ == '__main__':
test()