Machine Learning with Python Projects - Cat and Dog Image Classifier

Tell us what’s happening:

Describe your issue in detail here.
i am getting the error in cell #7 it is not getting the number of classes greater than 1
#9 ia am getting "
ValueError: x and y must have same first dimension, but have shapes (15,) and (5,)"
this error
#10 IndexError: index 1 is out of bounds for axis 0 with size 1

Your code so far

from tensorflow.keras.optimizers import Adam

model = Sequential()

model.add(Conv2D(32, (3, 3), activation=‘relu’, input_shape=(IMG_HEIGHT, IMG_WIDTH,3)))
model.add(MaxPooling2D((2, 2)))

model.add(Conv2D(64, (3, 3), activation=‘relu’))
model.add(MaxPooling2D((2, 2)))

model.add(Conv2D(128, (3, 3), activation=‘relu’))
model.add(MaxPooling2D((2, 2)))

model.add(Flatten())

model.add(Dense(512, activation=‘relu’))

model.add(Dense(1, activation=‘softmax’))

model.compile(optimizer=Adam(lr=0.001),
loss=‘categorical_crossentropy’,
metrics=[‘accuracy’])

model.summary()

Your browser information:

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

Challenge Information:

Machine Learning with Python Projects - Cat and Dog Image Classifier

Hi and welcome to fCC,

At first glance looks like there’s an error when defining the attribute optimizer for the method compile:

https://www.tensorflow.org/api_docs/python/tf/keras/Model

Hope this helps.

Cheers,