-
Notifications
You must be signed in to change notification settings - Fork 221
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
feat(python): design an image extension type #1272
Conversation
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.
- is it possible to have a super type interface? e.g., for higher level applications, they may only care about showing an image, or getting a numpy array, and not necessarily care whether the underlying image is represented as string uri, tensor, or bytes.
- can we add some methods to convert from one extension type to another?
(Totally fine if the answer is we'll address it later, let's focus on delivering the immediate use case ofc).
Having the ability to decode 16 bits images would be great (for example depth map saved in a png file) |
220b2eb
to
353e4ef
Compare
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.
Could we get docstrings for each of these methods? Preferably with doctest-verified examples.
@wjones127 I assume we want to stay in arrow as much as possible, but encoder/encoder and TF bridge use numpy here. |
I think there are two concerns:
If this is all internal, I think it's fine to accept this cost for now. We might just have to wait for the ecosystem to get more Arrow native before we can drop numpy as dependency for this. |
709698c
to
99d73d1
Compare
Indeed. Let's keep an eye out for more arrow native ways to move images to tensors while we wait.
Added. |
I think we should add this now. I'd only propose we do it as a separate PR to manage scope here.
We now have |
|
5ef6130
to
5cf5a23
Compare
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.
I think most important change is that we add a roundtrip test to Lance.
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.
Very cool, only a few thoughts
|
||
def image_to_tensor(self, decoder=None): | ||
""" | ||
Decode encoded images and return a FixedShapeImageTensorArray |
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.
Hmm...if I'm a user I might wonder what the shape of the resulting array would be. It looks like, for both tensorflow and pillow, you get a 3d array [height, width, channel]
. Do you think we should document and/or mandate this?
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.
The annoying part here is that PNG comes with an extra transparency channel etc. Since we're offering a custom decoder option it'd be awkward to enforce output shapes here.
I'm not sure what a good user experience here. Maybe we could get some user feedback?
In related news |
Co-authored-by: Will Jones <[email protected]>
Co-authored-by: Will Jones <[email protected]>
@wjones127 can we merge this? |
See #1199.