March 2020
Intermediate to advanced
366 pages
9h 8m
English
We are going to use the TensorFlow dataset adapter in order to train our models. Of course, we could create a NumPy array from our dataset, but imagine how much memory it would require to keep all the images in the memory.
In contrast, the dataset adapter allows you to load the data into memory when required. Moreover, the data is loaded and prepared in the background so that it will not be a bottleneck in our training process. We transform our parsed array as follows:
ds = tuple(np.array(list(i)) for i in np.transpose(parsed))ds_slices = tf.data.Dataset.from_tensor_slices(ds)
From the previous code snippet, from_tensor_slices creates Dataset whose elements are slices of the given tensors. In our case, the ...
Read now
Unlock full access