rachana219 commited on
Commit
1a54db0
·
1 Parent(s): ad1a4bb

fixed issue with argparser

Browse files
Files changed (1) hide show
  1. track.py +15 -12
track.py CHANGED
@@ -354,11 +354,12 @@ def parse_opt():
354
  parser.add_argument('--dnn', action='store_true', help='use OpenCV DNN for ONNX inference')
355
  parser.add_argument('--vid-stride', type=int, default=1, help='video frame-rate stride')
356
  parser.add_argument('--retina-masks', action='store_true', help='whether to plot masks in native resolution')
357
- opt = parser.parse_args()
358
- opt.imgsz *= 2 if len(opt.imgsz) == 1 else 1 # expand
359
- opt.tracking_config = ROOT / 'trackers' / opt.tracking_method / 'configs' / (opt.tracking_method + '.yaml')
360
- print_args(vars(opt))
361
- return opt
 
362
 
363
 
364
  def main(opt):
@@ -371,10 +372,14 @@ def main(opt):
371
  # main(opt)
372
 
373
  def MOT(yoloweights, trackingmethod, sourceVideo):
374
- opt = parse_opt()
375
- opt.yolo-weights = yoloweights
376
- opt.tracking-method = trackingmethod
377
- opt.source = sourceVideo
 
 
 
 
378
  main(opt)
379
  save_dir = increment_path('runs/track/exp', exist_ok=False)
380
  input = os.path.join(save_dir,'out.mp4')
@@ -383,6 +388,4 @@ def MOT(yoloweights, trackingmethod, sourceVideo):
383
  print(command)
384
  os.system(command)
385
  #!ffmpeg -i $input -vf fps=30 -vcodec libx264 $outpath tbd
386
- return outpath
387
-
388
-
 
354
  parser.add_argument('--dnn', action='store_true', help='use OpenCV DNN for ONNX inference')
355
  parser.add_argument('--vid-stride', type=int, default=1, help='video frame-rate stride')
356
  parser.add_argument('--retina-masks', action='store_true', help='whether to plot masks in native resolution')
357
+ #opt = parser.parse_args()
358
+ #opt.imgsz *= 2 if len(opt.imgsz) == 1 else 1 # expand
359
+ #opt.tracking_config = ROOT / 'trackers' / opt.tracking_method / 'configs' / (opt.tracking_method + '.yaml')
360
+ #print_args(vars(opt))
361
+ #return opt
362
+ return parser
363
 
364
 
365
  def main(opt):
 
372
  # main(opt)
373
 
374
  def MOT(yoloweights, trackingmethod, sourceVideo):
375
+ parser = parse_opt()
376
+ parser.add_argument('--yolo-weights', nargs='+', type=Path, default= yoloweights, help='model.pt path(s)')
377
+ parser.add_argument('--tracking-method', type=str, default= trackingmethod, help='strongsort, ocsort, bytetrack')
378
+ parser.add_argument('--source', type=str, default='0', help='file/dir/URL/glob, 0 for webcam')
379
+ opt = parser.parse_args()
380
+ opt.imgsz *= 2 if len(opt.imgsz) == 1 else 1 # expand
381
+ opt.tracking_config = ROOT / 'trackers' / opt.tracking_method / 'configs' / (opt.tracking_method + '.yaml')
382
+ print_args(vars(opt))
383
  main(opt)
384
  save_dir = increment_path('runs/track/exp', exist_ok=False)
385
  input = os.path.join(save_dir,'out.mp4')
 
388
  print(command)
389
  os.system(command)
390
  #!ffmpeg -i $input -vf fps=30 -vcodec libx264 $outpath tbd
391
+ return outpath