open-solution-mapping-challenge icon indicating copy to clipboard operation
open-solution-mapping-challenge copied to clipboard

MulticlassLabeler returns different shapes

Open jakubczakon opened this issue 7 years ago • 1 comments

MulticlassLabeler usually (almost always) returns: (2,300,300) but sometimes you get (1,300,300) which of course causes trouble. It happens because of the mask.max() in the following implementation.

def label_multiclass_image(mask):
    labeled_channels = []
    for label_nr in range(0, mask.max() + 1):
        labeled_channels.append(label(mask == label_nr))
    labeled_image = np.stack(labeled_channels)
    return labeled_image

jakubczakon avatar May 22 '18 18:05 jakubczakon

Yes and this is caused by current categorize_image() implementation. I think it is worth changing, because this kind of inconsistency in shape is not desirable, but it shouldn't cause any error in pipeline running or in the output.

taraspiotr avatar Jun 14 '18 12:06 taraspiotr