Composition API (core.composition)¶
¶
class albumentations.core.composition.BboxParams
(format, label_fields=None, min_area=0.0, min_visibility=0.0, check_each_transform=True)
[view source on GitHub]
¶
Parameters of bounding boxes
Parameters:
Name | Type | Description |
---|---|---|
format |
str |
format of bounding boxes. Should be 'coco', 'pascal_voc', 'albumentations' or 'yolo'. The |
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. |
check_each_transform |
bool |
if |
class albumentations.core.composition.Compose
(transforms, bbox_params=None, keypoint_params=None, additional_targets=None, p=1.0)
[view source on GitHub]
¶
Compose transforms and handle all transformations regarding bounding boxes
Parameters:
Name | Type | Description |
---|---|---|
transforms |
list |
list of transformations to compose. |
bbox_params |
BboxParams |
Parameters for bounding boxes transforms |
keypoint_params |
KeypointParams |
Parameters for keypoints transforms |
additional_targets |
dict |
Dict with keys - new target name, values - old target name. ex: {'image2': 'image'} |
p |
float |
probability of applying all list of transforms. Default: 1.0. |
class albumentations.core.composition.KeypointParams
(format, label_fields=None, remove_invisible=True, angle_in_degrees=True, check_each_transform=True)
[view source on GitHub]
¶
Parameters of keypoints
Parameters:
Name | Type | Description |
---|---|---|
format |
str |
format of keypoints. Should be 'xy', 'yx', 'xya', 'xys', 'xyas', 'xysa'. x - X coordinate, y - Y coordinate s - Keypoint scale a - Keypoint orientation in radians or degrees (depending on KeypointParams.angle_in_degrees) |
label_fields |
list |
list of fields that are joined with keypoints, e.g labels. Should be same type as keypoints. |
remove_invisible |
bool |
to remove invisible points after transform or not |
angle_in_degrees |
bool |
angle in degrees or radians in 'xya', 'xyas', 'xysa' keypoints |
check_each_transform |
bool |
if |
class albumentations.core.composition.OneOf
(transforms, p=0.5)
[view source on GitHub]
¶
Select one of transforms to apply. Selected transform will be called with force_apply=True
.
Transforms probabilities will be normalized to one 1, so in this case transforms probabilities works as weights.
Parameters:
Name | Type | Description |
---|---|---|
transforms |
list |
list of transformations to compose. |
p |
float |
probability of applying selected transform. Default: 0.5. |
class albumentations.core.composition.OneOrOther
(first=None, second=None, transforms=None, p=0.5)
[view source on GitHub]
¶
Select one or another transform to apply. Selected transform will be called with force_apply=True
.
class albumentations.core.composition.PerChannel
(transforms, channels=None, p=0.5)
[view source on GitHub]
¶
Apply transformations per-channel
Parameters:
Name | Type | Description |
---|---|---|
transforms |
list |
list of transformations to compose. |
channels |
list |
channels to apply the transform to. Pass None to apply to all. Default: None (apply to all) |
p |
float |
probability of applying the transform. Default: 0.5. |
class albumentations.core.composition.Sequential
(transforms, p=0.5)
[view source on GitHub]
¶
Sequentially applies all transforms to targets.
Note:
This transform is not intended to be a replacement for Compose
. Instead, it should be used inside Compose
the same way OneOf
or OneOrOther
are used. For instance, you can combine OneOf
with Sequential
to
create an augmentation pipeline that contains multiple sequences of augmentations and applies one randomly
chose sequence to input data (see the Example
section for an example definition of such pipeline).
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|