RandomRotationPerturber

class nrtk.impls.perturb_image.generic.random_rotation_perturber.RandomRotationPerturber(limit: float | tuple[float, float] = 0.0, probability: float = 1.0, fill: Sequence[int] | None = None, seed: int | None = None)

RandomRotationPerturber applies a Rotation transformation from Albumentations.

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

Maximum rotation angle in degrees.

probability (float):

Probability of applying the rotation transformation.

seed (int):

An optional seed for reproducible results.

fill (numpy.array):

Background color fill for RGB image.

Methods:
perturb:

Applies the specified 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, probability: float = 1.0, fill: Sequence[int] | None = None, seed: int | None = None) None

RandomRotationPerturber applies a Rotation transformation from Albumentations.

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

Maximum rotation angle in degrees. For example, 90.0 value means the image can be rotated by any angle between [-90, 90] degrees and (0.0, 90.0) means the image can be rotated by any angle between [0, 90] degrees. Default value is 0.0, which means no rotation.

probability (float):

Probability of applying the rotation transformation. A value of 1.0 means it will always apply the rotation, while a value of 0.0 means it will never apply the rotation. Default value is 1.0.

fill (numpy.array | None):

Background color fill for RGB image. (0 to 255 for each channel). Default value is a black background ([0, 0, 0]).

seed (int | None):

An optional seed for reproducible results. Defaults to None, which means the results are non-deterministic.

Raises:
raises ValueError:

Rotation probability must be between 0.0 and 1.0 inclusive.

raises ValueError:

Color fill values must be integers between 0 and 255 inclusive.

get_config() dict[str, Any]

Returns the current configuration of the RandomRotationPerturber instance.

Returns:
return dict[str, Any]:

Configuration dictionary with current settings.