Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding BlendAlphaSimplexNoise into an augmentation sequence fails to convert keypoints #849

Open
vonaviv opened this issue May 3, 2024 · 0 comments

Comments

@vonaviv
Copy link

vonaviv commented May 3, 2024

Imgaug 0.4.0
Python 3.10

iaa.BlendAlphaSimplexNoise seems to cause problems when converting keypoints.

I have created an sequence of augmentations:

seq = iaa.Sequential([
    iaa.Affine(rotate=(-25, 25)),
    iaa.AllChannelsCLAHE(clip_limit=(1, 3), tile_grid_size_px=(10, 25)),
    iaa.BlendAlphaSimplexNoise(iaa.Multiply(iap.Uniform(0.7, 1.3), per_channel=True), size_px_max=(2, 16), upscale_method="nearest")
    # iaa.BlendAlphaFrequencyNoise(foreground=iaa.Multiply(iap.Choice([0.8, 1.2]), per_channel=True))
    ], random_order=False)

When I try to augment image and the corresponding keypoints with:

image_aug, kps_aug = seq(image=image, keypoints=kps_oi)

I get the error:

File ~/anaconda3/envs/dlc239-gui/lib/python3.10/site-packages/imgaug/augmenters/blend.py:757, in BlendAlphaMask._blend_coordinates(cls, cbaoi, cbaoi_fg, cbaoi_bg, mask_image, mode)
755 subgen = zip(coords, coords_fg, coords_bg)
    756 for coord, coord_fg, coord_bg in subgen:
--> 757     x_int = int(np.round(coord[0]))
    758     y_int = int(np.round(coord[1]))
    759     if 0 <= y_int < h_img and 0 <= x_int < w_img:

ValueError: cannot convert float NaN to integer

My keypoints include some NaN values (as a side note).

If I remove specifically iaa.BlendAlphaSimplexNoise there no error. For example If use iaa.BlendAlphaFrequencyNoise instead there is also no error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant