ImageProcessor - check if input pixel values between 0-255#25688
ImageProcessor - check if input pixel values between 0-255#25688amyeroberts merged 5 commits intohuggingface:mainfrom
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
ArthurZucker
left a comment
There was a problem hiding this comment.
Thanks, left a few nits on the doc!
There was a problem hiding this comment.
I guess we can also update the doc here
| """Preprocesses a single image.""" | ||
| # All transformations expect numpy arrays. | ||
| image = to_numpy_array(image) | ||
| if _is_scaled_image(image) and do_rescale: |
There was a problem hiding this comment.
Do you think it makes sense to also set do_rescale = False ?
There was a problem hiding this comment.
I don't want to do anything "magic" and surprise the user.
Checking whether the pixels are correct isn't a perfect test, and it'd be modifying the processor behaviour under an assumption.
There was a problem hiding this comment.
Do was updated but forward does not have do_rescale and check not used
There was a problem hiding this comment.
doc needs to be udpated to?
There was a problem hiding this comment.
docstring can be updated to
There was a problem hiding this comment.
Only doc was updated, but no do_rescale exists
src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py
Outdated
Show resolved
Hide resolved
|
@rafaelpadilla @ArthurZucker Thanks bot for your detailed reviews! I've added the suggested updated: making the function name consistent with others |
…ce#25688) * Check if pixel values between 0-255 and add doc clarification * Add missing docstrings * _is_scale_image -> is_scaled_image * Spelling is hard * Tidy up
What does this PR do?
Adds a warning in the image processor if the user is passing in images that have already had their pixel values rescale between 0 and 1 and
do_rescale=True. Additionally adds information in the docstring.This has caused some confusion and error reports recently, when users have been passing in images that have already been partially transformed.
Related issues: #25195, #24857, #23096
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.