Splitting train-val-test using local datasets

Hello! I have done splitting my local dataset into train-val sets through tf.keras.utils.image_dataset_from_directory. What I want to achieve is I want to use the same function to split into 3 parts (train-val-test sets). How do I achieve this with also using the same function and the same dataset?

Thank you!

You can choose the number of test samples from the validation dataset as shown below

train_ds = tf.keras.utils.image_dataset_from_directory(
  data_dir,
  validation_split=0.2,
  subset="training",
  seed=123,
  image_size=(180, 180),
  batch_size=batch_size)

val_ds = tf.keras.utils.image_dataset_from_directory(
  data_dir,
  validation_split=0.2,
  subset="validation",
  seed=123,
  image_size=(180, 180),
  batch_size=batch_size)

test_dataset = val_ds.take(150)
val_ds = val_ds.skip(150)

Thank you