Created
April 8, 2023 21:37
-
-
Save doleron/23bff79cfbd3f5876801fae94700c1b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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