Created
February 7, 2019 01:17
-
-
Save f-rumblefish/64787ad40f3f0f7feeca70db941eea99 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, Flatten, Dense | |
# parameters for architecture | |
input_shape = (224, 224, 3) | |
num_classes = 6 | |
conv_size = 32 | |
# parameters for training | |
batch_size = 32 | |
num_epochs = 20 | |
# build the model | |
model = Sequential() | |
model.add(Conv2D(conv_size, (3, 3), activation='relu', padding='same', input_shape=input_shape)) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(conv_size, (3, 3), activation='relu', padding='same')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(conv_size, (3, 3), activation='relu', padding='same')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Flatten()) | |
model.add(Dense(512, activation='relu')) | |
model.add(Dense(512, activation='relu')) | |
model.add(Dense(num_classes, activation='softmax')) | |
# compile the model | |
model.compile(loss='categorical_crossentropy', | |
optimizer='adam', | |
metrics=['accuracy']) | |
model.summary() | |
# train the model | |
history = model.fit(x_train, y_train, | |
batch_size=batch_size, | |
epochs=num_epochs, | |
verbose=1, | |
validation_split=0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
x_train was not declared.
So there is an error.