albumentations icon indicating copy to clipboard operation
albumentations copied to clipboard

Allow to set a custom mask interpolation method

Open creafz opened this issue 4 years ago • 6 comments

This is POC to fix an issue in #850. It supports two styles for setting mask interpolation.

Option 1. Set a global value for mask interpolation through Compose:

t = A.Compose([
    A.Resize(128, 128),
], mask_interpolation=cv2.INTER_NEAREST)

Option 2. Override a value for mask interpolation for a single transform:

t = A.Compose([
    A.Resize(128, 128).set_mask_interpolation(cv2.INTER_NEAREST_EXACT),
])

creafz avatar Jul 04 '21 15:07 creafz

Or as an alternative for Option 2, maybe it is better to an explicit argument for all DualTransform subclasses, such as

t = A.Compose([
    A.Resize(128, 128, mask_interpolation=cv2.INTER_NEAREST_EXACT)
])

What do you think?

creafz avatar Jul 05 '21 06:07 creafz

Or as an alternative for Option 2, maybe it is better to an explicit argument for all DualTransform subclasses, such as

t = A.Compose([
    A.Resize(128, 128, mask_interpolation=cv2.INTER_NEAREST_EXACT)
])

What do you think?

I think approach better, but it is need to change __init__ method for all transforms. If we will do this, we must to add **kwargs as an argument for all transforms to have possibility to add new features simpler

Dipet avatar Jul 05 '21 09:07 Dipet

please

LucaBonfiglioli avatar Mar 28 '24 16:03 LucaBonfiglioli

@LucaBonfiglioli Will look into this.

ternaus avatar Mar 28 '24 18:03 ternaus