Last active
October 22, 2018 15:53
-
-
Save pmarcelino/947ec18891edf53a025eacd3627dde73 to your computer and use it in GitHub Desktop.
Global average pooling solution for Dogs vs. Cats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define model | |
from keras import models | |
from keras import layers | |
from keras import optimizers | |
epochs = 100 | |
model = models.Sequential() | |
model.add(layers.GlobalAveragePooling2D(input_shape=(7,7,512))) | |
model.add(layers.Dense(1, activation='sigmoid')) | |
model.summary() | |
# Compile model | |
model.compile(optimizer=optimizers.Adam(), | |
loss='binary_crossentropy', | |
metrics=['acc']) | |
# Train model | |
history = model.fit(train_features, train_labels, | |
epochs=epochs, | |
batch_size=batch_size, | |
validation_data=(validation_features, validation_labels)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment