Skip to content

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

@vonaviv

Description

@vonaviv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions