def augmentation(original, label): image, label = prepare_image(original, label) image = tf.image.random_flip_up_down(image, seed=13) image = tf.image.flip_left_right(image) image = tf.image.resize_with_crop_or_pad(image, IMG_SIZE + 6, IMG_SIZE + 6) image = tf.image.random_crop(image, size=[IMG_SIZE, IMG_SIZE, 3]) image = tf.image.random_jpeg_quality(image, 65, 95) # Decrease the quality to make it more difficult to classify image = tf.image.random_brightness(image, max_delta=0.3) # Random brightness image = tf.clip_by_value(image, 0, 1) # Keep the image values between 0 and 1 return image, label