forked from MartinThoma/LaTeX-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Thoma
committed
Feb 10, 2019
1 parent
551102b
commit 49b8552
Showing
4 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import data | ||
|
||
from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D | ||
from keras.models import Sequential, load_model | ||
|
||
model = Sequential() | ||
model.add(Conv2D(16, (3, 3))) | ||
model.add(MaxPooling2D(pool_size=(2, 2))) | ||
model.add(Conv2D(16, (3, 3))) | ||
model.add(Flatten()) | ||
model.add(Dense(128, activation='relu')) | ||
model.add(Dense(data.n_classes, activation='softmax')) | ||
|
||
model.compile(loss='categorical_crossentropy', optimizer='adam') | ||
model.fit(data.x_train, data.y_train) | ||
|
||
model.save('model.h5') | ||
model = load_model('model.h5') | ||
y_predicted = model.predict(data.x_test) |