-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving mota output #180
base: main
Are you sure you want to change the base?
Saving mota output #180
Conversation
nikk-nikaznan
commented
Jun 4, 2024
•
edited
Loading
edited
- mota return all the metrics and save to csv
- adding some plot functions to visualise the tracking result
Signed-off-by: nikk-nikaznan <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #180 +/- ##
==========================================
- Coverage 46.13% 45.67% -0.46%
==========================================
Files 24 24
Lines 1461 1526 +65
==========================================
+ Hits 674 697 +23
- Misses 787 829 +42 ☔ View full report in Codecov by Sentry. |
…entre/crabs-exploration into nikkna/eval_track_dev
Signed-off-by: nikk-nikaznan <[email protected]>
Signed-off-by: nikk-nikaznan <[email protected]>
…ration into nikkna/eval_track_dev
…entre/crabs-exploration into nikkna/eval_track_dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks Nik! 🚀
Some small suggestions, and a slightly larger one re the output directory naming.
@@ -299,7 +307,15 @@ def evaluate_mota( | |||
mota = ( | |||
1 - (missed_detections + false_positive + num_switches) / total_gt | |||
) | |||
return mota, gt_to_tracked_id_current_frame | |||
return ( | |||
mota, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning a long tuple is sometimes considered a code smell.
Maybe we can pass mota and its components as a dict to reduce this?
"Missed Detections": [], | ||
"False Positives": [], | ||
"Number of Switches": [], | ||
"Mota": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Mota": [], | |
"MOTA": [], |
gt_data_frame, | ||
pred_data_frame, | ||
self.iou_threshold, | ||
prev_frame_id_map, | ||
) | ||
mota_values.append(mota) | ||
results["Frame Number"].append(frame_number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we make evaluate_mota
return a dict for the MOTA and its components (called for example mota_dict
), then we can make results
have the same keys. That way we can make this bit smaller:
for key in results.keys():
results[key].append(mota_dict[key])
@@ -154,6 +156,7 @@ def save_required_output( | |||
frame_copy = frame.copy() | |||
for bbox in tracked_boxes: | |||
xmin, ymin, xmax, ymax, id = bbox | |||
print(f"Calling draw_bbox with {bbox}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print(f"Calling draw_bbox with {bbox}") | |
mota_value_list.append(float(row["Mota"])) | ||
|
||
return ( | ||
true_positives_list, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this tuple can be a dict instead? It's a bit less of a code smell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we read the csv as a pandas dataframe instead we can extract the columns more efficiently (that is, without explicit looping).
There is also a dataframe .to_dict()
method, so we may be able to get the output dictionary in one go this way.
plot_name = filepath.name | ||
|
||
num_frames = len(true_positives_list) | ||
frames = range(1, num_frames + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frames = range(1, num_frames + 1) | |
frame_numbers = range(1, num_frames + 1) |
track_results: dict[str, Any], | ||
) -> None: | ||
track_df = pd.DataFrame(track_results) | ||
output_filename = f"{tracking_output_dir}/tracking_metrics_output.csv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to follow our usual convention, could we timestamp the output directory? We would need to ensure it goes in the same directory as the video output if requested (or other outputs that may be requested)