Machine Learning with Python Projects - Cat and Dog Image Classifier

Tell us what’s happening:
My model keeps on predicting only cat or dog
But neither at the same time

Your code so far
test_images,_= next(test_data_gen)
probabilities = np.argmax(model.predict(test_data_gen), axis= 1)
def plotImages(images_arr, probabilities = False):
fig, axes = plt.subplots(len(images_arr), 1, figsize=(5,len(images_arr) * 3))
if probabilities is False:
for img, ax in zip( images_arr, axes):
ax.imshow(img)
ax.axis(‘off’)
else:
for img, probability, ax in zip( images_arr, probabilities, axes):
ax.imshow(img)
ax.axis(‘off’)
if probability > 0.5:
ax.set_title(“%.2f” % (probability*100) + “% dog”)
else:
ax.set_title(“%.2f” % ((1-probability)*100) + “% cat”)
plt.show()
plotImages(test_images, probabilities=probabilities)

Your browser information:

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

Challenge: Machine Learning with Python Projects - Cat and Dog Image Classifier

Link to the challenge:

I’m not clear what the problem is. You’ll need to post a share link to your colab notebook to get assistance with these projects.