import tensorflow_datasets as tfds
train_ds = tfds.load('cifar100', split='train[:90%]').shuffle(1024).batch(32)
val_ds = tfds.load('cifar100', split='train[-10%:]').shuffle(1024).batch(32)
I want to convert train_ds
and val_ds
into something like this: x_train, y_train
and x_val, y_val
(x for images and y for labels).
The Keras API uses train and test data split (this seems to be the case in sklearn too), but I do not want to use any test data at all here.
I have tried this, but it didn't work (and I do understand why this doesn't work, but I don't know how else can I convert my training data to images and labels):
x_train = train_ds['image']
# TypeError: 'BatchDataset' object is not subscriptable