Created
June 5, 2023 13:57
-
-
Save MohanaRC/e7fe07706710a249c447aded100c04cf 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
def format_image(data): | |
""" | |
Function to reshape, format and normalize input images to make it compatible with the deep learning model | |
Inputs: | |
data: Input image | |
Outputs: | |
image: Formatted image | |
data["label"]: Training label associated with the image | |
""" | |
image = data["image"] | |
image = tf.reshape(image, [-1]) | |
image = tf.cast(image, 'float32') | |
image = image / 255.0 | |
return image, data["label"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment