Good day! Trying to jump into keras, but have a pretty strange problem. Here is part of my code from ipython:
`from keras import backend as K
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, RMSprop, adam
K.set_image_dim_ordering('tf')
input_shape = img_data_scaled[0].shape
model = Sequential()
model.add(Convolution2D(32, (3 ,3), padding='same', input_shape=input_shape))
model.add(Activation('relu'))
model.add(Convolution2D(32, (3, 3)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.5))
model.add(Flatten())
model.add(Dense(64))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy', optimizer='rmsprop',metrics=["accuracy"])
hist = model.fit(X_train, y_train, batch_size = 32, nb_epoch = 20, verbose = 1, validation_data = (X_test, y_test))`
And, i have this problem:
File "<ipython-input-40-e57f946b3418>", line 16
model.add(Activation('relu'))
^
SyntaxError: invalid syntax
Really have no idea what it can be! Using python 2.7, last version of keras and ubuntu 14.
Can anyone quess, what is it?
Thank you~
You forget one parenthesis on the line above.
2017-10-25 1:54 GMT-02:00 Roma notifications@github.com:
Good day! Trying to jump into keras, but have a pretty strange problem.
Here is part of my code from ipython:`from keras import backend as K
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, RMSprop, adam
K.set_image_dim_ordering('tf')input_shape = img_data_scaled[0].shape
model = Sequential()
model.add(Convolution2D(32, (3 ,3), padding='same',
input_shape=input_shape))
model.add(Activation('relu'))
model.add(Convolution2D(32, (3, 3))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.5))
model.add(Flatten())
model.add(Dense(64))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes))
model.add(Activation('softmax'))model.compile(loss='categorical_crossentropy',
optimizer='rmsprop',metrics=["accuracy"])hist = model.fit(X_train, y_train, batch_size = 32, nb_epoch = 20, verbose
= 1, validation_data = (X_test, y_test))`And, i have this problem:
File "
", line 16
model.add(Activation('relu')) ^ SyntaxError: invalid syntaxReally have no idea what it can be! Using python 2.7, last version of
keras and ubuntu 14.
Can anyone quess, what is it?
Thank you~—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/fchollet/keras/issues/8237, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAuYzp2VEOqMIhlz78Rm4xCdacV-RIt-ks5svrECgaJpZM4QFZu8
.
Oh god, you right. Tried to figure it out for 1h.
Thank you very much!
You forget one parenthesis on the line above.
Seems Rights
Most helpful comment
You forget one parenthesis on the line above.
2017-10-25 1:54 GMT-02:00 Roma notifications@github.com: