Keypoint augmentations not working for IAAAffine
See original GitHub issue🐛 Bug
As per the overview of transformations here: https://albumentations.ai/docs/getting_started/transforms_and_targets/ I try to run both pixel-wise and spatial augmentations on my dataset, however when using the IAAAffine transformation, it results in the following error: ValueError: Expected x for keypoint (-9.433, 93.50725, 0.0, 0) to be in the range [0.0, 256], got -9.433.
Would like to perform different translations/scaling/shearing of my dataset. Is this not possible with keypoints also? Or are there other native albumentations transforms that would work instead?
To Reproduce
Steps to reproduce the behavior:
augment = albu.Compose(
[
albu.HueSaturationValue(p=0.5),
albu.RGBShift(p=0.5),
albu.RandomBrightnessContrast(p=0.5),
albu.MotionBlur(p=0.5),
albu.Cutout(num_holes=6, max_h_size=ranh, max_w_size=ranw, fill_value=ranc, always_apply=False, p=0.5),
albu.IAAAffine(scale=1, translate_percent=0.0, translate_px=None, rotate=0.0, shear=[25,25], order=1, cval=0, mode='edge', always_apply=False, p=0.5),
albu.GaussNoise(p=0.5),
albu.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), max_pixel_value=255.0, always_apply=False, p=1.0),
],
keypoint_params=albu.KeypointParams(format="xy")
)
augmented = augment(image=image, mask=mask, keypoints=keypoints)
Environment
- Albumentations version (e.g., 0.1.8): 0.5.2
- Python version (e.g., 3.7): 3.7.9
- OS (e.g., Linux): Windows
- How you installed albumentations (
conda
,pip
, source): conda
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
Examples: Keypoints — imgaug 0.4.0 documentation
Examples: Keypoints¶. imgaug can handle not only images, but also keypoints/landmarks on these. E.g. if an image is rotated during augmentation, the library ......
Read more >In Colab doing image data augmentation with "imgaug" is not ...
I found it was a version problem. In Colab the library imgaug comes with a version 0.2.9 but this version produces these undesired...
Read more >Transforms (imgaug.transforms) - Albumentations
This augmentation is deprecated. Please use Affine instead. Note: This class introduce interpolation artifacts to mask if it has values other than {0;1}....
Read more >imgaug: Image augmentation for machine learning experiments.
Techniques can be applied to both images and keypoints/landmarks on images. ... This is not necessary # for the background augmentation and here...
Read more >Data Augmentation: Packages Overview - Kaggle
This functionality makes it very easy to augment the dataset containing images for segmentation and object detection problems;; Complex augmentation ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem is not in imagaug augmentations. You have keypoints outside of image. If you want to use and save them set
remove_invisible=False
Sorry for the delay. How did you get this white background? I can not reproduce the problem. By default set
border_mode=cv2.BORDER_REFLECT_101
, which means that all pixels outside the image will be reflected starting from the image edge.