oskarastrom commited on
Commit
7edd774
1 Parent(s): 17fa97d

Store hyperparameters as metadata

Browse files
Files changed (3) hide show
  1. aris.py +3 -0
  2. gradio_scripts/result_ui.py +3 -3
  3. main.py +7 -0
aris.py CHANGED
@@ -457,6 +457,9 @@ def create_metadata_table(result, table_headers, info_headers):
457
  info.append([field_name, str(metadata[field])])
458
  else:
459
  info.append([field_name, ""])
 
 
 
460
 
461
  return table, info
462
 
 
457
  info.append([field_name, str(metadata[field])])
458
  else:
459
  info.append([field_name, ""])
460
+ if 'hyperparameters' in metadata:
461
+ for param_name in metadata['hyperparameters']:
462
+ info.append(['**' + param_name + '**', str(metadata['hyperparameters'][param_name])])
463
 
464
  return table, info
465
 
gradio_scripts/result_ui.py CHANGED
@@ -16,9 +16,9 @@ js_update_tab_labels = """
16
 
17
  table_headers = ["TOTAL" , "FRAME_NUM", "DIR", "R", "THETA", "L", "TIME", "DATE", "SPECIES"]
18
  info_headers = [
19
- "TOTAL_TIME", "DATE", "START", "END", "TOTAL_FRAMES", "FRAME_RATE",
20
- "TOTAL_FISH", "UPSTREAM_FISH", "DOWNSTREAM_FISH", "NONDIRECTIONAL_FISH",
21
- "UPSTREAM_MOTION", "INTENSITY", "THRESHOLD", "WATER_TEMP"
22
  ]
23
  max_tabs = 10
24
 
 
16
 
17
  table_headers = ["TOTAL" , "FRAME_NUM", "DIR", "R", "THETA", "L", "TIME", "DATE", "SPECIES"]
18
  info_headers = [
19
+ "TOTAL_TIME", "DATE", "START", "END", "TOTAL_FRAMES", "FRAME_RATE", "",
20
+ "TOTAL_FISH", "UPSTREAM_FISH", "DOWNSTREAM_FISH", "NONDIRECTIONAL_FISH", "",
21
+ "UPSTREAM_MOTION", "INTENSITY", "THRESHOLD", "WATER_TEMP", "",
22
  ]
23
  max_tabs = 10
24
 
main.py CHANGED
@@ -50,6 +50,13 @@ def predict_task(filepath, weights, conf_thresh, iou_thresh, min_hits, max_age,
50
  # re-index results if desired - this should be done before writing the file
51
  results = prep_for_mm(results)
52
  results = add_metadata_to_result(filepath, results)
 
 
 
 
 
 
 
53
 
54
  # write output to disk
55
  json_dump_round_float(results, results_filepath)
 
50
  # re-index results if desired - this should be done before writing the file
51
  results = prep_for_mm(results)
52
  results = add_metadata_to_result(filepath, results)
53
+ results['metadata']['hyperparameters'] = {
54
+ 'model': weights,
55
+ 'conf_thresh': conf_thresh,
56
+ 'iou_thresh': iou_thresh,
57
+ 'min_hits': min_hits,
58
+ 'max_age': max_age
59
+ }
60
 
61
  # write output to disk
62
  json_dump_round_float(results, results_filepath)