peal.data.transformations.RandomRotation¶
- class peal.data.transformations.RandomRotation[source]¶
Bases:
objectRotate a tensor image by a random integer angle.
The angle drawn for the most recent call is kept in
last_theta(degrees) so that a paired transform, e.g. for a mask, can reuse it.- Parameters:
Methods
- __init__(min_rotation=-180, max_rotation=180)[source]¶
Store the angle range and initialize
last_theta.
- __call__(sample)[source]¶
Rotate
sampleby a uniformly drawn angle, filling with 0.5.- Parameters:
sample (
torch.Tensor) – Image of shape[C, H, W].- Returns:
Rotated image of the same shape.
- Return type: