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

Added support of ground truth images for Keras generator #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

npielawski
Copy link

Tried to add the support of ground truth images for the Keras generator. Here is an example:
`p = Augmentor.Pipeline('dataset/train/images')
p.ground_truth('dataset/train/masks')

Augmenting operations

p.flip_left_right(probability=0.5)
p.flip_top_bottom(probability=0.5)

batch_gen = p.keras_generator
image, label = next(p.keras_generator(batch_size=1))`
where image contains the input image, and label the ground truth.

Unfortunately, this new functionality changed the API, with _execute() returning an array of images, instead of a single image.


if scaled:
X = X.astype('float32')
X /= 255
X /= 255.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I overlooked, dividing by 255 needs to be fixed...

X /= 255.
if self.process_ground_truth_images:
y = y.astype('float32')
y /= 255.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here of course

@mdbloice
Copy link
Owner

mdbloice commented Aug 2, 2018

Hi @npielawski thanks a lot for making the PR, and sorry for the delay in replying, I have been away from my office for the past couple of weeks. Anyway, yes I think we can fix this quite easily to work with _execute() - however, I am also working on pretty similar functionality and will be committing that code in the next few days (I hope). Maybe then we could revisit your PR and see how to integrate what you have changed after this?

@npielawski
Copy link
Author

Hi @mdbloice, no problem for the delay, I didn't expect anything over the summer. Please feel free to take any piece of my code to integrate in yours, if you need to. Also, I double pushed two different functionalities: the ability to work with ground truth images in Keras, but also the preallocation of the batch.

@mdbloice
Copy link
Owner

mdbloice commented Aug 2, 2018

Yeah actually something I also wanted to implement was preallocation - so I will use what you've written there for that.
Thanks again for making the PR!

@npielawski
Copy link
Author

You're welcome :)

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

Successfully merging this pull request may close these issues.

2 participants