RandomScalePerturber

class nrtk.impls.perturb_image.generic.random_scale_perturber.RandomScalePerturber(limit: float | tuple[float, float] = 0.0, interpolation: int = 1, probability: float = 1.0, seed: int | None = None)

RandomScalePerturber applies a Scale transformation from Albumentations.

Attributes:
limit (float | tuple[float, float]):

Range of scaling factors. A single float value is equivalent to a tuple of (-value, value). One will then be added to each value. Therefore, a given value of (-0.2, 0.1) corresponds to scaling the image between 0.8x and 1.1x, and a given value of 0.5 corresponds to scaling the image between 0.5x and 1.5x.

interpolation (int)

OpenCV flag indicating the interpolation algorithm.

probability (float):

Probability of applying the scale transformation.

seed (int):

An optional seed for reproducible results.

Methods:
perturb:

Applies the specified perturbation to an input image.

__call__:

Calls the perturb method with the given input image.

get_config:

Returns the current configuration of the RandomRotationPerturber instance.

Methods

from_config

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

get_config

Returns the current configuration of the RandomRotationPerturber instance.

get_default_config

Generate and return a default configuration dictionary for this class.

get_impls

Discover and return a set of classes that implement the calling class.

get_type_string

Returns the fully qualified type string of the PerturbImage class or its subclass.

is_usable

Checks if the required albumentations module is available.

perturb

Apply a BasicTransform from Albumentations to an image.

__init__(limit: float | tuple[float, float] = 0.0, interpolation: int = 1, probability: float = 1.0, seed: int | None = None) None

RandomScalePerturber applies a random scale perturbation to an input image.

It ensures that bounding boxes are adjusted correctly to reflect the translated image coordinates.

Args:
limit:

Range of scaling factors. A single float value is equivalent to a tuple of (-value, value). One will then be added to each value. Therefore, a given value of (-0.2, 0.1) corresponds to scaling the image between 0.8x and 1.1x, and a given value of 0.5 corresponds to scaling the image between 0.5x and 1.5x.

interpolation:

OpenCV flag indicating the interpolation algorithm.

probability:

Probability of applying the scale transformation.

seed:

An optional seed for reproducible results.

get_config() dict[str, Any]

Returns the current configuration of the RandomRotationPerturber instance.

Returns:
return dict[str, Any]:

Configuration dictionary with current settings.