Skip to content

Instantly share code, notes, and snippets.

@siakon89
Created March 29, 2020 17: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 siakon89/4b4f71075d9862d4a0843dd8c43d8101 to your computer and use it in GitHub Desktop.
Save siakon89/4b4f71075d9862d4a0843dd8c43d8101 to your computer and use it in GitHub Desktop.
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv2D, Flatten
from tensorflow.keras import optimizers
model = Sequential()
model.add(Conv2D(64, kernel_size=(3,3), activation='relu', input_shape=train_images[0].shape))
model.add(Conv2D(32, kernel_size=(3,3), activation='relu'))
model.add(Conv2D(32, kernel_size=(3,3), activation='relu'))
model.add(Flatten())
model.add(Dense(10, activation='softmax'))
adam = optimizers.Adam(lr=0.001)
model.compile(
optimizer=adam,
loss='categorical_crossentropy',
metrics=['accuracy']
)
model.fit(
train_images,
train_labels,
validation_data=(test_images, test_labels),
epochs=5,
batch_size=256
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment