Core API (albumentations.core)

Composition

class albumentations.core.composition.Compose(transforms, preprocessing_transforms=[], postprocessing_transforms=[], bbox_params={}, p=1.0)[source]

Compose transforms and handle all transformations regrading bounding boxes

Parameters:
  • transforms (list) – list of transformations to compose.
  • preprocessing_transforms (list) – list of transforms to run before transforms
  • postprocessing_transforms (list) – list of transforms to run after transforms
  • p (float) – probability of applying all list of transforms. Default: 1.0.
  • bbox_params (dict) – Parameters for bounding boxes transforms
bbox_params dictionary contains the following keys:
  • format (str): format of bounding boxes. Should be ‘coco’ or ‘pascal_voc’. If None - don’t use bboxes. The coco format of a bounding box looks like [x_min, y_min, width, height], e.g. [97, 12, 150, 200]. The pascal_voc format of a bounding box looks like [x_min, y_min, x_max, y_max], e.g. [97, 12, 247, 212].

  • label_fields (list): list of fields that are joined with boxes, e.g labels.
    Should be same type as boxes.
  • min_area (float): minimum area of a bounding box. All bounding boxes whose
    visible area in pixels is less than this value will be removed. Default: 0.0.
  • min_visibility (float): minimum fraction of area for a bounding box
    to remain this box in list. Default: 0.0.
class albumentations.core.composition.OneOf(transforms, p=0.5)[source]

Select on of transforms to apply

Parameters:
  • transforms (list) – list of transformations to compose.
  • p (float) – probability of applying selected transform. Default: 0.5.

Transforms interface

class albumentations.core.transforms_interface.DualTransform(p=0.5)[source]

Transform for segmentation task.

class albumentations.core.transforms_interface.ImageOnlyTransform(p=0.5)[source]

Transform applied to image only.