Reputation: 842
I'm trying to obtain a confusion matrix using scikit after training my model but since I used flow_from_directory
, I don't have access to the data and labels or I don't know a way to do so. Since scikit confusion matrix method is used like:
confusion_matrix(y_true, y_pred)
and flow_from_directory
doesn't return the true labels. Is there a way to obtain them from flow_from_directory
directly or any other method?
Upvotes: 4
Views: 835
Reputation: 86600
For any generator
, you can yield data as with any iterable:
for x, y in something.flow_from_directory(...):
#do stuff
Be careful to decide when to stop. Generators for training in keras are infinite.
Upvotes: 5