ComposePerturber

class nrtk.impls.perturb_image.generic.compose_perturber.ComposePerturber(perturbers: list[PerturbImage] | None = None)

Composes multiple image perturbations by applying a list of perturbers sequentially to an input image.

Attributes:
perturbers (list[PerturbImage]):

List of perturbers to apply.

Note:

This class has not been tested with perturber factories and is not expected to work with perturber factories.

Methods

from_config

Create a ComposePerturber instance from a configuration dictionary.

get_config

Get the configuration dictionary of the ComposePerturber 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

Check whether this class is available for use.

perturb

Apply the sequence of perturbers to the input image.

__init__(perturbers: list[PerturbImage] | None = None) None

Initializes the ComposePerturber.

This has not been tested with perturber factories and is not expected to work with perturber factories.

Args:
perturbers:

List of perturbers to apply.

classmethod from_config(config_dict: dict[str, Any], merge_default: bool = True) Self

Create a ComposePerturber instance from a configuration dictionary.

Args:
config_dict:

Configuration dictionary with perturber details.

merge_default:

Whether to merge with the default configuration.

Returns:
return ComposePerturber:

An instance of ComposePerturber.

get_config() dict[str, Any]

Get the configuration dictionary of the ComposePerturber instance.

Returns:
return dict[str, Any]:

Configuration dictionary containing perturber configurations.

perturb(image: ndarray[Any, Any], boxes: Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None = None, **additional_params: Any) tuple[ndarray[Any, Any], Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None]

Apply the sequence of perturbers to the input image.

Args:
image:

The input image to perturb.

boxes:

The bounding boxes for the input image. This is the single image output from DetectImageObjects.detect_objects.

additional_params:

Additional perturbation keyword arguments.

Returns:
return tuple[np.ndarray, Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None]:

The perturbed image and the source bounding boxes.