imgaug_transformο
- lightning_pose.data.augmentations.imgaug_transform(params_dict: dict | DictConfig) Sequential[source]ο
Create simple and flexible data transform pipeline that augments images and keypoints.
- Parameters:
params_dict β each key must be the name of a transform importable from imgaug.augmenters, e.g. βAffineβ, βFliplrβ, etc. The value must be a dict with several optional keys: - βpβ (float): probability of applying transform (using imgaug.augmenters.Sometimes) - βargsβ (list): arguments for transform - βkwargsβ (dict): keyword args for the transformation
Examples
Create a pipeline with - Affine transformation applied 50% of the time with rotation uniformly sampled from
(-25, 25) degrees
MotionBlur transformation that is applied 25% of the time with a kernel size of 5 pixels and blur direction uniformly sampled from (-90, 90) degrees
>>> params_dict = { >>> 'Affine': {'p': 0.5, 'kwargs': {'rotate': (-25, 25)}}, >>> 'MotionBlur': {'p': 0.25, 'kwargs': {'k': 5, 'angle': (-90, 90)}}, >>> }
In a config file, this will look like: >>> training: >>> imgaug: >>> Affine: >>> p: 0.5 >>> kwargs: >>> rotate: [-10, 10] >>> MotionBlur: >>> p: 0.25 >>> kwargs: >>> k: 5 >>> angle: [-90, 90]
Create a pipeline with - Rot90 transformation applied 100% of the time with rotations of 0, 90, 180, 270 degrees.
>>> params_dict = { >>> 'Rot90': {'p': 1.0, 'kwargs': {'k': [[0, 1, 2, 3]]}}, # note required nested list >>> }
In a config file, this will look like: >>> training: >>> imgaug: >>> Rot90: >>> p: 1.0 >>> kwargs: >>> k: [0, 1, 2, 3]
NOTE: if you pass a list of exactly 2 values to Rot90 it will be parsed as a tuple and all (discrete) rotations between the two values will be sampled uniformly. For example, k: [0, 2] is equivalent to k: [0, 1, 2]. If you need to _only_ sample two non-contiguous integers please raise an issue.
- Returns:
imgaug pipeline