Predicting Cats vs Dogs complete confusion

Working on cell 10 in machine learning for classifying cats and dogs. I have been going around in circles trying to get the probabilities into the right form so I can pass them into plot images, but I am now so lost I can’t think straight. At one time I could print the probabilities and they were tuples so I could then use them to predict, but I tweaked some of the numbers in the model, and now I get a bunch of 1.0.
Can someone help me out here? I’m getting frustrated and need a point in the right direction.

Your code so far

probability_model = tf.keras.Sequential([model, tf.keras.layers.Softmax()])


predictions = probability_model.predict(test_data_gen)#predictions is numpy.ndarray

probabilities = []#type=array

for p in predictions:






img = []

for i in test_data_gen[4]:



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36

Challenge: Cat and Dog Image Classifier

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Thanks Jeremy. I keep forgetting how to do that…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.