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

Compute min_resolution in prepare_image_inputs #17915

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Jun 28, 2022

What does this PR do?

If feature_extract_tester.min_resolution is specified, the images have to be at least that large, otherwise we will get image width and/or height 0 and it gives error.

An error is here:

>       return self._new(self.im.resize(size, resample, box))
E       ValueError: height and width must be > 0

So far, we have the following in GLPNFeatureExtractionTester and other testers

        min_resolution=30,
        ...
        size_divisor=32,

issue spotted by @Rocketknight1 , thanks!

@ydshieh ydshieh requested review from NielsRogge and sgugger June 28, 2022 08:11
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 28, 2022

The documentation is not available anymore as the PR was closed or merged.

@ydshieh ydshieh force-pushed the fix_prepare_image_inputs branch from 231756a to c46d612 Compare June 28, 2022 08:45
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this edge case! LGTM!

Copy link
Contributor

@NielsRogge NielsRogge left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@ydshieh ydshieh merged commit 6aae59d into huggingface:main Jun 29, 2022
@ydshieh ydshieh deleted the fix_prepare_image_inputs branch June 29, 2022 08:30
younesbelkada pushed a commit to younesbelkada/transformers that referenced this pull request Jun 29, 2022
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
viclzhu pushed a commit to viclzhu/transformers that referenced this pull request Jul 18, 2022
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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.

4 participants