MCPcopy
hub / github.com/open-mmlab/mmtracking / main

Function main

tools/test.py:86–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84
85
86def main():
87 args = parse_args()
88
89 assert args.out or args.eval or args.format_only or args.show \
90 or args.show_dir, \
91 ('Please specify at least one operation (save/eval/format/show the '
92 'results / save the results) with the argument "--out", "--eval"'
93 ', "--format-only", "--show" or "--show-dir"')
94
95 if args.eval and args.format_only:
96 raise ValueError('--eval and --format_only cannot be both specified')
97
98 if args.out is not None and not args.out.endswith(('.pkl', '.pickle')):
99 raise ValueError('The output file must be a pkl file.')
100
101 cfg = Config.fromfile(args.config)
102 if cfg.get('USE_MMDET', False):
103 from mmdet.apis import multi_gpu_test, single_gpu_test
104 from mmdet.datasets import build_dataloader
105 from mmdet.models import build_detector as build_model
106 if 'detector' in cfg.model:
107 cfg.model = cfg.model.detector
108 elif cfg.get('TRAIN_REID', False):
109 from mmdet.apis import multi_gpu_test, single_gpu_test
110 from mmdet.datasets import build_dataloader
111
112 from mmtrack.models import build_reid as build_model
113 if 'reid' in cfg.model:
114 cfg.model = cfg.model.reid
115 else:
116 from mmtrack.apis import multi_gpu_test, single_gpu_test
117 from mmtrack.datasets import build_dataloader
118 from mmtrack.models import build_model
119 if args.cfg_options is not None:
120 cfg.merge_from_dict(args.cfg_options)
121
122 # set multi-process settings
123 setup_multi_processes(cfg)
124
125 # set random seeds. Force setting fixed seed and deterministic=True in SOT
126 # configs
127 if cfg.get('cudnn_benchmark', False):
128 torch.backends.cudnn.benchmark = True
129 if cfg.get('seed', None) is not None:
130 set_random_seed(
131 cfg.seed, deterministic=cfg.get('deterministic', False))
132 cfg.data.test.test_mode = True
133
134 cfg.gpu_ids = [args.gpu_id]
135
136 # init distributed env first, since logger depends on the dist info.
137 if args.launcher == 'none':
138 distributed = False
139 else:
140 distributed = True
141 init_dist(args.launcher, **cfg.dist_params)
142
143 rank, _ = get_dist_info()

Callers 1

test.pyFile · 0.70

Calls 11

setup_multi_processesFunction · 0.90
build_dataloaderFunction · 0.90
build_modelFunction · 0.90
single_gpu_testFunction · 0.90
multi_gpu_testFunction · 0.90
getMethod · 0.80
parse_argsFunction · 0.70
init_weightsMethod · 0.45
format_resultsMethod · 0.45
updateMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected