I am trying to do a CNN based project. But when I want to build a CNN model, I got an error in "model.add(Dropout(0.25))" in line 14. In the previous model.add(Dropout(0.25)) , i did not get error in line 9.
Can anyone tell me what is the problem here? Why does it give an error?
model = Sequential()
model.add(Conv2D(32 , kernel_size=(3,3), acitvation ='relu' , padding='same' , input_shape = (28,28,1)))
model.add(BatchNormalization())
model.add(Conv2D(32,kernel_size=(3,3),activation='relu' , padding='same'))
model.add(BatchNormalization())
model.add(MaxPool2D(pool_size=(2,2) ,strides=2))
model.add(Dropout(0.25))
model.add(Conv2D(64,kernel_size=(3,3),activation='relu' , padding='same'))
model.add(BatchNormalization())
model.add(MaxPool2D(pool_size=(2,2),strides=2,padding='valid')
model.add( Dropout(0.25))
model.add(Flatten())
model.add(Dense(512,activation='relu'))
model.add(BatchNormalization())
model.add(Dropout(0.25))
model.add(Dense(1024,activation='relu'))
model.add(BatchNormalization())
model.add(Dropout(0.5))
model.add(Dense(10,activation='softmax'))
and the error message is
File "<ipython-input-53-e1c5cf3b08b4>", line 14
model.add( Dropout(0.25))
^
SyntaxError: invalid syntax
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…