MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / main

Function main

tools/track.py:128–271  ·  view source on GitHub ↗
(exp, args, num_gpu)

Source from the content-addressed store, hash-verified

126
127@logger.catch
128def main(exp, args, num_gpu):
129 if args.seed is not None:
130 random.seed(args.seed)
131 torch.manual_seed(args.seed)
132 cudnn.deterministic = True
133 warnings.warn(
134 "You have chosen to seed testing. This will turn on the CUDNN deterministic setting, "
135 )
136
137 is_distributed = num_gpu > 1
138
139 # set environment variables for distributed training
140 cudnn.benchmark = True
141
142 rank = args.local_rank
143 # rank = get_local_rank()
144
145 file_name = os.path.join(exp.output_dir, args.experiment_name)
146
147 if rank == 0:
148 os.makedirs(file_name, exist_ok=True)
149
150 results_folder = os.path.join(file_name, "track_results")
151 os.makedirs(results_folder, exist_ok=True)
152
153 setup_logger(file_name, distributed_rank=rank, filename="val_log.txt", mode="a")
154 logger.info("Args: {}".format(args))
155
156 if args.conf is not None:
157 exp.test_conf = args.conf
158 if args.nms is not None:
159 exp.nmsthre = args.nms
160 if args.tsize is not None:
161 exp.test_size = (args.tsize, args.tsize)
162
163 model = exp.get_model()
164 logger.info("Model Summary: {}".format(get_model_info(model, exp.test_size)))
165 #logger.info("Model Structure:\n{}".format(str(model)))
166
167 val_loader = exp.get_eval_loader(args.batch_size, is_distributed, args.test)
168 evaluator = MOTEvaluator(
169 args=args,
170 dataloader=val_loader,
171 img_size=exp.test_size,
172 confthre=exp.test_conf,
173 nmsthre=exp.nmsthre,
174 num_classes=exp.num_classes,
175 )
176
177 torch.cuda.set_device(rank)
178 model.cuda(rank)
179 model.eval()
180
181 if not args.speed and not args.trt:
182 if args.ckpt is None:
183 ckpt_file = os.path.join(file_name, "best_ckpt.pth.tar")
184 else:
185 ckpt_file = args.ckpt

Callers

nothing calls this directly

Calls 9

evaluateMethod · 0.95
setup_loggerFunction · 0.90
get_model_infoFunction · 0.90
MOTEvaluatorClass · 0.90
fuse_modelFunction · 0.90
compare_dataframesFunction · 0.70
get_modelMethod · 0.45
get_eval_loaderMethod · 0.45
evalMethod · 0.45

Tested by

no test coverage detected