Fix: Add dynamic resolution scaling to crop_video.py to support various video resolutions#3
Open
Fix: Add dynamic resolution scaling to crop_video.py to support various video resolutions#3
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR addresses an issue in
utils/crop_video.pywhere the facial cropping region becomes incorrect if the downloaded video's resolution does not exactly match the base resolution (e.g., 1280x720) specified in the ASD info file.Why is this necessary?
The original implementation assumes that the input video has the exact same dimensions as the
# ImageSizedefined in the annotation texts. However, videos downloaded from YouTube (viayt-dlpor similar tools) often come in 1080p or other arbitrary resolutions. When a 1080p video is processed using 720p coordinates without scaling, it results in cropping the wrong background region instead of the speaker's mouth.Changes Made
# ImageSizefrom the ASD info file.sw,sh) and multiplied them by the original X, Y, W, H coordinates to correctly adjust the bounding box regardless of the video's original resolution.How to Test
crop_video.py..mp4files in theutts/directory successfully contain the cropped lip/face regions.