MCPcopy Create free account
hub / github.com/MotrixLab/insactor / main

Function main

tools/test.py:73–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71
72
73def main():
74 args = parse_args()
75
76 cfg = mmcv.Config.fromfile(args.config)
77 if args.cfg_options is not None:
78 cfg.merge_from_dict(args.cfg_options)
79 # set cudnn_benchmark
80 if cfg.get('cudnn_benchmark', False):
81 torch.backends.cudnn.benchmark = True
82 cfg.data.test.test_mode = True
83
84 # init distributed env first, since logger depends on the dist info.
85 if args.launcher == 'none':
86 distributed = False
87 else:
88 distributed = True
89 init_dist(args.launcher, **cfg.dist_params)
90
91 # build the dataloader
92 dataset = build_dataset(cfg.data.test)
93 # the extra round_up data will be removed during gpu/cpu collect
94 data_loader = build_dataloader(
95 dataset,
96 samples_per_gpu=cfg.data.samples_per_gpu,
97 workers_per_gpu=cfg.data.workers_per_gpu,
98 dist=distributed,
99 shuffle=False,
100 round_up=False)
101
102 # build the model and load checkpoint
103 model = build_architecture(cfg.model)
104 fp16_cfg = cfg.get('fp16', None)
105 if fp16_cfg is not None:
106 wrap_fp16_model(model)
107 load_checkpoint(model, args.checkpoint, map_location='cpu')
108
109 if not distributed:
110 if args.device == 'cpu':
111 model = model.cpu()
112 else:
113 model = MMDataParallel(model, device_ids=[0])
114 outputs = single_gpu_test(model, data_loader)
115 else:
116 model = MMDistributedDataParallel(
117 model.cuda(),
118 device_ids=[torch.cuda.current_device()],
119 broadcast_buffers=False)
120 outputs = multi_gpu_test(model, data_loader, args.tmpdir,
121 args.gpu_collect)
122
123 # for i in tqdm(range(0, len(outputs))):
124 # outputs[i]['pred_motion'] = outputs[i]['motion']
125
126
127 phys_mode = args.physmode
128 phys_setting = 'kit' if 'kit' in args.config else 'human'
129
130 if phys_mode == 'normal':

Callers 1

test.pyFile · 0.70

Calls 10

build_datasetFunction · 0.90
build_dataloaderFunction · 0.90
build_architectureFunction · 0.90
single_gpu_testFunction · 0.90
multi_gpu_testFunction · 0.90
add_scene_to_trajFunction · 0.90
execute_actionsFunction · 0.90
remove_scene_from_trajFunction · 0.90
parse_argsFunction · 0.70
evaluateMethod · 0.45

Tested by

no test coverage detected