albumentations
albumentations copied to clipboard
CoarseDropout removes keypoints even if remove_invisible=False
🐛 Bug
If the keypoint is below the removed pixels it is not included in the keypoints list, even if the remove_invisible=False is set
To Reproduce
Snippet that reproduce the error:
aug_function = A.Compose([A.CoarseDropout(max_holes=1, max_height=64, max_width=64, p=1),
ToTensorV2()], keypoint_params=A.KeypointParams(format='xy',
remove_invisible=False,
label_fields=['class_labels']))
while True:
keypoints = [(10, 30),
(50, 90),
(150, 130),
(210, 230)]
key_out = aug_function(image=image, keypoints=keypoints, class_labels=class_labels)['keypoints']
if len(key_out) == 4:
print('OK')
elif len(key_out) != 4:
print('Error')
break
It returns the following for a run (of course is random the number of OK)
OK
OK
OK
OK
OK
OK
OK
OK
OK
Error
Expected behavior
I expect that the keypoint is returned even if lies where the removed pixels are
Environment
- Albumentations version 1.3.1:
- Python version 3.7
- OS Linux
- albumentations installed with
pip:
Not sure why this hasn't been fixed yet.
Not yet fixed in albumentations==1.4.3.
For those who want to use this augmentation with remove_invisible=False, I share my workaround.
preproc = A.Compose([
A.CoarseDropout(...),
...,
], keypoint_params=A.KeypointParams(format='xy', remove_invisible=False)
)
# remove_invisible not working in CoarseDropout
pypass = A.NoOp()
for transform in preproc.transforms:
if transform.__class__.__name__=='CoarseDropout':
transform.apply_to_keypoints = pypass.apply_to_keypoints
Will look into that.
Hello! Any progress with this issue? Still appears in 1.4.8