← Back to all transforms
CropNonEmptyMaskIfExists
Description
Crop area with mask if mask is non-empty, else make random crop. Args: height: vertical size of crop in pixels width: horizontal size of crop in pixels ignore_values (list of int): values to ignore in mask, `0` values are always ignored (e.g. if background value is 5 set `ignore_values=[5]` to ignore) ignore_channels (list of int): channels to ignore in mask (e.g. if background is a first channel set `ignore_channels=[0]` to ignore) p: probability of applying the transform. Default: 1.0. Targets: image, mask, bboxes, keypoints Image types: uint8, float32
Parameters
- p: float (default: 1)
- height: int | None (default: null)
- width: int | None (default: null)
- ignore_values: list[int] | None (default: null)
- ignore_channels: list[int] | None (default: null)
Targets
- Image
- Mask
- BBoxes
- Keypoints
Try it out
Original Image (width = 484, height = 733):
Transformed Image:
Transform not yet applied