if image.shape != labels.shape:
        raise ValueError(
            "Image shape %s != label shape %s" % (repr(image.shape), repr(labels.shape))