Skip to content
Advertisement

Extract data from tensorflow dataset (e.g. to numpy)

I’m loading images via

JavaScript

I want to use the obtained data in non-tensorflow routines too. Therefore, I want to extract the data e.g. to numpy arrays. How can I achieve this? I can’t use tfds

Advertisement

Answer

I would suggest unbatching your dataset and using tf.data.Dataset.map:

JavaScript

Or as suggested in the comments, you could also try just working with the batches and concatenating them afterwards:

JavaScript

Or set shuffle=True and use tf.TensorArray:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement