Created
January 28, 2019 21:55
-
-
Save ResidentMario/9f413d5e7d89b98bf731f493babf66c7 to your computer and use it in GitHub Desktop.
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
from keras.models import Sequential | |
from keras.layers import Conv2D, MaxPooling2D | |
from keras.layers import Activation, Dropout, Flatten, Dense | |
from keras.losses import binary_crossentropy | |
from keras.callbacks import EarlyStopping | |
from keras.optimizers import RMSprop | |
model = Sequential() | |
model.add(Conv2D(32, kernel_size=(3, 3), input_shape=(128, 128, 3), activation='relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(32, (3, 3), activation='relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(64, (3, 3), activation='relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Flatten()) # this converts our 3D feature maps to 1D feature vectors | |
model.add(Dense(64, activation='relu')) | |
model.add(Dropout(0.5)) | |
model.add(Dense(1)) | |
model.add(Activation('sigmoid')) | |
model.compile(loss=binary_crossentropy, | |
optimizer=RMSprop(lr=0.0005), # half of the default lr | |
metrics=['accuracy']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment