I’m trying to do Semantic Segmentation with the Berkeley Deep Drive dataset.
The main issue I’m facing is that the mask is a single image with values 0 to 18 for defined classes and 255 for “Void”.
I’m able to replace the void class value from 255 to 19 by using the after_open
parameter in open_mask
function and make it call my custom function:
def change_void_val(x):
# Change void value from 255 in the dataset to 19
# for better visualization of segmentation map
x = np.array(x)
x[x==255] = 19
return x
mask = open_mask(get_y_fn(img_f), after_open = change_void_val)
However I don’t have access to this parameter when creating the dataset. I also tried to use transform_y
.
def _change_void_val(x):
x = np.array(x)
x[x==255] = 10000
return x
change_void_val = TfmPixel(_change_void_val)
data = (src.transform_y([[change_void_val()],[change_void_val()]])
.transform(get_transforms(), size=size, tfm_y=True)
.databunch(bs=bs)
.normalize(imagenet_stats))
Any idea?