Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.