DeepPoseKit icon indicating copy to clipboard operation
DeepPoseKit copied to clipboard

FlipAxis only flipping up-down?

Open ghost opened this issue 5 years ago • 5 comments

Hi! I'm trying to use the FlipAxis augmenter to flip images left-right but even setting the axis=1, I still get images flipped up-down. I simply did:

augmenter = FlipAxis(generator, axis=1) flip_image, flip_keypoints = augmenter(images=image, keypoints=keypoints)

I noticed that if I change the parent class of FlipAxis from iaa.Flipud to iaa.Fliplr, then I only get images flipping left-right, regardless of axis specified. I didn't investigate any further than that and I'm not really familiar with the imgaug library. Any thoughts?

Thanks!

ghost avatar Apr 28 '20 14:04 ghost

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar May 05 '20 14:05 stale[bot]

Hmmm... I guess the easiest thing to do would be to have separate Flipud and Fliplr augmenters that subclass the imgaug version. I'd welcome a PR if you want to work on it, or I can do it myself at some point.

jgraving avatar May 06 '20 09:05 jgraving

I wouldn't mind working on it, but it seems that the Flipud and Fliplr augmenters already have the functionality you'd want them to have - since they can handle keypoints. For example, one can directly do: aug = iaa.Fliplr() flip_image, flip_keypoints = aug(images=image, keypoints=keypoints) or see this example. Maybe there's some other reason to have a built-in augmenter?

The other option could be to have FlipAxis subclass meta.Augmenters (like Flipud/Fliplr), and just have an axis attribute. If you think this is the better idea, I can try to implement it.

ghost avatar May 07 '20 15:05 ghost

but it seems that the Flipud and Fliplr augmenters already have the functionality you'd want them to have

They flip the keypoint locations, but not the labels/ordering of the body parts in the array, which is why we subclassed a custom version.

The other option could be to have FlipAxis subclass meta.Augmenters (like Flipud/Fliplr), and just have an axis attribute. If you think this is the better idea, I can try to implement it.

This would be preferable for simplicity, but whatever is easiest to implement. I'd be happy to accept a PR, as I probably won't have much time to work on this for awhile.

jgraving avatar May 08 '20 07:05 jgraving

Ah, that makes sense! I'll submit a PR.

ghost avatar May 08 '20 20:05 ghost