Core Module

Composition Module

class src.bio_volumentations.core.composition.Compose(transforms, p=1.0, img_keywords=('image',), mask_keywords=('mask',), fmask_keywords=('float_mask',), keypoints_keywords=('keypoints',), bboxes_keywords=('bboxes',), value_keywords=('value',), conversion=None, bbox_format='voc')[source]

Bases: object

Compose a list of transformations into a callable transformation pipeline.

It is strongly recommended to use Compose to define and use the transformation pipeline.

In addition, perform basic input image checks and conversions. Optionally, perform also datatype conversion (e.g. from numpy.ndarray to torch.Tensor).

Warning: All keywords (target names) must be mutually distinct!!!

Parameters:
  • transforms (List[Transform]) – A list of transforms (objects of type Transform).

  • p (float, optional) –

    The probability of applying the whole pipeline.

    Defaults to 1.

  • img_keywords (Tuple[str], optional) –

    List of image target names.

    Defaults to ('image',).

  • mask_keywords (Tuple[str], optional) –

    List of mask target names.

    Defaults to ('mask',).

  • fmask_keywords (Tuple[str], optional) –

    List of float mask target names.

    Defaults to ('float_mask',).

  • keypoints_keywords (Tuple[str], optional) –

    List of key points target names.

    Defaults to ('keypoints',).

  • bboxes_keywords (Tuple[str], optional) –

    List of bounding boxes target names.

    Defaults to ('bboxes',).

  • value_keywords (Tuple[str], optional) –

    List of value target names.

    Defaults to ('value',).

  • conversion (Transform | None, optional) –

    Image datatype conversion transform, applied after the transformations.

    Defaults to None.

  • bbox_format (str) –

    Format the bounding boxes are supplied in. Supported formats: ‘voc’, ‘coco’, ‘yolo’, ‘albumentations’

    Defaults to ‘voc’.

get_always_apply_transforms()[source]

Transforms Interface Module

class src.bio_volumentations.core.transforms_interface.DualTransform(always_apply=False, p=0.5)[source]

Bases: Transform

The base class of transformations applied to all target types.

Targets:

image, mask, float mask, key points, bounding boxes

apply_to_bboxes(bboxes, **params)[source]
apply_to_float_mask(float_mask, **params)[source]
apply_to_keypoints(keypoints, **params)[source]
apply_to_mask(mask, **params)[source]
class src.bio_volumentations.core.transforms_interface.ImageOnlyTransform(always_apply=False, p=0.5)[source]

Bases: Transform

The base class of transformations applied to the image target only.

Targets:

image

property targets
class src.bio_volumentations.core.transforms_interface.Transform(always_apply=False, p=0.5)[source]

Bases: object

The base class for transformations.

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation.

    Defaults to False.

  • p (float, optional) –

    Probability of applying this transformation.

    Defaults to 0.5.

apply(volume, **params)[source]
get_params(targets, **data)[source]