Esempio n. 1
0
def random_crop(data, label, crop_size):
    height, width = crop_size

    data, rect = tfs.RandomCrop((height, width))(data)
    label = tfs.FixedCrop(*rect)(label)

    return data, label
Esempio n. 2
0
def rand_crop(data, label, height, width):
    
    #data is PIL.Image object
    #label is PIL.Image object
    
    data, rect = transforms.RandomCrop((height, width))(data)
    label = transforms.FixedCrop(*rect)(label)
    return data, label
def random_crop(the_image, the_label, width, height):  # preprocess
    """
	image, label: PIL.Image objects
	height, width: crop_sizes[0], [1]
	crop image and label together syntheticly
	"""
    the_image, rect = tf.RandomCrop((height, width))(the_image)
    the_label = tf.FixedCrop(*rect)(the_label)
    return the_image, the_label
Esempio n. 4
0
def rand_crop(data, label, height, width):
    """
    :param data: PIL.Image object
    :param label:  PIL.Image object
    :param height:
    :param width:
    :return:
    """
    data, rect = tfs.RandomCrop((height, width))(data)
    label = tfs.FixedCrop(*rect)(label)
    return data, label