Open ternaus opened 2 months ago
I found this bug related to reflection border mode (cv2.BORDER_REFLECT, cv2.BORDER_REFLECT_101) in A.Rotate
.
In the issue I found, there is also a problem with the output shape.
Example:
import numpy as np
import albumentations as A
image = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
transform = A.Compose([A.Rotate(limit=45, p=1.0)], keypoint_params=A.KeypointParams(format='xy', remove_invisible=False))
keypoints = np.random.randint(0, 100, (30, 2)).astype(dtype=np.float32)
result = transform(image=image, keypoints=keypoints)
rotated_image, rotated_keypoints = result['image'], result['keypoints']
rotated_keypoints.shape
is not (30, 2)
but (270, 2)
. As far as I checked, the size increases by 9x.
I see you were already tracking this issue, thanks for your work.
When you use reflection padding, you may expect that the number of keypoints will go up, as new points are added in the padded regions.