Generic Dataclasses#

The generic dataclasses module provides the foundational data structures and validation logic used throughout Anomalib. These classes are designed to be flexible and type-safe, serving as the base for both PyTorch and NumPy implementations.

Core Concepts#

Type Variables#

The module uses several type variables to ensure type safety across different implementations:

  • ImageT: Type variable for image data (PyTorch Image/Video or NumPy array)

  • T: Type variable for tensor-like data (PyTorch Tensor or NumPy array)

  • MaskT: Type variable for mask data (PyTorch Mask or NumPy array)

  • PathT: Type variable for path data (string or list of strings)

Base Classes#

InputFields#

ImageInputFields#

VideoInputFields#

DepthInputFields#

OutputFields#

Mixins#

UpdateMixin#

BatchIterateMixin#

Generic Classes#

GenericItem#

GenericBatch#

Field Validation#

FieldDescriptor#

See Also#