mdbloice / Augmentor

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

Use for Semantic Segmentation #244

Open Superzlw opened 2 years ago

Superzlw commented 2 years ago

Hi, thank you very much for the augmentor, it helped me a lot. But I have a question, I am not sure whether Augmentor can be used for multi-label semantic segmentation, but according to my experiments, most of the newly generated labels are wrong, such as the image below, the erased area does not correspond, and There are a lot of masks at the border that shouldn't be there.

wrong1

I tested some pictures and the erased areas are all wrong.

wrong2

I would like to ask, can augmentor not be used for semantic segmentation?

mdbloice commented 2 years ago

Hi @Superzlw I will have to take a look at this more closely and try to find a fix... so you are passing images and their masks (as pairs) in to the pipeline, and augmenting them as normal?

If you could show some code that you are using to do this, that would help! If I can see your code I am sure we can fix it.

Superzlw commented 2 years ago

Hi @mdbloice , Thanks for the reply. My test code is as follow:

import Augmentor

p = Augmentor.Pipeline(img_path)   # img_path: folder path of the images
p.ground_truth(label_path)         # label_path: folder path of the labels

p.random_erasing(probability=0.8, rectangle_area=0.5)
p.sample(10)

Augmentor works very well for flipping, but for some more complex operations like distortion, erasing, and borders there will be some undesired masks

NUS-Tim commented 1 year ago

Hi, @mdbloice, it seems I also face a similar problem described by @Superzlw .

mdbloice commented 1 year ago

Hi @Superzlw, hi @NUS-Tim

I updated the code in version 0.2.11 of Augmentor just now. Try upgrading with pip install --upgrade Augmentor and let me know if this works for you now... 🤔