Source: Deep Learning on Medium
Create a tf.dataset object for TensorFlow 2.0
Recently I tried to create a dataset from images in a folder to train a CNN but I faced a lot of difficulty until i realized that the answer was right in my face, (in the docs) there are many posts but they are not updated for tensorflow 2.0 and maybe i was too dumb but i didn’t quite understand the documentation at first.
We use tf.data.Dataset method creating the dataset object consisting of names of the images (with their names) and their labels in a list, then we can apply a parse function which we can map over the dataset which reads the images. Credit to some stack overflow answer i saw a while ago but don’t remember the question.