Stack Exchange
CNN model with max pooling Problem onto model
I was Train Neural Network & the CNN model but when i make this model the colab error shows that invalid syntax So, can you help me what is the problem?
model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(16,(3,3),activation= 'relu', input_shape =(200,200,3)),
                                    tf.keras.layers.MaxPool2D(2,2),
                                    
                                    tf.keras.layers.Conv2D(32,(3,3),activation= 'relu'.
                                    tf.keras.layers.MaxPool2D(2,2),
                                    
                                    tf.keras.layers.Conv2D(64,(3,3),activation= 'relu'.
                                    tf.keras.layers.MaxPool2D(2,2),
                                    
                                    tf.keras.layers.Flatten(),
                                    
                                    tf.keras.layers.Dense(512,activation= 'relu'),
                                    
                                    tf.keras.layers.Dense(1,activation='sigmoid')
                                    ])



There is "." instead of ","
tf.keras.layers.Conv2D(32,(3,3),activation= 'relu'.
tf.keras.layers.Conv2D(64,(3,3),activation= 'relu'.

Change it with ","
And also ")" is missing in that lines.
Here is how to fix it:
model=tf.keras.models.Sequential([
    tf.keras.layers.Conv2D(32,(3,3),activation= 'relu'),
    tf.keras.layers.MaxPool2D(2,2),
    tf.keras.layers.Conv2D(64,(3,3),activation= 'relu'),
    tf.keras.layers.MaxPool2D(2,2),
    tf.keras.layers.Flatten(),
    tf.keras.layers.Dense(512,activation= 'relu'),
    tf.keras.layers.Dense(1,activation='sigmoid'),
])


try this :
model=tf.keras.models.Sequential([
    tf.keras.layers.Conv2D(32,(3,3),activation= 'relu')
    tf.keras.layers.MaxPool2D(2,2),
    tf.keras.layers.Conv2D(64,(3,3),activation= 'relu')
    tf.keras.layers.MaxPool2D(2,2),
    tf.keras.layers.Flatten(),
    tf.keras.layers.Dense(512,activation= 'relu'),
    tf.keras.layers.Dense(1,activation='sigmoid')
])


Same Problem Where it says the syntaxError
File "", line 3
tf.keras.layers.MaxPool2D(2,2),
^
SyntaxError: invalid syntax
