nobody
nobody

Reputation: 465

"ValueError: Asked to retrieve element 0, but the Sequence has length 0" in Convolutional Neural Network

I am using this code: https://github.com/gsurma/image_classifier/blob/master/ImageClassifierCNN.ipynb but I get this error: ValueError: Asked to retrieve element 0, but the Sequence has length 0 on this line: probabilities = model.predict_generator(test_generator, TEST_SIZE) . I followed this suggestion: How can I get rid of getting error through test generator? and I changed the above line to this: probabilities = model.predict(test_generator, TEST_SIZE) but does not work! And this: ValueError: Asked to retrieve element 0, but the Sequence has length 0 has no solution for my case. Any idea what is wrong?

Upvotes: 0

Views: 3481

Answers (1)

nobody
nobody

Reputation: 465

After searching I have found that I need to include 2 folders inside "test" folder, where the folder names are "cat" and "dog". In order to see all the test images I changed TEST_SIZE = ... to the total number of the images inside the 2 folders under "test" folder.

Upvotes: 1

Related Questions