MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / parse

Method parse

tutorials/centertrack/opts.py:260–329  ·  view source on GitHub ↗
(self, args='')

Source from the content-addressed store, hash-verified

258 self.parser.add_argument('--bird_view_world_size', type=int, default=64)
259
260 def parse(self, args=''):
261 if args == '':
262 opt = self.parser.parse_args()
263 else:
264 opt = self.parser.parse_args(args)
265
266 if opt.test_dataset == '':
267 opt.test_dataset = opt.dataset
268
269 opt.gpus_str = opt.gpus
270 opt.gpus = [int(gpu) for gpu in opt.gpus.split(',')]
271 opt.gpus = [i for i in range(len(opt.gpus))] if opt.gpus[0] >=0 else [-1]
272 opt.lr_step = [int(i) for i in opt.lr_step.split(',')]
273 opt.save_point = [int(i) for i in opt.save_point.split(',')]
274 opt.test_scales = [float(i) for i in opt.test_scales.split(',')]
275 opt.save_imgs = [i for i in opt.save_imgs.split(',')] \
276 if opt.save_imgs != '' else []
277 opt.ignore_loaded_cats = \
278 [int(i) for i in opt.ignore_loaded_cats.split(',')] \
279 if opt.ignore_loaded_cats != '' else []
280
281 opt.num_workers = max(opt.num_workers, 2 * len(opt.gpus))
282 opt.pre_img = False
283 if 'tracking' in opt.task:
284 print('Running tracking')
285 opt.tracking = True
286# opt.out_thresh = max(opt.track_thresh, opt.out_thresh)
287# opt.pre_thresh = max(opt.track_thresh, opt.pre_thresh)
288# opt.new_thresh = max(opt.track_thresh, opt.new_thresh)
289 opt.pre_img = not opt.no_pre_img
290 print('Using tracking threshold for out threshold!', opt.track_thresh)
291 if 'ddd' in opt.task:
292 opt.show_track_color = True
293
294 opt.fix_res = not opt.keep_res
295 print('Fix size testing.' if opt.fix_res else 'Keep resolution testing.')
296
297 if opt.head_conv == -1: # init default head_conv
298 opt.head_conv = 256 if 'dla' in opt.arch else 64
299
300 opt.pad = 127 if 'hourglass' in opt.arch else 31
301 opt.num_stacks = 2 if opt.arch == 'hourglass' else 1
302
303 if opt.master_batch_size == -1:
304 opt.master_batch_size = opt.batch_size // len(opt.gpus)
305 rest_batch_size = (opt.batch_size - opt.master_batch_size)
306 opt.chunk_sizes = [opt.master_batch_size]
307 for i in range(len(opt.gpus) - 1):
308 slave_chunk_size = rest_batch_size // (len(opt.gpus) - 1)
309 if i < rest_batch_size % (len(opt.gpus) - 1):
310 slave_chunk_size += 1
311 opt.chunk_sizes.append(slave_chunk_size)
312 print('training chunk_sizes:', opt.chunk_sizes)
313
314 if opt.debug > 0:
315 opt.num_workers = 0
316 opt.batch_size = 1
317 opt.gpus = [opt.gpus[0]]

Callers 1

initMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected