ComposePerturber#
- class nrtk.impls.perturb_image.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
Create a ComposePerturber instance from a configuration dictionary.
Returns the configuration dictionary of the ComposePerturber instance.
get_default_configGenerate and return a default configuration dictionary for this class.
get_implsDiscover plugins, skipping any entrypoints that fail to load.
get_type_stringReturns the fully qualified type string of the PerturbImage class or its subclass.
is_usableCheck whether this class is available for use.
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:
An instance of ComposePerturber.
- get_config() dict[str, Any]#
Returns the configuration dictionary of the ComposePerturber instance.
- perturb(*, image: ndarray[Any, Any], boxes: Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None = None, **kwargs: 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.
- kwargs:
Additional perturbation keyword arguments.
- Returns:
The perturbed image and the source bounding boxes.