-
Notifications
You must be signed in to change notification settings - Fork 0
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
BaseImageProcessor #26
Conversation
The documentation is not available anymore as the PR was closed or merged. |
Co-authored-by: Sylvain Gugger <Sylvain.gugger@gmail.com> Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, excited to see this moving forward :)
data (`dict`): | ||
Dictionary of lists/arrays/tensors returned by the __call__/pad methods ('pixel_values', 'attention_mask', | ||
etc.). | ||
tensor_type (`Union[None, str, TensorType]`, *optional*): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick question - are we going to default to "np" ? If so, maybe we can remove None from the accepted argument types or make it a non-optional argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends partly on whether we merge in: huggingface#18499
Defaulting to "np"
isn't necessary to be able to use different combinations of e.g. do_resize
and do_normalize
. As we're aliasing the previous feature extractors with the new image processors, change the default would still be a breaking change.
If we decided to default to "np"
, then we'd have to include additional checks on the processed images. At the moment, because resize
resizes the images to multiples of size_divisor
, they are not guaranteed to all be the same size. This means calls the BatchFeature
will fail if any of "np"
, "tf"
, "pt"or
"jax"` are passed in as the images can't be batched together.
My preference would be to keep return_tensors=None
as this more closely matches the behaviour of our tokenizers. However, our tokenizer
provides arguments such that batches can be created e.g. padding=True
. Not sure if an equivalent makes sense here.
What do you think? If we want to set "np" as default we should discuss how to handle introducing the image processors versus introducing that change.
cc @NielsRogge
Co-authored-by: Alara Dirik <8944735+alaradirik@users.noreply.github.com>
Image processor glpn
What does this PR do?
Introduces the
BaseImageProcessor
class for all other model image processors to inherit from.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.