Model gives 46% accuracy

Do not send this model to the pet store to get a dog or a cat. You have a 46% chance of getting what you wanted. This is my model. I have just resolved the image issue I was experiencing during testing, after much trial and error, mostly error. The issue was resolved by setting batch_size for test_data_gen to 50 so all 50 images were available for use. All documentation for testing data seemed to indicate that batch_size should of course be 1, since the model is seeing it once, but I digress.
Now I am stuck with a crappy model that doesn’t get more accurate no matter what I tweak. I’ve tried changing batch_size for training and validation sets, epochs, filters, steps, nothing is improving the accuracy.
Anybody have any suggestions as to what I should try next?

model = Sequential([

                  Conv2D(64, (5, 5), activation='relu', padding='same', strides=2, input_shape=(150, 150, 3)),

                  MaxPooling2D((2, 2), strides=2),

                  Conv2D(16, (3,3), padding='same', strides=2, activation='relu'),

                  MaxPooling2D((2,2), strides=2),

                  #Conv2D(16, (3,3), padding='same', strides=1, activation='relu'),

                  #MaxPooling2D((2,2), strides =1),

                  Flatten(),

                  Dense(32, activation='relu'),

            

                  Dense(2, activation='sigmoid')

                  

])

#model.add(tf.keras.Input(shape=(IMG_HEIGHT, IMG_WIDTH, 3)))

#model.add(tf.keras.layers.Conv2D(128, (3,3), padding = 'same', strides = (2,2), activation='relu'))

    #Conv2D(64, (3,3), padding = 'same', strides = (3,3), activation='relu', input_shape=(150, 150, 3)),

    #MaxPooling2D((2,2), padding = 'same'),

    #Conv2D(32, (3,3), padding = 'same', strides = (3,3), activation='relu'),

    #MaxPooling2D((2,2), padding = 'same'),

    #Conv2D(16, (3,3), padding = 'same', strides = (2,2), activation='relu'),

    #MaxPooling2D((2,2), padding = 'same'),

    #Flatten(),

    #Dense(16, activation='relu'),

    #Dense(8),

    #Dense(2, activation='relu')

#])

#base_model = tf.keras.applications.MobileNetV2(input_shape=(150, 150, 3), include_top=False, weights='imagenet')

#base_model.trainable = False

#global_average_layer = tf.keras.layers.GlobalAveragePooling2D()

#prediction_layer = tf.keras.layers.Dense(2)

#model = tf.keras.Sequential([

                             #base_model,

                             #global_average_layer,

                             #prediction_layer

#])

print(len(model.weights))

model.compile(optimizer='adam',

              loss='sparse_categorical_crossentropy',

              metrics=['accuracy'])

              #optimizer='rmsprop'

Please check you post again to properly format it as code.

The main-thing to tweak are different combinations of layers and hyperparameters for those.
However if you alway end up with exactly 46%, there might be another issue with activation functions or optimizer… those can sometimes be tricky to identify.

Personally I think I spent several days trying different layer-combinations, maybe tweaked the image-generators a little and at the end only barely got above the required threshhold… it’s just a lot of trial and error at this point.

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 (’).