Skip to content

Instantly share code, notes, and snippets.

@MikeOfZen
Last active October 31, 2019 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikeOfZen/1c1ce51d87ba40c71ff73bdf498fafe6 to your computer and use it in GitHub Desktop.
Save MikeOfZen/1c1ce51d87ba40c71ff73bdf498fafe6 to your computer and use it in GitHub Desktop.
[tfds get dataset] get dataset and do split 3 way #tf #python #split #dataset #tfds
DATA_DIR="/tmp"
test_split, valid_split, train_split = tfds.Split.TRAIN.subsplit([10, 10, 80])
test_set = tfds.load("cats_vs_dogs:4.*.*",data_dir=DATA_DIR, split="train[:10%]", as_supervised=True)
valid_set = tfds.load("cats_vs_dogs:4.*.*",data_dir=DATA_DIR, split="train[10%:20%]", as_supervised=True)
train_set = tfds.load("cats_vs_dogs:4.*.*",data_dir=DATA_DIR, split="train[20%:]", as_supervised=True)
#tfds.load is called multiple times for each slice, the 'train' split name is taken from the dataset documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment