-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove UniformClipSampler assertion (#49)
Summary: ## Motivation and Context Adds the ability to set the stride < window size for UniformClipSampler. Why? - Feature extraction on imagenet based models for videos, e.g. every 5 frames with a single frame retrieved ## How Has This Been Tested - Added some unit tests - Run existing unit tests ## Other comments This was a bit difficult to implement due to the way clip samplers are designed. Personally I think this can be re-designed such that the implementation is much simpler. As an example, the implementation of UniformClipSampler could be ~20 lines of code compared to the current implementation: ``` def _num_clips(...) -> int: num_frames = round(duration_sec * fps) N = num_frames - window_size_frames if N < 0: return 1 result = int(N / stride_frames + 1) pad = backpad_last and N % stride_frames != 0 return result + pad start_end_times = [ ( (i * s_prime) / fps, ((i * s_prime + window_size) / fps) ) for i in range(num_clips(...)) ] if expected_start_end_times[-1][1] - video_length > 1e-6: expected_start_end_times[-1] = (video_length - window_size / fps, video_length) ``` X-link: fairinternal/pytorchvideo#49 Reviewed By: lyttonhao Differential Revision: D34811417 Pulled By: miguelmartin75 fbshipit-source-id: b9d93d5446d16008ede20e61a6314a89e6b1364e
1 parent
5e58541
commit 104257a
Showing
3 changed files
with
129 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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 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 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