I know it would be a stretch design-wise, but as for now I don't know how to get _both_ predictions true labels when using flow_from_directory.
It seems a very small code change (just keep accumulating true labels after each batch), and I would be more than happy to open a PR if there is interest in this.
EDIT: it seems that via shuffle=False the data are in the same order of gen.classes and gen.filenames. If that's the case, I might just add some documentation.
I also need something similar. I need to set shuffle=True for an edge case example I have. but test_generator.filenames or test_generator.classes have the original order not the shuffled order. test_generator.filenames and 'test_generator.classes` should return the shuffled orders not the original ones.
I would like this functionality too.
An nice additional benefit would be that a subset of the full dataset present in the category directories could be requested in the predict_generator - can be useful during testing/setup.
me too.
@abnera I think in this link
https://github.com/fchollet/keras/issues/4225#issue-186069901
@varun-bankiti's answer can solve your problem
@hhxjzyr thanks. It does not solve the error. As stated in this issue there could be a case where shuffle needs to be True shuffle=True. For the owner of this post, he could have used shuffle=False so we can close this. There is a new way to load data (Sequence since keras 2.0.5) this solved all my issues. I would advise people to use that instead of generators.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.
Hello, I am having the same issue. If there a way to obtain the true labels when using a custom generator with predict_generator?
Most helpful comment
Hello, I am having the same issue. If there a way to obtain the true labels when using a custom generator with
predict_generator?