![]() |
Applies RandomErasing to a single image.
Inherits From: ImageAugment
tfm.vision.augment.RandomErasing(
probability: float = 0.25,
min_area: float = 0.02,
max_area: float = (1 / 3),
min_aspect: float = 0.3,
max_aspect=None,
min_count=1,
max_count=1,
trials=10
)
Reference: https://arxiv.org/abs/1708.04896
Implementaion is inspired by https://github.com/rwightman/pytorch-image-models
Args | |
---|---|
probability (float, optional): Probability of augmenting the image. Defaults to 0.25. min_area (float, optional): Minimum area of the random erasing rectangle. Defaults to 0.02. max_area (float, optional): Maximum area of the random erasing rectangle. Defaults to 1/3. min_aspect (float, optional): Minimum aspect rate of the random erasing rectangle. Defaults to 0.3. max_aspect ([type], optional): Maximum aspect rate of the random erasing rectangle. Defaults to None. min_count (int, optional): Minimum number of erased rectangles. Defaults to 1. max_count (int, optional): Maximum number of erased rectangles. Defaults to 1. trials (int, optional): Maximum number of trials to randomly sample a rectangle that fulfills constraint. Defaults to 10. |
Methods
distort
distort(
image: tf.Tensor
) -> tf.Tensor
Applies RandomErasing to single image
.
Args | |
---|---|
image (tf.Tensor): Of shape [height, width, 3] representing an image. |
Returns | |
---|---|
tf.Tensor
|
The augmented version of image .
|
distort_with_boxes
distort_with_boxes(
image: tf.Tensor, bboxes: tf.Tensor
) -> Tuple[tf.Tensor, tf.Tensor]
Distorts the image and bounding boxes.
Args | |
---|---|
image
|
Tensor of shape [height, width, 3] or
[num_frames, height, width, 3] representing an image or image sequence.
|
bboxes
|
Tensor of shape [num_boxes, 4] or [num_frames, num_boxes, 4]
representing bounding boxes for an image or image sequence.
|
Returns | |
---|---|
The augmented version of image and bboxes .
|