mdbloice / Augmentor

Image augmentation library in Python for machine learning.
https://augmentor.readthedocs.io/en/stable
MIT License
5.08k stars 866 forks source link

RandomZoom producing different augmentations on same batch of image arguments #209

Closed vqmalic closed 4 years ago

vqmalic commented 4 years ago

Hello mdbloice - thank you for this wonderful tool. It's been instrumental to a number of my projects.

I'm passing a ground truth image and a binary mask at the same time to the perform_operation() method of zoom_random and I'm noticing that after augmentation the image and the mask no longer line up. I think this might have to do with a recent commit in which the random generation of random_left_shift and random_right_shift are placed inside the do(image) method. When do is iterated over the passed images on line 1816, each image receives a different left/right shift so the outputs no longer match. In the previous commit, random_left_shift and random_right_shift were assigned only once, outside of do so all images would get the same shift.

Just wanted to check in and see if this is working as intended - I'm not a skilled coder myself so apologies if I'm barking up the wrong tree!

mdbloice commented 4 years ago

Hi there @vqmalic. I am glad you find the package useful!

Yes, you are absolutely right, the randomness should always be outside of the do() method. I will fix that immediately and update the package on PyPI.

Thanks for pointing this out!

mdbloice commented 4 years ago

Ok, so I have just updated Augmentor to version 0.2.8 on PyPI, you can update it using:

pip install --upgrade Augmentor

Hope this fixes the issues you were having.