caikit.interfaces.vision.data_model =================================== .. py:module:: caikit.interfaces.vision.data_model Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/caikit/interfaces/vision/data_model/backends/index /autoapi/caikit/interfaces/vision/data_model/image/index /autoapi/caikit/interfaces/vision/data_model/package/index Attributes ---------- .. autoapisummary:: caikit.interfaces.vision.data_model.VISION_PACKAGE Classes ------- .. autoapisummary:: caikit.interfaces.vision.data_model.Image Package Contents ---------------- .. py:class:: Image(*args, **kwargs) Bases: :py:obj:`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. .. py:attribute:: image_data :type: py_to_proto.dataclass_to_proto.Annotated[bytes, FieldNumber(1)] .. py:attribute:: _backend .. py:method:: as_numpy() -> numpy.ndarray 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. .. py:method:: as_pil() -> PIL.Image.Image 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. .. py:method:: _check_initialization() 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. .. py:property:: rows :type: int Grab the number of rows in the image. Returns: int Number of rows in the underlying image. .. py:property:: columns :type: int Grab the number of columns in the image. Returns: int Number of columns in the underlying image. .. py:property:: channels :type: int Grab the number of channels in the image. Returns: int Number of channels in the underlying image. .. py:data:: VISION_PACKAGE :value: 'caikit_data_model.vision'