Commit
·
88fb5e5
1
Parent(s):
77ad637
Fixed merge
Browse files- training.py +0 -20
training.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
<<<<<<< HEAD
|
| 2 |
from tensorflow import keras
|
| 3 |
|
| 4 |
(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
|
|
@@ -19,23 +18,4 @@ model.compile(optimizer=keras.optimizers.Adam(0.001),
|
|
| 19 |
|
| 20 |
model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs=3)
|
| 21 |
|
| 22 |
-
=======
|
| 23 |
-
from tensorflow import keras
|
| 24 |
-
|
| 25 |
-
(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
|
| 26 |
-
|
| 27 |
-
x_train = x_train / 255.0
|
| 28 |
-
x_test = x_test / 255.0
|
| 29 |
-
|
| 30 |
-
model = keras.models.Sequential([
|
| 31 |
-
keras.layers.Flatten(input_shape=(28, 28)), # Diese Schicht nimmt unser 2D-Bild und verwandelt es in ein 1D-Array
|
| 32 |
-
keras.layers.Dense(512, activation='relu'), # Als Nächstes kommen zwei Schichten mit 512 künstlichen Neuronen. Als Funktion wählen wir 'relu' f(x) = max(0,x)
|
| 33 |
-
keras.layers.Dense(512, activation='relu'),
|
| 34 |
-
keras.layers.Dense(10, activation='softmax') # Die letzte Schicht besteht aus 10 Neuronen, die für unsere 10 Zahlen stehen. Die 'softmax' Funktion wandelt die Ergebnisse der vorherigen Schicht in Wahrscheinlichkeiten
|
| 35 |
-
])
|
| 36 |
-
|
| 37 |
-
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
|
| 38 |
-
model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs=6)
|
| 39 |
-
|
| 40 |
-
>>>>>>> 1f82054bee2ed11c23599ab720a05335eb2d9499
|
| 41 |
model.save_weights('./weights/weights')
|
|
|
|
|
|
|
| 1 |
from tensorflow import keras
|
| 2 |
|
| 3 |
(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
|
|
|
|
| 18 |
|
| 19 |
model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs=3)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
model.save_weights('./weights/weights')
|