oskarastrom commited on
Commit
fe5c71c
·
1 Parent(s): cef04ce

Min length hyperparam

Browse files
Files changed (3) hide show
  1. app.py +2 -1
  2. gradio_scripts/upload_ui.py +3 -0
  3. inference.py +2 -1
app.py CHANGED
@@ -27,7 +27,7 @@ result = {}
27
 
28
 
29
  # Called when an Aris file is uploaded for inference
30
- def on_aris_input(file_list, model_id, conf_thresh, iou_thresh, min_hits, max_age, use_associative):
31
 
32
  # Reset Result
33
  reset_state(result, state)
@@ -40,6 +40,7 @@ def on_aris_input(file_list, model_id, conf_thresh, iou_thresh, min_hits, max_ag
40
  'min_hits': min_hits,
41
  'max_age': max_age,
42
  'use_associative_tracking': use_associative,
 
43
  }
44
 
45
  print(" ")
 
27
 
28
 
29
  # Called when an Aris file is uploaded for inference
30
+ def on_aris_input(file_list, model_id, conf_thresh, iou_thresh, min_hits, max_age, use_associative, min_length):
31
 
32
  # Reset Result
33
  reset_state(result, state)
 
40
  'min_hits': min_hits,
41
  'max_age': max_age,
42
  'use_associative_tracking': use_associative,
43
+ 'min_length': min_length
44
  }
45
 
46
  print(" ")
gradio_scripts/upload_ui.py CHANGED
@@ -34,6 +34,9 @@ def Upload_Gradio(gradio_components):
34
  gr.Markdown("Associative Tracking")
35
  settings.append(gr.Checkbox(value=False, label="Enabled"))
36
 
 
 
 
37
  gradio_components['hyperparams'] = settings
38
 
39
  #Input field for aris submission
 
34
  gr.Markdown("Associative Tracking")
35
  settings.append(gr.Checkbox(value=False, label="Enabled"))
36
 
37
+ gr.Markdown("Other")
38
+ settings.append(gr.Slider(0, 3, value=0.3, label="Min Length", info="Minimum length of fish (meters) in order for it to count"))
39
+
40
  gradio_components['hyperparams'] = settings
41
 
42
  #Input field for aris submission
inference.py CHANGED
@@ -58,6 +58,7 @@ def do_full_inference(dataloader, image_meter_width, image_meter_height, gp=None
58
  if 'max_age' not in hyperparams: hyperparams['max_age'] = MAX_AGE
59
  if 'use_associative_tracking' not in hyperparams: hyperparams['use_associative_tracking'] = False
60
  if 'AT_decay' not in hyperparams: hyperparams['AT_decay'] = MIN_HITS
 
61
 
62
  model, device = setup_model(hyperparams['model'])
63
 
@@ -97,7 +98,7 @@ def do_full_inference(dataloader, image_meter_width, image_meter_height, gp=None
97
 
98
  all_preds, real_width, real_height = format_predictions(image_shapes, outputs, width, height, gp=gp)
99
 
100
- results = do_tracking(all_preds, image_meter_width, image_meter_height, min_hits=hyperparams['min_hits'], max_age=hyperparams['max_age'], gp=gp)
101
 
102
  return results
103
 
 
58
  if 'max_age' not in hyperparams: hyperparams['max_age'] = MAX_AGE
59
  if 'use_associative_tracking' not in hyperparams: hyperparams['use_associative_tracking'] = False
60
  if 'AT_decay' not in hyperparams: hyperparams['AT_decay'] = MIN_HITS
61
+ if 'min_length' not in hyperparams: hyperparams['min_length'] = MIN_LENGTH
62
 
63
  model, device = setup_model(hyperparams['model'])
64
 
 
98
 
99
  all_preds, real_width, real_height = format_predictions(image_shapes, outputs, width, height, gp=gp)
100
 
101
+ results = do_tracking(all_preds, image_meter_width, image_meter_height, min_hits=hyperparams['min_hits'], max_age=hyperparams['max_age'], min_length=hyperparams['min_length'], gp=gp)
102
 
103
  return results
104