I'm using this code to load images that I have to pass to a Convolutional variational autoenocder:
import tensorflow as tf
train = tf.keras.preprocessing.image_dataset_from_directory(
data_dir + 'Train/', label_mode=None,
image_size=(img_height, img_width),
batch_size=batch_size)
To be able to pass this to the autoencoder, I have to set label_mode = None
. Also, the images received at the decoder are further to be passed to a CNN for classification where I need the labels.
How can I make train
also return the labels later for the CNN when initially its label_mode=None
.