reader/reader_utils.py
def image_scaling_with_label(img):
    """
    Random scale images, assume the last channel is the label
    Resize the rgb part with bilinear interpolation, the label part with nearest neighbor
    :param img: image data cube, the last channel is the label
    :param rescale: if True, the image and label will be rescaled to the original shape
    :return: rescaled image
    """
    ftr = img[:, :, :-1]
    lbl = img[:, :, -1]
    scale = np.random.uniform(low=0.5, high=2.0)
    h, w = ftr.shape[:2]
    h_new = int(h * scale)
    w_new = int(w * scale)
    ftr = resize_image(ftr, (h_new, w_new))
    lbl = np.expand_dims(resize_image(lbl, (h_new, w_new), preserve_range=True), axis=-1)
    img = np.dstack([ftr, lbl])
    img = random_pad_crop_image_with_label(img, (h, w))

    return img

    Random scale images, assume the last channel is the label
    Resize the rgb part with bilinear interpolation, the label part with nearest neighbor
    :param img: image data cube, the last channel is the label
    :param rescale: if True, the image and label will be rescaled to the original shape
    :return: rescaled image
    
Random scale images, assume the last channel is the label
Resize the rgb part with bilinear interpolation, the label part with nearest neighbor
Random scale images assume the last channel is the label Resize the rgb part with bilinear interpolation the label part with nearest neighbor
def image_scaling_with_label(img):
    ftr = img[:, :, :-1]
    lbl = img[:, :, -1]
    scale = np.random.uniform(low=0.5, high=2.0)
    h, w = ftr.shape[:2]
    h_new = int(h * scale)
    w_new = int(w * scale)
    ftr = resize_image(ftr, (h_new, w_new))
    lbl = np.expand_dims(resize_image(lbl, (h_new, w_new), preserve_range=True), axis=-1)
    img = np.dstack([ftr, lbl])
    img = random_pad_crop_image_with_label(img, (h, w))
    return img
def image_scaling_with_label ( img ) : ftr = img [ : , : , : - 1 ] lbl = img [ : , : , - 1 ] scale = np . random . uniform ( low = 0.5 , high = 2.0 ) h , w = ftr . shape [ : 2 ] h_new = int ( h * scale ) w_new = int ( w * scale ) ftr = resize_image ( ftr , ( h_new , w_new ) ) lbl = np . expand_dims ( resize_image ( lbl , ( h_new , w_new ) , preserve_range = True ) , axis = - 1 ) img = np . dstack ( [ ftr , lbl ] ) img = random_pad_crop_image_with_label ( img , ( h , w ) ) return img
Random scale images, assume the last channel is the label
Resize the rgb part with bilinear interpolation, the label part with nearest neighbor
Random scale images assume the last channel is the label Resize the rgb part with bilinear interpolation the label part with nearest neighbor
"""
    Random scale images, assume the last channel is the label
    Resize the rgb part with bilinear interpolation, the label part with nearest neighbor
    :param img: image data cube, the last channel is the label
    :param rescale: if True, the image and label will be rescaled to the original shape
    :return: rescaled image
    """
None
img
image data cube, the last channel is the label
image data cube the last channel is the label
rescale
if True, the image and label will be rescaled to the original shape
if True the image and label will be rescaled to the original shape