Skip to content

transforms

DropAlphaChannel

Bases: DualTransform

Transform that takes rgba images and mask and that removes the alpha channel

Target : image, mask, masks Type : any

FixedCropAroundMaskIfExists

Bases: CropNonEmptyMaskIfExists

Crop area with mask if mask is non-empty, else make center crop. Cropped area will always be centered around a non empty area in a fully deterministic way.

Parameters:

Name Type Description Default
height int

vertical size of crop in pixels

required
width int

horizontal size of crop in pixels

required
ignore_values Optional[Sequence[int]]

values to ignore in mask, 0 values are always ignored (e.g. if background value is 5 set ignore_values=[5] to ignore)

None
ignore_channels Optional[Sequence[int]]

channels to ignore in mask (e.g. if background is a first channel set ignore_channels=[0] to ignore)

None
p float

probability of applying the transform. Default: 1.0.

1.0

RandomCropAroundMaskIfExists

Bases: CropNonEmptyMaskIfExists

Crop area with mask if mask is non-empty, else make random crop. Cropped area will always be centered around a non empty area with a random offset.

Parameters:

Name Type Description Default
height int

vertical size of crop in pixels

required
width int

horizontal size of crop in pixels

required
ignore_values Optional[Sequence[int]]

values to ignore in mask, 0 values are always ignored (e.g. if background value is 5 set ignore_values=[5] to ignore)

None
ignore_channels Optional[Sequence[int]]

channels to ignore in mask (e.g. if background is a first channel set ignore_channels=[0] to ignore)

None
p float

probability of applying the transform. Default: 1.0.

1.0

ToSingleChannelMask

Bases: DualTransform

Transforms that takes a grayscale masks with rgb or rgba channels and transform them into a single channel image

Target : mask, masks Type : any