Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply the same transformation to image and mask in elastic_transform ? #31

Open
Jing-He opened this issue Jul 25, 2018 · 2 comments
Open

Comments

@Jing-He
Copy link

Jing-He commented Jul 25, 2018

In augmentation, elastic_transform, it only applies a random transform on one input image array. I would think to be used for training, the image and mask pair should be transform in the same way. However, this single-input-image, single-output-image method makes it very inconvenient. Could we deform a list of images (np.arrays) using the same transformation in this method ? Thanks!

@pawni
Copy link
Contributor

pawni commented Jul 27, 2018

Hi,
thanks for your question.

That is currently definitely an issue and we don't have a great solution for this (yet?).

Currently, we have mostly handled it with stacking the labels onto the images and just transforming them together. This however, leads to other problems. I guess one (simple?) way would be to use a predefined random state to do transformations and pass it to the transform or have an explicit label channel.

This should be a relatively simple change and PRs are welcome and we're happy to assist :)

Alternatively, we can look at it soon.

@venkatesh20
Copy link

i have added in support for this in the latest version of augmentation.py that i have placed under "contrib". The fix allows for the user to specify a random seed value, that is then used to apply the transform to the image and mask pair in the same way. In addition, to solve Jing's request above, you can now pass in a list of input images, along with the random seed (which would ensure the same seeding for the entire list of images prior to transforming them) and the output is the transformed list of images. Each image in the list is of type numpy.ndarray. Please pull it in if you think it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants