Skip to content

Instantly share code, notes, and snippets.

@himanshurawlani
Last active March 21, 2019 22:12
Show Gist options
  • Save himanshurawlani/7753c52c80a8d637882503e9646a2b81 to your computer and use it in GitHub Desktop.
Save himanshurawlani/7753c52c80a8d637882503e9646a2b81 to your computer and use it in GitHub Desktop.
This gist shows how to use tfds.load() from TensorFlow Datasets
import tensorflow_datasets as tfds
SPLIT_WEIGHTS = (8, 1, 1)
splits = tfds.Split.TRAIN.subsplit(weighted=SPLIT_WEIGHTS)
(raw_train, raw_validation, raw_test), metadata = tfds.load(name="tf_flowers",
with_info=True,
split=list(splits),
# specifying batch_size=-1 will load full dataset in the memory
# batch_size=-1,
# as_supervised: `bool`, if `True`, the returned `tf.data.Dataset`
# will have a 2-tuple structure `(input, label)`
as_supervised=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment