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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.