Last active
December 31, 2023 00:14
-
-
Save himanshurawlani/b94a750ee83e81a70814d117d65b097b to your computer and use it in GitHub Desktop.
Pre-processing the dataset download using tfds.load()
This file contains hidden or 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_example(image, label): | |
image = tf.cast(image, tf.float32) | |
# Normalize the pixel values | |
image = image / 255.0 | |
# Resize the image | |
image = tf.image.resize(image, (IMG_SIZE, IMG_SIZE)) | |
return image, label | |
train = raw_train.map(format_example) | |
validation = raw_validation.map(format_example) | |
test = raw_test.map(format_example) |
Its worth to mention that you should load your dataset with tfds.load(..., as_supervised=True)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank u