← Back to all transforms

MaskDropout

Description

Image & mask augmentation that zero out mask and image regions corresponding
    to randomly chosen object instance from mask.

    Mask must be single-channel image, zero values treated as background.
    Image can be any number of channels.

    Args:
        max_objects: Maximum number of labels that can be zeroed out. Can be tuple, in this case it's [min, max]
        image_fill_value: Fill value to use when filling image.
            Can be 'inpaint' to apply inpainting (works only  for 3-channel images)
        mask_fill_value: Fill value to use when filling mask.

    Targets:
        image, mask

    Image types:
        uint8, float32

    Reference:
        https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114254

    

Parameters

  • p: float (default: 0.5)
  • max_objects: int | tuple[int, int] | float | tuple[float, float] (default: (1, 1))
  • image_fill_value: float | Literal['inpaint'] (default: 0)
  • mask_fill_value: float (default: 0)

Targets

  • Image
  • Mask

Try it out

Original Image (width = 484, height = 733):

Original

Transformed Image:

Transform not yet applied