-
Notifications
You must be signed in to change notification settings - Fork 2
Uniform clip sampling + multi-clip sampling function #57
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
Open
themattinthehatt
wants to merge
13
commits into
main
Choose a base branch
from
clipsampling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4131d87
extract_clips and uniform sampling
themattinthehatt 6284c23
extract tests
themattinthehatt 43a0039
multi-clip extraction with CLI
themattinthehatt 299145a
cli tests
themattinthehatt a33a6b5
update docs
themattinthehatt 93aa58c
explicit kwargs in extract_clips
themattinthehatt d05174b
refactor clip extraction logic
themattinthehatt f034db7
increase test coverage
themattinthehatt 4c34cb8
extract_clip->extract_single_clip
themattinthehatt de93ba2
update api
themattinthehatt 06a92b9
fix tests
themattinthehatt 97601bf
pin movement for tests
themattinthehatt 5b91a15
Merge branch 'main' into clipsampling
themattinthehatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The current approach in
extract_clipsbundles together input preparation (i.e. computing start_frames based on the sampling strategy) and the action (i.e. the extraction of the frames). The same applies for the suggestions I gave. This makes a more convenient function call, but the coupling of these two objectives has some downsides.We can decouple it (initially this is what I had in mind). The
extract_clipsfunction can takestart_framesas input, and then we have several functions that generate these start frames (e.g., the current_uniform_start_frames). For convenience, we can have wrappers that we can wire to the CLI. These wrappers combineextract_clipswith a start-frame-production function:This decoupled approach has a few benefits:
extract_clipsstays the same)uniform) into a function (_uniform_start_frames) now occurs at the CLImain(it is removed entirely from here). We would need to keep the None-guards inmainas mentioned above tho.I think it would also help with the validation of inputs:
start_framesvalues aren't validated as a list of positive integers anywhere (each frame is only checked individually inside the loop that callsextract_clip, which is late to catch the error). This is easy to miss with the current approach I think, because validation is a bit spread across different places. The start frame validation would belong nicely within the decoupledextract_clips, and that way we can report all bad frames at once instead of dying on the first.extract_clipandextract_clips. But in the multi-clip approach, we would validate the inputs up-front.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.
P.S.: Claude says "argparse can enforce the conditional requirement via subcommands". It would look something like this:
I have never done this, and I think I prefer the argparse to have no "important" logic, but just in case you want to look into it.
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.
another great suggestion @sfmig! I also agree that I don't want argparse performing this logic, it's simple in the manual case but we'll likely have more/more complex logic checks for other sampling strategies, so this should be handled in
extract_clips_*.