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

Interpolation of ground-truth #221

Open yuliwu opened 4 years ago

yuliwu commented 4 years ago

One thing I noticed while augmenting is that the ground-truth labels had noises at the boundaries after being zoomed in. It might be caused, if the interpolation was set to bilinear or similar, while it should be set as nearest neighbours to avoid creating new labels.

nanoxas commented 4 years ago

I have the same problem. I was looking into the code and it seems the processing of the mask is the same as the image. So it would be necessary to distinguish between mask and image in order to apply the interpolation. And it's set to bicubic, but for the mask, it should be set to NN. Anyways you can do a workaround with morphological operations, binarization does the trick.

abmar commented 4 years ago

@yuliwu @nanoxas I faced the same problem for a multiclass segmentation. inspired by the multi mask augmentation functionality, I onehot encoded my masks, concatenate the obtained binary masks with the source image and augment at once then apply an argmax on the augmented masks to yield one mask with the multi class labels.

EscapeReality846089495 commented 3 years ago

So, did the author has deal this issue? I also find that all my masks has been disrupted by operation just like rotate, zoom_random, flip_top_bottom, random_distortion..., I don't know which operation make such a influence. Is there any way to choose the method of interpolation?