mdbloice / Augmentor

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

how to use ground_truth? #108

Open zhaoxin111 opened 6 years ago

zhaoxin111 commented 6 years ago

Hi, It is a very nice job !

here I have some confusion about the usage of ground_truth.

I want to augment the image and it's masks(here every image has two different mask ) simultaneously, How can I realize the idea with ground_truth?

show me some example will be excellent

thank you

mdbloice commented 6 years ago

Hi @zhaoxin111, yes this is something I am working on - it's been requested a few times so it seems to be functionality that many people would find useful. So I'll try to make it a priority and get it added soon.

ChenWentai commented 6 years ago

Hello @mdbloice , I am working on a image segmentation task where each image has only one mask. I succeeded augmenting both data and masks by adding _p.ground_truth("ground_truthpath") and then p.sample(N), which will automatically produce the augmented images and masks and store them in "output" folder.

However, when I try _"Augmentor.Pipeline.kerasgenerator()". It seems that this function can only return a generator with a one-hot encoded label as image labels instead of a whole mask.

It would be very kind of you to improve this feature in _"kerasgenerator()" also. Thank you!

tamkaho commented 6 years ago

Is there any way to transform a pair of images (image + ground truth) on the fly without saving them on a disk?

ChenWentai commented 6 years ago

@tamkaho Hello tamkaho, augmentation applied both on images and ground truth(without saving them to disk) can be achieved by keras.preprocessing.image.ImageDataGenerator(), and then use flow() or flow_from_directory() method. A detail example can be found in keras documents: https://keras.io/preprocessing/image/

I have already implemented this in my own project. But I would like to use Augmentor library to do it , ,because for my own dataset, this augmentation effect is better than the keras built-in library I mentioned above.

blateyang commented 6 years ago

Hello, @ChenWentai, I am also want to augment the image and its ground truth annotation simultaneously, but the ground truth is bounding box for me . I wonder whether your mask annotations are in COCO json format. If so, can you share me your processing procedure about augmenting both the image and its ground truth annotation as refer? Thanks in advance!

jaelim commented 6 years ago

@ChenWentai Hi there, In your ground_truth directory, does it contain images and bounding box coordinate (mask) text files? It sounds like you applied transformation to image and also to the location of bounding box (mask) in augmentation. Can you elaborate?

ChenWentai commented 6 years ago

@blateyang @jaelim Hello, I was using Warwick-QU dataset and my ground truth is the labeling of objects: 0 for background and 1 for objects. So it does not contain any bounding box. Sorry I cannot help in this case!

blateyang commented 6 years ago

It doesn't matter. I'll try to make bbox ground_truth by myself.

At 2018-09-09 05:09:24, "CHEN Wentai" notifications@github.com wrote:

@blateyang@jaelim Hello, I was using Warwick-QU dataset and my ground truth is the labeling of objects: 0 for background and 1 for objects. So it does not contain any bounding box. Sorry I cannot help in this case!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jaelim commented 6 years ago

@ChenWentai @blateyang I found out what mask (an example of this is shown in the repo) is; it is not a bounding-box (as in object detection model) as I incorrectly assumed.

zendi014 commented 1 year ago

@ChenWentai my annotation was generated using makesense.ai which is formatted as coco or vgg json format, is that possible to user ground_truth to augment my own dataset?