Why is my keras cnn model giving me the same result for every prediction? I have a simple cat or dog cnn model.
My model has an 80% validation accuracy and an 84% training accuracy

import keras
import tensorflow as tf
from keras.models import Sequential
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Dense
import numpy as np
from keras.models import load_model

classifier = tf.keras.Sequential()

classifier.add(Conv2D(32,(3,3),input_shape = (64,64,3),activation ="relu"  ))

classifier.add(MaxPooling2D(pool_size = (2,2)))

classifier.add(Conv2D(32,(3,3),activation ="relu"  ))
classifier.add(MaxPooling2D(pool_size = (2,2)))
classifier.add(Flatten())
classifier.add(Dense(units = 128, activation = "relu" ))
classifier.add(Dense(units = 1, activation = "sigmoid" ))
classifier.compile(optimizer = "adam", loss = "binary_crossentropy", metrics = ["accuracy"])
from keras.preprocessing.image import ImageDataGenerator

train_datagen = ImageDataGenerator(
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True)

test_datagen = ImageDataGenerator(rescale=1./255)

training_set= train_datagen.flow_from_directory('dataset/training_set',
                                                 target_size=(64, 64),
                                                 batch_size=32,
                                                 class_mode='binary')

test_set = test_datagen.flow_from_directory('dataset/test_set',
                                             target_size=(64, 64),
                                             batch_size=32,
                                             class_mode='binary')
classifier.fit(training_set,
               steps_per_epoch=int(8000/32),
               epochs=25,
               validation_data=test_set,
               validation_steps=int(2000/32))
print(training_set.class_indices)
from keras.preprocessing import image 
test_image = image.load_img("dataset/training_set/cats/cat.1.jpg",target_size= (64,64))
test_image = image.img_to_array(test_image)
test_image = np.expand_dims(test_image, axis = 0)
result = classifier.predict(test_image)
You are applying a preprocessing step to both your train and test images: rescale=1./255. This normalises the values of the image pixels to be in the range of (0,1) instead of (0,255).

However, when you are doing your predictions you are not applying this rescaling to your test image. This translates into testing an image with pixel values 255 higher than your model is expecting, thus always predicting the same (always a 1 I gues...) You should rescale your test samples as well. Just try:

print(classifier.predict(test_image/255))