Skip to content

image

Image feature types.

Classes:

Name Description
ImageFeature

Feature representing an image input or output.

ImageFeature #

Feature representing an image input or output.

This feature models image data as a multidimensional numerical tensor with pixel intensities arranged in channel-last format. It is typically used to represent visual inputs such as photographs, rendered scenes, or segmentation masks.

The expected tensor shape is (batch_size, height, width, num_channels), where: - height and width are the spatial dimensions of the image, - num_channels corresponds to the color or modality channels (for example, 1 for grayscale, 3 for RGB, 4 for RGBA, or more for multispectral images).

Notes
  • Image data must use the channel-last layout (H x W x C).
  • The numerical type and normalization of pixel values depend on the associated preprocessing pipeline (for example, values in [0, 1] or [0, 255]).
  • Current limitation: Xpdeep assumes fixed image dimensions across all instances of the dataset; resizing or cropping should be handled during preprocessing.

Methods:

Name Description
to_model

Convert to an ImageFeatureType instance.

from_model

Image from model.

Attributes:

Name Type Description
name Literal['IMAGE']

name: Literal['IMAGE'] = 'IMAGE' #

to_model() -> ImageFeatureType #

Convert to an ImageFeatureType instance.

Returns:

Type Description
ImageFeatureType

Model-level representation of the image feature, including its static structural definition.

Source code in src/xpdeep/dataset/feature/feature_types/image.py
def to_model(self) -> ImageFeatureType:
    """Convert to an ``ImageFeatureType`` instance.

    Returns
    -------
    ImageFeatureType
        Model-level representation of the image feature, including its static
        structural definition.
    """
    return ImageFeatureType(name=self.name)

from_model(feature_type_input: ImageFeatureType) -> ImageFeature #

Image from model.

Source code in src/xpdeep/dataset/feature/feature_types/image.py
@staticmethod
def from_model(feature_type_input: ImageFeatureType) -> ImageFeature:  # noqa:ARG004
    """Image from model."""
    return ImageFeature()