art.preprocessing.expectation_over_transformation

Module providing expectation over transformations.

EOT Image Center Crop - PyTorch

class art.preprocessing.expectation_over_transformation.EoTImageCenterCropPyTorch(nb_samples: int, clip_values: Tuple[float, float], size: int = 5, label_type: str = 'classification', apply_fit: bool = False, apply_predict: bool = True)

This module implements Expectation over Transformation preprocessing for image center crop in PyTorch.

__init__(nb_samples: int, clip_values: Tuple[float, float], size: int = 5, label_type: str = 'classification', apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTImageCenterCropPyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of the form (min, max) representing the minimum and maximum values allowed for features.

  • size (int) – Maximal size of the crop on all sides of the image in pixels.

  • label_type (str) – String defining the type of labels. Currently supported: classification, object_detection

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Image Rotation - TensorFlow V2

class art.preprocessing.expectation_over_transformation.EoTImageRotationTensorFlow(nb_samples: int, clip_values: Tuple[float, float], angles: float | Tuple[float, float] = 45.0, label_type: str = 'classification', apply_fit: bool = False, apply_predict: bool = True)

This module implements Expectation over Transformation preprocessing for image rotation in TensorFlow.

__init__(nb_samples: int, clip_values: Tuple[float, float], angles: float | Tuple[float, float] = 45.0, label_type: str = 'classification', apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTImageRotationTensorFlow.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of the form (min, max) representing the minimum and maximum values allowed for features.

  • angles – A positive scalar angle in degrees defining the uniform sampling range from negative to positive angles_range.

  • label_type (str) – String defining the type of labels. Currently supported: classification

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Image Rotation - PyTorch

class art.preprocessing.expectation_over_transformation.EoTImageRotationPyTorch(nb_samples: int, clip_values: Tuple[float, float], angles: float | Tuple[float, float] | List[float] = 45.0, label_type: str = 'classification', apply_fit: bool = False, apply_predict: bool = True)

This module implements Expectation over Transformation preprocessing for image rotation in PyTorch.

__init__(nb_samples: int, clip_values: Tuple[float, float], angles: float | Tuple[float, float] | List[float] = 45.0, label_type: str = 'classification', apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTImageRotationPyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of the form (min, max) representing the minimum and maximum values allowed for features.

  • angles – In degrees and counter-clockwise. If a positive scalar it defines the uniform sampling range from negative to positive value. If a tuple of two scalar angles it defines the uniform sampling range from minimum to maximum angles. If a list of scalar values it defines the discrete angles that will be sampled. For label_type=”object_detection” only a list of multiples of 90 degrees is supported.

  • label_type (str) – String defining the type of labels. Currently supported: classification, object_detection

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Brightness - PyTorch

class art.preprocessing.expectation_over_transformation.EoTBrightnessPyTorch(nb_samples: int, clip_values: Tuple[float, float], delta: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of changes in brightness by addition of uniformly sampled delta.

__init__(nb_samples: int, clip_values: Tuple[float, float], delta: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTBrightnessPyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • delta – Range to sample the delta (addition) to the pixel values to adjust the brightness. A single float is translated to range [-delta, delta] or a tuple of floats is used to create sampling range [delta[0], delta[1]]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Brightness - TensorFlow V2

class art.preprocessing.expectation_over_transformation.EoTBrightnessTensorFlow(nb_samples: int, clip_values: Tuple[float, float], delta: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of changes in brightness by addition of uniformly sampled delta.

__init__(nb_samples: int, clip_values: Tuple[float, float], delta: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTBrightnessTensorFlow.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • delta – Range to sample the delta (addition) to the pixel values to adjust the brightness. A single float is translated to range [-delta, delta] or a tuple of floats is used to create sampling range [delta[0], delta[1]]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Contrast - PyTorch

class art.preprocessing.expectation_over_transformation.EoTContrastPyTorch(nb_samples: int, clip_values: Tuple[float, float], contrast_factor: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of changes in contrast with uniformly sampled factor.

__init__(nb_samples: int, clip_values: Tuple[float, float], contrast_factor: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTContrastPyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • contrast_factor – Range to sample the contrast factor adjust the contrast. A single float is translated to range [-delta, delta] or a tuple of floats is used to create sampling range [delta[0], delta[1]]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Contrast - TensorFlow V2

class art.preprocessing.expectation_over_transformation.EoTContrastTensorFlow(nb_samples: int, clip_values: Tuple[float, float], contrast_factor: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of changes in contrast with uniformly sampled factor.

__init__(nb_samples: int, clip_values: Tuple[float, float], contrast_factor: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTContrastTensorFlow.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • contrast_factor – Range to sample the contrast factor adjust the contrast. A single float is translated to range [-delta, delta] or a tuple of floats is used to create sampling range [delta[0], delta[1]]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Gaussian Noise - PyTorch

class art.preprocessing.expectation_over_transformation.EoTGaussianNoisePyTorch(nb_samples: int, clip_values: Tuple[float, float], std: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of adding Gaussian noise with uniformly sampled standard deviation.

__init__(nb_samples: int, clip_values: Tuple[float, float], std: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTBrightnessPyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • std – Range to sample the standard deviation for the Gaussian distribution. A single float is translated to range [0, std]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Gaussian Noise - TensorFlow V2

class art.preprocessing.expectation_over_transformation.EoTGaussianNoiseTensorFlow(nb_samples: int, clip_values: Tuple[float, float], std: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of adding Gaussian noise with uniformly sampled standard deviation.

__init__(nb_samples: int, clip_values: Tuple[float, float], std: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTGaussianNoiseTensorFlow.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • std – Range to sample the standard deviation for the Gaussian distribution. A single float is translated to range [0, std]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Shot Noise - PyTorch

class art.preprocessing.expectation_over_transformation.EoTShotNoisePyTorch(nb_samples: int, clip_values: Tuple[float, float], lam: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of adding shot noise (Poisson) with uniformly sampled rate parameter.

__init__(nb_samples: int, clip_values: Tuple[float, float], lam: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTShotNoisePyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • lam – Range to sample the rate of the Poisson distribution. A single float is translated to range [0.0, lam] or a tuple of floats is used to create sampling range [lam[0], lam[1]]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Shot Noise - TensorFlow V2

class art.preprocessing.expectation_over_transformation.EoTShotNoiseTensorFlow(nb_samples: int, clip_values: Tuple[float, float], lam: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of adding shot noise (Poisson) with uniformly sampled rate parameter.

__init__(nb_samples: int, clip_values: Tuple[float, float], lam: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTShotNoiseTensorFlow.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • lam – Range to sample the rate of the Poisson distribution. A single float is translated to range [0.0, lam] or a tuple of floats is used to create sampling range [lam[0], lam[1]]. The applied delta is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Zoom Blur - PyTorch

class art.preprocessing.expectation_over_transformation.EoTZoomBlurPyTorch(nb_samples: int, clip_values: Tuple[float, float], zoom: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of zoom blur with uniformly sampled zoom factor.

__init__(nb_samples: int, clip_values: Tuple[float, float], zoom: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTZoomBlurPyTorch.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • zoom – Range to sample the zoom factor. A single float is translated to range [1.0, zoom] or a tuple of floats is used to create sampling range [zoom[0], zoom[1]]. The applied zoom is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.

EOT Zoom Blur - TensorFlow V2

class art.preprocessing.expectation_over_transformation.EoTZoomBlurTensorFlow(nb_samples: int, clip_values: Tuple[float, float], zoom: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True)

This module implements EoT of zoom blur with uniformly sampled zoom factor.

__init__(nb_samples: int, clip_values: Tuple[float, float], zoom: float | Tuple[float, float], apply_fit: bool = False, apply_predict: bool = True) None

Create an instance of EoTZoomBlurTensorFlow.

Parameters:
  • nb_samples (int) – Number of random samples per input sample.

  • clip_values – Tuple of float representing minimum and maximum values of input (min, max).

  • zoom – Range to sample the zoom factor. A single float is translated to range [1.0, zoom] or a tuple of floats is used to create sampling range [zoom[0], zoom[1]]. The applied zoom is sampled uniformly from this range for each image.

  • apply_fit (bool) – True if applied during fitting/training.

  • apply_predict (bool) – True if applied during predicting.