Victoria Oberascher commited on
Commit
7da121b
1 Parent(s): 5d7bacb

update readme

Browse files
Files changed (1) hide show
  1. README.md +37 -28
README.md CHANGED
@@ -3,7 +3,7 @@ title: horizon-metrics
3
  tags:
4
  - evaluate
5
  - metric
6
- description: "TODO: add a description here"
7
  sdk: gradio
8
  sdk_version: 3.19.1
9
  app_file: app.py
@@ -25,7 +25,7 @@ To get started with horizon-metrics, make sure you have the necessary dependenci
25
 
26
  ### Installation
27
 
28
- ```bash
29
  pip install evaluate git+https://github.com/SEA-AI/seametrics@develop
30
  ```
31
 
@@ -52,23 +52,25 @@ prediction_points = [[[0.0, 0.5428930956049597], [1.0, 0.4642497615378973]],
52
  ##### Load data from fiftyone
53
 
54
  ```python
55
- sequence = "Sentry_2023_02_Portugal_2023_01_24_19_15_17"
 
56
  dataset_name = "SENTRY_VIDEOS_DATASET_QA"
57
  sequence_view = fo.load_dataset(dataset_name).match(F("sequence") == sequence)
58
  sequence_view = sequence_view.select_group_slices("thermal_wide")
59
 
 
60
  polylines_gt = sequence_view.values("frames.ground_truth_pl")
61
  ground_truth_points = [
62
- line["polylines"][0]["points"][0] for line in polylines_gt[0]
63
- if line is not None
64
  ]
65
 
 
66
  polylines_pred = sequence_view.values(
67
- "frames.ahoy-IR-b2-whales__XAVIER-AGX-JP46_pl")
68
  prediction_points = [
69
- line["polylines"][0]["points"][0] for line in polylines_pred[0]
70
- if line is not None
71
- ]
72
  ```
73
 
74
  ##### Calculate horizon metrics
@@ -76,38 +78,45 @@ prediction_points = [
76
  ```python
77
  import evaluate
78
 
79
- module = evaluate.load("SEA-AI/horizon-metrics")
80
- module.add(predictions=ground_truth_points, references=prediction_points)
81
  module.compute()
 
82
  ```
83
 
84
  This is output the evalutaion metrics for your horizon prediciton model:
85
 
86
- ```python
87
- {
88
- 'average_slope_error': 0.014823194839790999,
89
- 'average_midpoint_error': 0.014285714285714301,
90
- 'stddev_slope_error': 0.01519178791378349,
91
- 'stddev_midpoint_error': 0.0022661781575342445,
92
- 'max_slope_error': 0.033526146567062376,
93
- 'max_midpoint_error': 0.018161272321428612,
94
- 'num_slope_error_jumps': 1,
95
- 'num_midpoint_error_jumps': 1
96
- }
 
 
97
  ```
98
 
99
  ### Output Values
100
 
101
  SEA-AI/horizon-metrics provides the following performance metrics for horizon prediction:
102
 
103
- - **average_slope_error**: Measures the average difference in slope between the predicted and ground truth horizon.
104
- - **average_midpoint_error**: Calculates the average difference in midpoint position between the predicted and ground truth horizon.
105
- - **stddev_slope_error**: Indicates the variability of errors in slope between the predicted and ground truth horizon.
106
- - **stddev_midpoint_error**: Quantifies the variability of errors in midpoint position between the predicted and ground truth horizon.
107
- - **max_slope_error**: Represents the maximum difference in slope between the predicted and ground truth horizon.
108
- - **max_midpoint_error**: Indicates the maximum difference in midpoint position between the predicted and ground truth horizon.
 
 
 
109
  - **num_slope_error_jumps**: Calculates the differences between errors in successive frames for the slope. It then counts the number of jumps in these errors by comparing the absolute differences to a specified threshold.
110
  - **num_midpoint_error_jumps**: Calculates the differences between errors in successive frames for the midpoint. It then counts the number of jumps in these errors by comparing the absolute differences to a specified threshold.
 
111
 
112
  ## Further References
113
 
 
3
  tags:
4
  - evaluate
5
  - metric
6
+ description: "This huggingface metric calculates horizon evaluation metrics using `seametrics.horizon.HorizonMetrics`."
7
  sdk: gradio
8
  sdk_version: 3.19.1
9
  app_file: app.py
 
25
 
26
  ### Installation
27
 
28
+ ```sh
29
  pip install evaluate git+https://github.com/SEA-AI/seametrics@develop
30
  ```
31
 
 
52
  ##### Load data from fiftyone
53
 
54
  ```python
55
+ # Load data from fiftyone
56
+ sequence = "Sentry_2022_11_PROACT_CELADON_7.5M_MOB_2022_11_25_12_29_48"
57
  dataset_name = "SENTRY_VIDEOS_DATASET_QA"
58
  sequence_view = fo.load_dataset(dataset_name).match(F("sequence") == sequence)
59
  sequence_view = sequence_view.select_group_slices("thermal_wide")
60
 
61
+ # Get the ground truth points
62
  polylines_gt = sequence_view.values("frames.ground_truth_pl")
63
  ground_truth_points = [
64
+ line["polylines"][0]["points"][0] if line is not None else None
65
+ for line in polylines_gt[0]
66
  ]
67
 
68
+ # Get the predicted points
69
  polylines_pred = sequence_view.values(
70
+ "frames.ahoy-IR-b2-whales__XAVIER-AGX-JP46_pl_TnFoV")
71
  prediction_points = [
72
+ line["polylines"][0]["points"][0] if line is not None else None
73
+ for line in polylines_pred[0]
 
74
  ```
75
 
76
  ##### Calculate horizon metrics
 
78
  ```python
79
  import evaluate
80
 
81
+ module = evaluate.load("SEA-AI/horizon-metrics", roll_threshold=0.5, pitch_threshold=0.1, vertical_fov_degrees=25.6, height=512)
82
+ module.add(predictions=prediction_points, references=ground_truth_points)
83
  module.compute()
84
+
85
  ```
86
 
87
  This is output the evalutaion metrics for your horizon prediciton model:
88
 
89
+ ```console
90
+ {'average_slope_error': 0.39394822776758726,
91
+ 'average_midpoint_error': 0.0935801366906932,
92
+ 'average_midpoint_error_px': 1.871602733813864,
93
+ 'stddev_slope_error': 0.3809031270343266,
94
+ 'stddev_midpoint_error': 0.23003871087476538,
95
+ 'stddev_midpoint_error_px': 4.6007742174953075,
96
+ 'max_slope_error': 3.5549008029526132,
97
+ 'max_midpoint_error': 2.515424321301225,
98
+ 'max_midpoint_error_px': 50.3084864260245,
99
+ 'num_slope_error_jumps': 173,
100
+ 'num_midpoint_error_jumps': 205,
101
+ 'detection_rate': 0.2606486908948808}
102
  ```
103
 
104
  ### Output Values
105
 
106
  SEA-AI/horizon-metrics provides the following performance metrics for horizon prediction:
107
 
108
+ - **average_slope_error**: Measures the average difference in slope between the predicted and ground truth horizon in degree.
109
+ - **average_midpoint_error**: Represents the average difference in midpoint position between the predicted and ground truth horizon.
110
+ - **average_midpoint_error_px**: Represents the average difference in midpoint position between the predicted and ground truth horizon, measured in pixels.
111
+ - **stddev_slope_error**: Indicates the variability of errors in slope between the predicted and ground truth horizon in degree.
112
+ - **stddev_midpoint_error**: Quantifies the variability of errors in midpoint position between the predicted and ground truth horizon in degree.
113
+ - **stddev_midpoint_error_px**: Quantifies the variability of errors in midpoint position between the predicted and ground truth horizon, measured in pixels.
114
+ - **max_slope_error**: Represents the maximum difference in slope between the predicted and ground truth horizon in degree.
115
+ - **max_midpoint_error**: Indicates the maximum difference in midpoint position between the predicted and ground truth horizon in degree.
116
+ - **max_midpoint_error_px**: Indicates the maximum difference in midpoint position between the predicted and ground truth horizon, measured in pixels.
117
  - **num_slope_error_jumps**: Calculates the differences between errors in successive frames for the slope. It then counts the number of jumps in these errors by comparing the absolute differences to a specified threshold.
118
  - **num_midpoint_error_jumps**: Calculates the differences between errors in successive frames for the midpoint. It then counts the number of jumps in these errors by comparing the absolute differences to a specified threshold.
119
+ - **detection_rate**: Measures the proportion of frames in which the horizon is successfully detected out of the total number of frames.
120
 
121
  ## Further References
122