oskarastrom commited on
Commit
2316e0f
·
1 Parent(s): 557aa8b

associative parameters

Browse files
inference.py CHANGED
@@ -330,16 +330,11 @@ def do_tracking(all_preds, image_meter_width, image_meter_height, gp=None, max_a
330
 
331
  return json_data
332
 
333
- def do_associative_tracking(inference, image_shapes, width, height, image_meter_width, image_meter_height, gp=None, low_thresh=0.2, high_threshold=0.2, max_age=MAX_AGE, iou_thres=IOU_THRES, min_hits=MIN_HITS, min_length=MIN_LENGTH, batch_size=BATCH_SIZE, verbose=True):
334
 
335
  if (gp): gp(0, "Tracking...")
336
 
337
 
338
- low_outputs = do_suppression(inference, conf_thres=low_thresh, iou_thres=0.25, gp=gp, verbose=verbose)
339
- low_preds, real_width, real_height = format_predictions(image_shapes, low_outputs, width, height, verbose=verbose)
340
-
341
- high_outputs = do_suppression(inference, conf_thres=high_threshold, iou_thres=0.25, gp=gp, verbose=verbose)
342
- high_preds, real_width, real_height = format_predictions(image_shapes, high_outputs, width, height, verbose=verbose)
343
 
344
 
345
  # Initialize tracker
 
330
 
331
  return json_data
332
 
333
+ def do_associative_tracking(low_preds, high_preds, image_meter_width, image_meter_height, gp=None, low_thresh=0.2, high_threshold=0.2, max_age=MAX_AGE, iou_thres=IOU_THRES, min_hits=MIN_HITS, min_length=MIN_LENGTH, batch_size=BATCH_SIZE, verbose=True):
334
 
335
  if (gp): gp(0, "Tracking...")
336
 
337
 
 
 
 
 
 
338
 
339
 
340
  # Initialize tracker
scripts/track_detection.py CHANGED
@@ -101,8 +101,15 @@ def track(in_loc_dir, out_loc_dir, metadata_path, seq, config, verbose):
101
  image_meter_height = sequence['y_meter_start'] - sequence['y_meter_stop']
102
 
103
 
104
- if False:
105
- results, real_width, real_height = do_associative_tracking(inference, image_shapes, width, height, image_meter_width, image_meter_height, min_length=config['min_length'], max_age=config['max_age'], iou_thres=config['iou_threshold'], min_hits=config['min_hits'], verbose=verbose)
 
 
 
 
 
 
 
106
  else:
107
  outputs = do_suppression(inference, conf_thres=config['conf_threshold'], iou_thres=config['nms_iou'], verbose=verbose)
108
 
 
101
  image_meter_height = sequence['y_meter_start'] - sequence['y_meter_stop']
102
 
103
 
104
+ if True:
105
+
106
+ low_outputs = do_suppression(inference, conf_thres=config['low_conf_threshold'], iou_thres=config['nms_iou'], gp=gp, verbose=verbose)
107
+ low_preds, real_width, real_height = format_predictions(image_shapes, low_outputs, width, height, verbose=verbose)
108
+
109
+ high_outputs = do_suppression(inference, conf_thres=config['conf_threshold'], iou_thres=config['nms_iou'], gp=gp, verbose=verbose)
110
+ high_preds, real_width, real_height = format_predictions(image_shapes, high_outputs, width, height, verbose=verbose)
111
+
112
+ results, real_width, real_height = do_associative_tracking(low_preds, high_preds, image_meter_width, image_meter_height, min_length=config['min_length'], max_age=config['max_age'], iou_thres=config['iou_threshold'], min_hits=config['min_hits'], verbose=verbose)
113
  else:
114
  outputs = do_suppression(inference, conf_thres=config['conf_threshold'], iou_thres=config['nms_iou'], verbose=verbose)
115
 
scripts/track_eval.py CHANGED
@@ -20,6 +20,8 @@ def main(args):
20
 
21
  config = {
22
  'conf_threshold': float(args.conf_threshold),
 
 
23
  'nms_iou': float(args.nms_iou),
24
  'min_length': float(args.min_length),
25
  'max_age': int(args.max_age),
@@ -41,6 +43,8 @@ def argument_parser():
41
  parser = argparse.ArgumentParser()
42
  parser.add_argument("--detection_dir", default="../frames/detection_storage")
43
  parser.add_argument("--conf_threshold", default=0.3, help="Config object. Required.")
 
 
44
  parser.add_argument("--nms_iou", default=0.3, help="Config object. Required.")
45
  parser.add_argument("--min_length", default=0.3, help="Config object. Required.")
46
  parser.add_argument("--max_age", default=20, help="Config object. Required.")
 
20
 
21
  config = {
22
  'conf_threshold': float(args.conf_threshold),
23
+ 'low_conf_threshold': float(args.low_conf),
24
+ 'high_conf_threshold': float(args.high_conf),
25
  'nms_iou': float(args.nms_iou),
26
  'min_length': float(args.min_length),
27
  'max_age': int(args.max_age),
 
43
  parser = argparse.ArgumentParser()
44
  parser.add_argument("--detection_dir", default="../frames/detection_storage")
45
  parser.add_argument("--conf_threshold", default=0.3, help="Config object. Required.")
46
+ parser.add_argument("--low_conf", default=0.01, help="Config object. Required.")
47
+ parser.add_argument("--high_conf", default=0.3, help="Config object. Required.")
48
  parser.add_argument("--nms_iou", default=0.3, help="Config object. Required.")
49
  parser.add_argument("--min_length", default=0.3, help="Config object. Required.")
50
  parser.add_argument("--max_age", default=20, help="Config object. Required.")