How do I access the validation subset from the keras dataset?

Viewed 86

How do I access the validation subset that I have reserved from the original dataset using tf.keras.image_dataset_from_directory? I tried the following but only gave the error too many values to unpack (expected 2):

dataset, validation = tf.keras.preprocessing.image_dataset_from_directory(
    train,
    labels="inferred",
    label_mode="categorical",
    color_mode="grayscale",
    batch_size=32,
    seed=1,
    image_size=(48, 48),
    validation_split=0.3, 
    subset="validation"
)

I am trying to split the dataset into train/test/validation - 70/15/15 respecitvely and need to save separate keras.Dataset variables for each of these subsets. I first need to access the validation subset from the code above, then I can split that further into another test subset using Dataset.take().

0 Answers
Related