PerturberOneStepFactory#

class nrtk.impls.perturb_image_factory.PerturberOneStepFactory(*, perturber: type[PerturbImage], theta_key: str, theta_value: float, to_int: bool = False, perturber_kwargs: dict[str, Any] | None = None)#

Simple PerturbImageFactory implementation to return a factory with one perturber.

Attributes:
perturber (type[PerturbImage]):

perturber type to produce

theta_key (str):

peturber parameter to modify

theta_value (float):

value to set theta_key to

to_int (bool):

determines wheter to cast theta_value to a int or float

Methods

from_config

Instantiates a PerturbImageFactory from a configuration dictionary.

get_config

Returns a configuration dictionary for the PerturberOneStepFactory instance.

get_default_config

Returns the default configuration for the PerturbImageFactory.

get_impls

Discover plugins, skipping any entrypoints that fail to load.

is_usable

Check whether this class is available for use.

__init__(*, perturber: type[PerturbImage], theta_key: str, theta_value: float, to_int: bool = False, perturber_kwargs: dict[str, Any] | None = None) None#

Initialize the factory to produce an instance of PerturbImage for the given type.

Initialize the factory to produce an instance of PerturbImage for the given type, given the theta_key and the theta_value parameters.

Args:
perturber:

Python implementation type of the PerturbImage interface to produce.

theta_key:

Perturber parameter to vary between instances.

theta_value:

Initial and only value of theta_key.

to_int:

Boolean variable determining whether the theta is cast as int or float. Defaults to False.

perturber_kwargs:

Default kwargs to be used by the perturber. Defaults to {}.

Raises:
TypeError:

Given a perturber instance instead of type.

get_config() dict[str, Any]#

Returns a configuration dictionary for the PerturberOneStepFactory instance.