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

How to use random erasing in semantic segmentation in keras imagedatagenerator? #1

Open
emma-sjwang opened this issue Jul 12, 2018 · 1 comment

Comments

@emma-sjwang
Copy link

Hello.

The random erasing only is performed on the image translation, right?
When we deal with segmentation tasks, there is no need to change the mask.
How can we realize it in keras?

Thanks a lot.

@yu4u
Copy link
Owner

yu4u commented Jul 12, 2018

Hi @EmmaW8

I'm not sure whether random erasing is effective for segmentation task or not, but I think it is worth trying.
You do not need to use ImageDataGenerator if it is not convenient for you. Simply use eraser function to augment training image.
It may be better to ignore losses from the erased area (this can be done by exploiting some mask that indicates masked pixels).

from random_eraser import get_random_eraser
eraser = get_random_eraser()

# load image to img
img = eraser(img)

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

No branches or pull requests

2 participants