Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Being Pythonic

Uday Lunawat udaylunawat

🔥
Being Pythonic
View GitHub Profile
@udaylunawat
udaylunawat / create_tfdf.py
Created Jul 15, 2022
Split folders with files (e.g. images) into train, validation and test (dataset) folders. And then convert them to Tensorflow Datasets.
View create_tfdf.py
# https://stackoverflow.com/a/64006242/9292995
# https://github.com/jfilter/split-folders
import splitfolders
# If your datasets is balanced (each class has the same number of samples), use ratio
# otherwise use fixed if dataset is imbalanced.
splitfolders.ratio('input_dir', output="output_dir", oversample=False, ratio = (0.8, 0.1, 0.1),
seed=1337)
# https://www.tensorflow.org/datasets/api_docs/python/tfds/folder_dataset/ImageFolder
View breathe-text-animation.markdown