Skip to content

Conversation

zhong-al
Copy link
Collaborator

@zhong-al zhong-al commented Dec 6, 2024

Resolves #74

  • cvat2slowfast output
  • cvat2ultralytics output
  • detector2cvat output + mocked output
  • miniscene2behavior mocked output (output testing in Load model from huggingface #76)
  • player output
  • tracks_extractor output

@zhong-al zhong-al linked an issue Dec 6, 2024 that may be closed by this pull request
@zhong-al zhong-al mentioned this pull request Dec 11, 2024
@zhong-al zhong-al requested a review from egrace479 December 11, 2024 01:11
@egrace479 egrace479 requested a review from NetZissou March 6, 2025 20:21
video_id = 1
folder_name = 1
flag = False
flag = not no_images

Choose a reason for hiding this comment

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

Optional suggestion:

flag was previously set to False. It now represents the negation of the no_images argument:

  • When no_images is True, flag is False.
  • When no_images is False, flag is True.

For clarity purpose, consider directly using the new argument no_images instead of introducing the flag variable, as flag is vague and less descriptive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we put this in a new PR? I agree with this suggestion, but the diff in this one is already huge.

Choose a reason for hiding this comment

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

Sure thing!

tests/utils.py Outdated
annotation = get_cached_datafile(DETECTION_ANNOTATION)
return video, annotation

def clean_dir(path):

Choose a reason for hiding this comment

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

Assuming the goal for clean_dir is to remove a directory regardless of its contents, you should use shutil.rmtree
(I made this mistake previously...)

import shutil
import os

def clean_dir(path):
    if os.path.exists(path):
        shutil.rmtree(path)

os.removedirs is designed to remove a directory and all of its parent directories only if they are empty. If the directory path contains files or subdirectories, this function will fail with an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need some time to re-read how this is used. I might have had some reason for picking os.removedirs over shutil.rmtree.

Choose a reason for hiding this comment

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

Sounds good. Again sorry for the late response on this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, it's for a weird case in which I want to remove the empty parent directories. The slowfast model always creates an empty, nested output directory even though it doesn't output anything with the kabr inference config. I just added this function to avoid having random empty directories locally when testing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No worries; thanks for the review! Do you have an improved name suggestion for this function? Maybe clean_empty_dirs? I can update & rebase on main after work today.

Choose a reason for hiding this comment

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

Yeah clean_empty_dirs looks good.

Check whether a directory is empty if possible, something like:

len(os.listdir(path)) == 0

And please summarize your last comment into docstrings or comment alongside the function. Thanks!

Copy link
Collaborator Author

@zhong-al zhong-al May 8, 2025

Choose a reason for hiding this comment

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

Rebasing the 111 commits is going to take more time than what I have tonight. I'll try to get it by next Monday!

Edit: I'll also apply both requested changes to cut down on the number of PRs & reviews :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ended up running git reset --soft HEAD~111 && git commit -m "Add further testing" and git rebase origin/master. Unsure if that + manually verifying conflicts was the best approach. Waiting to see if tests pass 🎉

@zhong-al zhong-al force-pushed the enhancement/testing2 branch from f56b4cd to af6eeb8 Compare May 12, 2025 06:42
@zhong-al zhong-al requested a review from NetZissou May 13, 2025 04:47
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.

Add additional tests

2 participants