Home > Software engineering >  CNN model with max pooling Problem onto model
CNN model with max pooling Problem onto model

Time:07-20

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')
                                    ])

enter image description here

CodePudding user response:

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'),
])

CodePudding user response:

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')
])
  • Related