caikit.interfaces.vision.data_model

Submodules

Attributes

VISION_PACKAGE

Classes

Image

Data model for an image object; this stores the image in the backend as a PIL image, with

Package Contents

class caikit.interfaces.vision.data_model.Image(*args, **kwargs)[source]

Bases: caikit.core.DataObjectBase

Data model for an image object; this stores the image in the backend as a PIL image, with convenience views to interact with the Image as other formats as needed.

image_data: py_to_proto.dataclass_to_proto.Annotated[bytes, FieldNumber(1)]
_backend
as_numpy() numpy.ndarray[source]

Convert the Image data model to a Numpy Array; here, we delegate to the backend. Produced images are of type uint8. Note that the produced object will have shape (Rows, Cols, Channels). Returns:

np.ndarray

Numpy array(uint8) representation of this data model object.

as_pil() PIL.Image.Image[source]

Convert the Image data model to a PIL image. Since we use PIL images as our hub format, this is simply returning a handle to the internally stored PIL image. Returns:

PIL.Image

PIL image representation of this data model object.

_check_initialization()[source]

Ensure that we have a _backend; throw an attribute error if we don’t. This will always be the case if we go through the initializer, but may occur if we call __new__() and use this class incorrectly.

property rows: int

Grab the number of rows in the image. Returns:

int

Number of rows in the underlying image.

property columns: int

Grab the number of columns in the image. Returns:

int

Number of columns in the underlying image.

property channels: int

Grab the number of channels in the image. Returns:

int

Number of channels in the underlying image.

caikit.interfaces.vision.data_model.VISION_PACKAGE = 'caikit_data_model.vision'