Skip to content

Instantly share code, notes, and snippets.

@geffy
Last active July 15, 2016 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geffy/842b318ee31370119765345315100272 to your computer and use it in GitHub Desktop.
Save geffy/842b318ee31370119765345315100272 to your computer and use it in GitHub Desktop.
Main parts of our custom network for Data Science Game 2016 (online part)
def hard_normalizing(X):
return (X - 0.5) / 0.5
def init_model():
model = Sequential()
model.add(Convolution2D(64, 3, 3, border_mode='valid', input_shape=(3, 64, 64)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(32, 3, 3, border_mode='valid'))
model.add(Activation('relu'))
model.add(Convolution2D(32, 3, 3, border_mode='valid'))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(32, 3, 3, border_mode='valid'))
model.add(Activation('relu'))
model.add(Convolution2D(16, 3, 3, border_mode='valid'))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dropout(0.3))
model.add(Dense(32))
model.add(Activation('relu'))
model.add(Dropout(0.3))
model.add(Dense(4))
model.add(Activation('softmax'))
sgd = Adam(lr=0.001)
model.compile(loss='categorical_crossentropy', optimizer=sgd)
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment