Skip to content
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

Add ground truth tracking video #216

Open
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

nikk-nikaznan
Copy link
Collaborator

@nikk-nikaznan nikk-nikaznan commented Jul 8, 2024

  • Refactor some function - both dict function (get_ground_truth_data and get_predicted_data) moved to utils (tracking)
  • Add save ground truth tracking to video output when gt_path is given for Option to save video with ground truth tracking #209
  • Add some tests for save_required_output and save_required_output

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 79.68750% with 13 lines in your changes missing coverage. Please review.

Project coverage is 47.71%. Comparing base (f46e362) to head (2e1553d).

Files Patch % Lines
crabs/tracker/track_video.py 12.50% 7 Missing ⚠️
crabs/tracker/utils/io.py 45.45% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   46.68%   47.71%   +1.03%     
==========================================
  Files          24       24              
  Lines        1476     1486      +10     
==========================================
+ Hits          689      709      +20     
+ Misses        787      777      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nikk-nikaznan nikk-nikaznan marked this pull request as ready for review July 9, 2024 15:04
@nikk-nikaznan nikk-nikaznan requested a review from sfmig July 9, 2024 15:04
Copy link
Collaborator

@sfmig sfmig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks Nik!

Two main points in this PR:

  • The first one is that I think with the code as is, the ground truth path is in practice a required argument. But we want to be able to run the detector+tracker even if no ground truth is provided (i.e., running inference). If ground truth is provided, we run inference and evaluation, and optionally (if save_video_output is True) we can save a video with detections and ground truth.

  • The second one is about the frame_number vs frame_idx. Apologies cause I think I may have not been very clear before. The issue is that we shouldn't be using frame numbers as indices to a list, because the frame numbers are extracted from the png filenames, and these may not necessarily start with frame 1 or 0. The safest, most general way imo is to use dictionaries whose keys are frame numbers (not indices), for both predictions and ground truth.

    At the moment, we use dictionaries with keys = frame numbers for ground truth only. For predictions, the keys are frame indices.

    I believe this would cause issues if the ground truth frames start counting from a number different from 1 - I include a specific example in the comments.

I think also some bits from previous PRs got lost? I found some old versions of lines (e.g. line 224 of crabs/tracker/utils/tracking.py ).

Let me know if this makes sense, happy to discuss.

crabs/tracker/utils/tracking.py Show resolved Hide resolved
tests/test_unit/test_tracker_io.py Show resolved Hide resolved
crabs/tracker/evaluate_tracker.py Outdated Show resolved Hide resolved
crabs/tracker/utils/tracking.py Outdated Show resolved Hide resolved
crabs/tracker/utils/tracking.py Outdated Show resolved Hide resolved
crabs/tracker/track_video.py Outdated Show resolved Hide resolved
crabs/tracker/track_video.py Outdated Show resolved Hide resolved
crabs/tracker/track_video.py Show resolved Hide resolved
crabs/tracker/track_video.py Outdated Show resolved Hide resolved
tests/test_unit/test_tracker_io.py Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@nikk-nikaznan nikk-nikaznan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sofia. Sorry for the messy code. I have now add code to deal when we have no gt_path. Sorry about the frame_idx vs frame_number. It was my fault for not checking that, just the bad way of merging happened.
I wasn't try to be a rebellious! 😂

crabs/tracker/track_video.py Show resolved Hide resolved
crabs/tracker/track_video.py Outdated Show resolved Hide resolved
crabs/tracker/track_video.py Outdated Show resolved Hide resolved
crabs/tracker/track_video.py Outdated Show resolved Hide resolved
crabs/tracker/utils/tracking.py Outdated Show resolved Hide resolved
tests/test_unit/test_tracker_io.py Outdated Show resolved Hide resolved
@nikk-nikaznan nikk-nikaznan requested a review from sfmig July 11, 2024 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants