Can anyone tell me how to get the labels of the test set that I have after image data generator .
i need the labels to plot the confusion matrix. Please mentors tell me how to plot the confusion matrix.
test_datagen = ImageDataGenerator(rescale = 1./255,validation_split = 0.1)
test_set = val_datagen.flow_from_directory(val_path,
target_size = (227,227),
batch_size = 16,
class_mode = “categorical”
)
model.evaluate(test_set)
y_pred = model.predict(test_set)
for plotting confusion matrix I can use this function:
tf.math.confusion_matrix(
labels,
predictions,
num_classes=None,
weights=None,
dtype=tf.dtypes.int32,
name=None
)
but how do I get the labels to feed in the above function