there are plenty of examples how to create and use TensorFlow datasets, e.g.
dataset = tf.data.Dataset.from_tensor_slices((images, labels))
My question is how to get back the data/labels from the TF dataset in numpy form? In other words want would be reverse operation of the line above, i.e. I have a TF dataset and want to get back images and labels from it.
In case your tf.data.Dataset is batched, the following code will retrieve all the y labels:
tf.data.Dataset
y = np.concatenate([y for x, y in ds], axis=0)
1.4m articles
1.4m replys
5 comments
57.0k users