oskarastrom commited on
Commit
1548828
·
1 Parent(s): 25bfc19

Fixed tracking

Browse files
inference.py CHANGED
@@ -323,7 +323,6 @@ def do_tracking(all_preds, image_meter_width, image_meter_height, gp=None, max_a
323
  pbar.update(1)
324
 
325
  json_data = tracker.finalize(min_length=min_length)
326
- print(json_data['fish'])
327
 
328
  return json_data
329
 
 
323
  pbar.update(1)
324
 
325
  json_data = tracker.finalize(min_length=min_length)
 
326
 
327
  return json_data
328
 
scripts/detect_frames.py CHANGED
@@ -73,7 +73,6 @@ def detect(in_seq_dir, out_seq_dir, model, device, verbose):
73
  'width': width,
74
  'height': height
75
  }
76
- print('created object')
77
 
78
  with open(os.path.join(out_seq_dir, 'pred.json'), 'w') as f:
79
  json.dump(json_obj, f)
 
73
  'width': width,
74
  'height': height
75
  }
 
76
 
77
  with open(os.path.join(out_seq_dir, 'pred.json'), 'w') as f:
78
  json.dump(json_obj, f)
scripts/track_detection.py CHANGED
@@ -45,7 +45,7 @@ def main(args, config={}, verbose=True):
45
  for loc in locations:
46
 
47
  in_loc_dir = os.path.join(args.detections, loc)
48
- out_loc_dir = os.path.join(args.output, "tracker", "data", loc)
49
  os.makedirs(out_loc_dir, exist_ok=True)
50
  metadata_path = os.path.join(args.metadata, loc + ".json")
51
  print(in_loc_dir)
@@ -81,10 +81,6 @@ def track(in_loc_dir, out_loc_dir, metadata_path, seq, config, verbose):
81
  device = select_device(device_name, batch_size=32)
82
  inference = torch.load(inference_path, map_location=device)
83
 
84
- print(type(inference))
85
- print(len(inference))
86
- print(type(inference[0]))
87
-
88
  # read detection
89
  with open(json_path, 'r') as f:
90
  detection = json.load(f)
@@ -109,7 +105,7 @@ def track(in_loc_dir, out_loc_dir, metadata_path, seq, config, verbose):
109
 
110
  outputs = do_suppression(inference, conf_thres=config['conf_threshold'], iou_thres=config['nms_iou'], verbose=verbose)
111
 
112
- all_preds, real_width, real_height = format_predictions(image_shapes, outputs, width, height)
113
 
114
  results = do_tracking(all_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)
115
 
 
45
  for loc in locations:
46
 
47
  in_loc_dir = os.path.join(args.detections, loc)
48
+ out_loc_dir = os.path.join(args.output, loc, "tracker", "data")
49
  os.makedirs(out_loc_dir, exist_ok=True)
50
  metadata_path = os.path.join(args.metadata, loc + ".json")
51
  print(in_loc_dir)
 
81
  device = select_device(device_name, batch_size=32)
82
  inference = torch.load(inference_path, map_location=device)
83
 
 
 
 
 
84
  # read detection
85
  with open(json_path, 'r') as f:
86
  detection = json.load(f)
 
105
 
106
  outputs = do_suppression(inference, conf_thres=config['conf_threshold'], iou_thres=config['nms_iou'], verbose=verbose)
107
 
108
+ all_preds, real_width, real_height = format_predictions(image_shapes, outputs, width, height, verbose=verbose)
109
 
110
  results = do_tracking(all_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)
111