ksuit.data.preprocessors.compose

Classes

ComposePreProcess

Compose multiple transforms and support inversion by reversing the sequence and inverting each transform.

Module Contents

class ksuit.data.preprocessors.compose.ComposePreProcess(normalization_key, preprocessors)

Compose multiple transforms and support inversion by reversing the sequence and inverting each transform. .. rubric:: Example

>>> normalizer = ComposePreProcess(
>>>     normalization_key="image",
>>>     preprocessors=[
>>>         MyPreProcessor1(),
>>>         MyPreProcessor2(),
>>>     ]
>>> )
>>> processed_data = normalizer(input_data)
>>> original_data = normalizer.inverse(processed_data)
Parameters:
Raises:
  • TypeError – If preprocessors is not a list or if any item in the list is not an instance of PreProcessor.

  • ValueError – If the preprocessors list is empty.

normalization_key
transforms
inverse(x)

Return a transform that applies the inverse transformations in reverse order. :param x: The input to be denormalized.

Parameters:

x (Any)

Return type:

Any