From tensorflow guide tensorflow.org/tutorials/load_data/images:
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
data_dir,
validation_split=0.2,
subset="training",
seed=123,
image_size=(img_height, img_width),
batch_size=batch_size)
Get validation
val_ds = tf.keras.preprocessing.image_dataset_from_directory(
data_dir,
validation_split=0.2,
subset="validation",
seed=123,
image_size=(img_height, img_width),
batch_size=batch_size)
To get label
train_ds.class_names
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…