Skip to content

Instantly share code, notes, and snippets.

@keunwoochoi
Created February 9, 2017 18:36
Show Gist options
  • Save keunwoochoi/9cfceee63b4a272d5ea0293978b90a3e to your computer and use it in GitHub Desktop.
Save keunwoochoi/9cfceee63b4a272d5ea0293978b90a3e to your computer and use it in GitHub Desktop.
def cnn_model(n_ch):
'''Assuming cifar-10 '''
input_shape = (3, 32, 32)
model = Sequential()
for i in range(N_LAYER):
if i == 0:
model.add(Convolution2D(n_ch, 3, 3, border_mode='same',
input_shape=input_shape,
name='conv%d' % i))
else:
model.add(Convolution2D(n_ch, 3, 3, border_mode='same',
name='conv%d' % i))
model.add(Activation('elu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(N_CLASS))
model.add(Activation('softmax'))
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment