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

Resized videos are read as their original size #1413

Open
lindapaiste opened this issue Jun 12, 2022 · 0 comments
Open

Resized videos are read as their original size #1413

lindapaiste opened this issue Jun 12, 2022 · 0 comments
Labels

Comments

@lindapaiste
Copy link
Contributor

We convert an HTMLVideoElement to a tensor using TensorFlow's tf.browser.fromPixels. This function looks at the intrinsic size of the video using videoWidth and videoHeight rather than looking at the current size using width and height like it does for images (source). Users might not be aware of this and wonder why their "small" videos are so slow to process.

Some models require a fixed image size so this is not an issue as we resize all inputs to that size. I noticed it while working on StyleTransfer which can accept any size image.

We could add a check in toTensor that applies the width and height of the video using tf.image.resizeBilinear.

We could add an imageSize option to the "any size" models where the user can specify a size that they want their input media resized to. For example, they might want to evaluate a video at half of its original size. The StyleTransfer webcam example is noticeably faster when resizing the input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant