to understand the framework and have no more errors in the output, I just returned a b/w copy of the original image in the segmentation function