← Back to all transforms
D4
Description
Applies one of the eight possible D4 dihedral group transformations to a square-shaped input, maintaining the square shape. These transformations correspond to the symmetries of a square, including rotations and reflections. The D4 group transformations include: - 'e' (identity): No transformation is applied. - 'r90' (rotation by 90 degrees counterclockwise) - 'r180' (rotation by 180 degrees) - 'r270' (rotation by 270 degrees counterclockwise) - 'v' (reflection across the vertical midline) - 'hvt' (reflection across the anti-diagonal) - 'h' (reflection across the horizontal midline) - 't' (reflection across the main diagonal) Even if the probability (`p`) of applying the transform is set to 1, the identity transformation 'e' may still occur, which means the input will remain unchanged in one out of eight cases. Args: p (float): Probability of applying the transform. Default is 1, meaning the transform is applied every time it is called. Targets: image, mask, bboxes, keypoints Image types: uint8, float32 Note: This transform is particularly useful when augmenting data that does not have a clear orientation: - Top view satellite or drone imagery - Medical images
Parameters
- p: float (default: 1)
Targets
- Image
- Mask
- BBoxes
- Keypoints
Try it out
Original Image (width = 484, height = 733):
Transformed Image:
Transform not yet applied