(mask_rle, shape)
return img.reshape((shape[1], shape[0])).T
Based on https://www.kaggle.com/msl23518/visualize-the-stage1-test-solution and modified
    Args:
        mask_rle: run-length as string formatted (start length)
        shape: (height, width) of array to return

    Returns:
        numpy array, 1 - mask, 0 - background
Based on https://www.kaggle.com/msl23518/visualize-the-stage1-test-solution and modified
    Args:
        mask_rle: run-length as string formatted (start length)
        shape: (height, width) of array to return
Based on https : // www . kaggle . com / msl23518 / visualize - the - stage1 - test - solution and modified Args : mask_rle : run - length as string formatted ( start length ) shape : ( height width ) of array to return
def run_length_decoding(mask_rle, shape):
    """
    Based on https://www.kaggle.com/msl23518/visualize-the-stage1-test-solution and modified
    Args:
        mask_rle: run-length as string formatted (start length)
        shape: (height, width) of array to return

    Returns:
        numpy array, 1 - mask, 0 - background

    """
    s = mask_rle.split()
    starts, lengths = [np.asarray(x, dtype=int) for x in (s[0:][::2], s[1:][::2])]
    starts -= 1
    ends = starts + lengths
    img = np.zeros(shape[1] * shape[0], dtype=np.uint8)
    for lo, hi in zip(starts, ends):
        img[lo:hi] = 1
    return img.reshape((shape[1], shape[0])).T
def run_length_decoding ( mask_rle , shape ) : s = mask_rle . split ( ) starts , lengths = [ np . asarray ( x , dtype = int ) for x in ( s [ 0 : ] [ : : 2 ] , s [ 1 : ] [ : : 2 ] ) ] starts -= 1 ends = starts + lengths img = np . zeros ( shape [ 1 ] * shape [ 0 ] , dtype = np . uint8 ) for lo , hi in zip ( starts , ends ) : img [ lo : hi ] = 1 return img . reshape ( ( shape [ 1 ] , shape [ 0 ] ) ) . T