Added support of ground truth images for Keras generator#126
Added support of ground truth images for Keras generator#126npielawski wants to merge 1 commit intomdbloice:masterfrom
Conversation
| if scaled: | ||
| X = X.astype('float32') | ||
| X /= 255 | ||
| X /= 255. |
There was a problem hiding this comment.
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. |
|
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 |
|
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. |
|
Yeah actually something I also wanted to implement was preallocation - so I will use what you've written there for that. |
|
You're welcome :) |
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.