Skip to content

Instantly share code, notes, and snippets.

@doleron
Created April 8, 2023 21:37
Show Gist options
  • Save doleron/23bff79cfbd3f5876801fae94700c1b6 to your computer and use it in GitHub Desktop.
Save doleron/23bff79cfbd3f5876801fae94700c1b6 to your computer and use it in GitHub Desktop.
INPUT_SIZE = 244
TRAINING_BATCH_SIZE = 8
def load_image(file_name):
raw = tf.io.read_file(file_name)
image = tf.io.decode_image(raw, expand_animations = False, channels=3)
image = tf.image.resize(image, size=(INPUT_SIZE, INPUT_SIZE), preserve_aspect_ratio=True)
image = tf.image.resize_with_crop_or_pad(image, INPUT_SIZE, INPUT_SIZE)
image = tf.cast(image, tf.float32) / 255.0
return image
def load_images(pair):
img_A = load_image(pair[0])
img_B = load_image(pair[1])
return (img_A, img_B)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment