Hi,
Getting the following error
TypeError: ‘_VariantDataset’ object is not subscriptable
when trying to access the first element like img[‘image’] from the dataset. How can I access first element of the dataset?
Thanks
Hi,
Getting the following error
TypeError: ‘_VariantDataset’ object is not subscriptable
when trying to access the first element like img[‘image’] from the dataset. How can I access first element of the dataset?
Thanks
Have you tried with:
Or you can use an iterator:
Usually:
for x in dataset:
....
for x in dataset.take(1)
....
Or
x = next(iter(dataset))
Or is this one of those cases where you have a dataset of datasets?
Yes. It is the case of dataset of datasets
Then you need to either use a double loop:
for sub in dataset:
for x in sub:
...
Or use tf.data.Dataset.flat_map
to flatten the nested datasets.
Thanks. I will try that.
Have a case of nested datasets. I will try the flat_map solution as suggested by Mark. Thanks
thank’s mark, this was usefull to take a loot and learn how window works.