jgraving / DeepPoseKit

a toolkit for pose estimation using deep learning

Home Page:http://deepposekit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FlipAxis only flipping up-down?

opened this issue · 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!

commented

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

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.

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.

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.

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