forte icon indicating copy to clipboard operation
forte copied to clipboard

`ImagePayload.cache` should support more generic data type

Open hepengfe opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Currently ImagePayload.cache is expected to be numpy.Ndarray but sometimes we read image into a library-specific objects that can be handy for the library-specific post-processing.

Describe the solution you'd like We should support more generic data types rather than numpy array only.

For example, some image data objects from PIL library.

Also, note that this library supports lazy loading internally while initializing an image object by PIL.Image.open(image_path)

Describe alternatives you've considered No.

Additional context No.

hepengfe avatar Jul 08 '22 00:07 hepengfe

Instead of supporting data types one by one, we should probably allow arbitrary "cache" objects, as long as we have the correct methods associated with it. Basically, that means it should support the operations of ImageAnnotation.

Btw, what do you mean by PIL, is PIR?

hunterhector avatar Jul 08 '22 02:07 hunterhector

PIL is a third-party python image library.

hepengfe avatar Jul 08 '22 15:07 hepengfe

PIL is a third-party python image library.

I see, thanks

hunterhector avatar Jul 08 '22 15:07 hunterhector