ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: (None, 150, 3)

Ask Questions Forum: ask Machine Learning Questions to our readersCategory: Deep LearningValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: (None, 150, 3)
Abhirup Peeyal Sinha asked 2 months ago
train_Image_datagenarator = ImageDataGenerator(rescale=1./255,shear_range=0.2,
zoom_range=0.2,vertical_flip=True,
horizontal_flip=True)
training_set = train_Image_datagenarator.flow_from_directory(r"E:\Projects & Tutorial\CNN Project\Monkey breed\monkey_breed\train",
target_size=(150,150),
class_mode="categorical",batch_size=16)
test_Image_datagenarator = ImageDataGenerator(1./255)
test_set = test_Image_datagenarator.flow_from_directory(r"E:\Projects & Tutorial\CNN Project\Monkey breed\monkey_breed\validation",
target_size=(150,150,),
class_mode="categorical",batch_size=16)
cnn = Sequential()
# cnn.add(Conv2D(filters=32,padding="Same",kernel_size=3,activation='relu', input_shape=[224,224,3]))
cnn.add(Conv2D(32,(3,3), input_shape=(150,150,3), activation='relu'))
cnn.add(MaxPool2D(pool_size=2))
# cnn.add(Conv2D(filters=32,padding="Same",kernel_size=3,activation='relu'))
cnn.add(Conv2D(32,(3,3), activation='relu'))
cnn.add(MaxPool2D(pool_size=2))
cnn.add(Flatten())
cnn.add(Dense(units=128,activation='relu'))
cnn.add(Dense(units=10,activation='softmax'))

Your Answer

9 + 6 =