generic.Augmentation#
- class maite.protocols.generic.Augmentation(*args, **kwargs)[source]#
Generic version of a protocol that specifies a batch-level perturbation to data.
An augmentation is expected to take a batch of data and return a modified version of that batch. Implementers must provide a single method that takes and returns a labeled data batch, where a labeled data batch is represented by a tuple of types
Sequence[InputType],Sequence[TargetType], andSequence[DatumMetadataType]. Elements of this tuple correspond to the model input batch, model target batch, and datum-level metadata batch, respectively.Additionally,
Augmentationprotocol implementers are expected to contain a metadata attribute of typeAugmentationMetadatawith general information about the augmentation.Note: In practice, this class is specialized within AI-problem specific submodules using structural types for
TargetTypeandDatumMetadataType. Implementing this class directly (i.e., without specializing on concrete types) is not recommended. Static type checkers will effectively consider all non-specified type parameters asAny-type, effectively masking potential type incompatibilities.