Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DiogenesAnalytics/31f4a60eb4514d38b407cceb7c14db13 to your computer and use it in GitHub Desktop.
Save DiogenesAnalytics/31f4a60eb4514d38b407cceb7c14db13 to your computer and use it in GitHub Desktop.
Pre-processing the dataset download using tfds.load()
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment