open-solution-mapping-challenge
open-solution-mapping-challenge copied to clipboard
MulticlassLabeler returns different shapes
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
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.