def transform(image, label, training): image = pad(image, 2) image, label = to_tensor(image, label) image = normalize(image, [0.1307], [0.3081]) label = tf.one_hot(label, 10) return image, label
def transform(image, label, training): if training: image = random_crop(image, (32, 32), (4, 4)) image = tf.image.random_flip_left_right(image) image, label = to_tensor(image, label) image = normalize(image, [0.491, 0.482, 0.447], [0.247, 0.243, 0.262]) label = tf.one_hot(label, 100) return image, label
def transform(image, label, training): if training: image = random_crop(image, (32, 32), (4, 4)) image = tf.image.random_flip_left_right(image) image = autoaugment(image, "CIFAR10") image, label = to_tensor(image, label) image = normalize(image, [0.491, 0.482, 0.447], [0.247, 0.243, 0.262]) if training: image = random_apply(cutout(length=16), params['cutout_prob'], image) label = tf.one_hot(label, 100) return image, label
def transform(image, label, training): if training: image = random_crop(image, (32, 32), (4, 4)) image = tf.image.random_flip_left_right(image) # image = autoaugment(image, "CIFAR10") image, label = to_tensor(image, label) image = normalize(image, [0.491, 0.482, 0.447], [0.247, 0.243, 0.262]) # if training: # image = cutout(image, 16) label = tf.one_hot(label, 10) return image, label
def transform(image, label, training): if training: image = random_resized_crop(image, 160, scale=(0.05, 1.0), ratio=(0.75, 1.33)) image = tf.image.random_flip_left_right(image) else: image = resize(image, int(256 / 224 * 224)) image = center_crop(image, 224) image, label = to_tensor(image, label, label_offset=1) image = normalize(image, [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) label = tf.one_hot(label, 1000) return image, label
def transform(x, y, training): x, y = to_tensor(x, y, vmax=16) x = normalize(x, [4.8842], [6.0168]) return x, y