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

Feature/recursive videos to poses #126

Conversation

cleong110
Copy link
Contributor

@cleong110 cleong110 commented Nov 18, 2024

Implemented a recursive option, solves #125 . Also added in an optional argument to specify the video extension to search for, though currently the only choice is .mp4. All behavior should be the same as before, as in if you don't use the -r argument it will just look in the current directory.

@cleong110 cleong110 marked this pull request as ready for review November 18, 2024 17:10
@cleong110
Copy link
Contributor Author

Did a quick edit to the file to _SUPPORTED_VIDEO_FORMATS to see how easy it would be to switch extensions, and it successfully found and ran on .webm files as expected. But .webm support is a separate issue. #127

docs/specs/v0.1.md Outdated Show resolved Hide resolved
docs/specs/v0.1.md Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
@cleong110
Copy link
Contributor Author

Updated code to check against list of pose files as requested, and to iterate over all video suffixes. Realized this could result in foo.mp4, foo.webm both being posed to foo.pose, so added an option to keep original video suffix, and added a "this will cause name collisions do you want to keep going" check

@cleong110
Copy link
Contributor Author

Also added a try/except checking for ValueError, so that if one of the video files is corrupted, the utility will keep going.

Also added a check for existing .pose files, in which case it will not re-run/overwrite.

Copy link
Collaborator

@AmitMY AmitMY left a comment

Choose a reason for hiding this comment

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

much better. still minor changes

docs/specs/v0.1.md Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
src/python/pose_format/bin/directory.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@AmitMY AmitMY left a comment

Choose a reason for hiding this comment

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

LGTM - just revert one change and i'll merge.
Thanks!

docs/specs/v0.1.md Outdated Show resolved Hide resolved
@AmitMY AmitMY merged commit 8aac9a7 into sign-language-processing:master Nov 22, 2024
4 checks passed
@cleong110 cleong110 deleted the feature/recursive_videos_to_poses branch November 25, 2024 15:50
@J22Melody
Copy link
Contributor

It is great!

I will add a multiprocessing option to the script to use multiple CPUs. Currently, I need to run pose estimation on 1000+ hours of BSL data, and do not want to wait for too long ;)

@cleong110
Copy link
Contributor Author

@J22Melody I actually did that with GNU parallel lol

@J22Melody
Copy link
Contributor

@cleong110 please share the repo with me!

@cleong110
Copy link
Contributor Author

Oh silly me! The two files in question:
run_videos_to_poses_on_multiple_dirs.zip

@cleong110
Copy link
Contributor Author

Not that we shouldn't add the multiprocessing! I think that's a good thing to do. This was just my workaround:

  1. Split folder of many videos, into many folders of, like, 100 videos.
  2. find "path/to/directory_of_directories" -mindepth 1 -maxdepth 1 -type d|parallel -j "$job_count" --progress --results "$results_prefix" videos_to_poses --format mediapipe --directory "{}"
    So then if job_count is set to 100, you can spin up 100 instances of videos_to_poses in parallel

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