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 flag to omit timestamp in output directory #253

Merged
merged 10 commits into from
Nov 20, 2024

Conversation

sfmig
Copy link
Collaborator

@sfmig sfmig commented Nov 15, 2024

Description

What is this PR?

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
At the moment each run of the command detect-and-track will generate a timestamped directory for the outputs (csv with detections and optionally frames and tracked video).

If we use a bash script to run this command over a set of videos (as we do in the cluster, see #251), we create one timestamped output directory per video, which is inconvenient and confusing.

An easy way to put all outputs from a set of videos under the same directory is to optionally remove the timestamp suffix that is applied by default to each output directory.

What does this PR do?

  • It adds a flag to the CLI that removes the timestamped suffix from the output directory name.
  • It adds tests for the prep_outputs method of the tracker class
  • It adapts the existing tests for the constructor of the tracker class to use pytest's monkeypatching (rather than unitttest mock).
    • this is to stay consistent with the rest of the tests in the codebase.

References

Another option could be for the user to be responsible of specifying the full path to the output directory. This is covered in #246. I opted for this option for now, to keep in line with the model evaluation script and the save_frames and frames_output_dir flags, but this can be reviewed in the future.

How has this PR been tested?

Tests pass locally and in CI.

Does this PR require an update to the documentation?

A comment about the new flag has been added to the README.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 47.98%. Comparing base (c3e653d) to head (82df997).

Files with missing lines Patch % Lines
crabs/tracker/track_video.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #253      +/-   ##
==========================================
+ Coverage   47.76%   47.98%   +0.22%     
==========================================
  Files          24       24              
  Lines        1564     1567       +3     
==========================================
+ Hits          747      752       +5     
+ Misses        817      815       -2     

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


🚨 Try these New Features:

@sfmig sfmig force-pushed the smg/optional-timestamp-to-output-dir branch from aaea0aa to 4c69de8 Compare November 19, 2024 14:23
@sfmig sfmig marked this pull request as ready for review November 19, 2024 14:24
@sfmig sfmig merged commit 1cdb184 into main Nov 20, 2024
7 checks passed
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.

2 participants