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

Function main

tools/track_sort.py:127–268  ·  view source on GitHub ↗
(exp, args, num_gpu)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

evaluate_sortMethod · 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