Lecture 3 HandDigitRecognition
Lecture 3 HandDigitRecognition
In [31]: train_images.shape
In [32]: len(train_labels)
60000
Out[32]:
In [33]: train_labels
In [34]: test_images.shape
In [35]: len(test_labels)
10000
Out[35]:
In [36]: test_labels
train_labels = to_categorical(train_labels)
test_labels = to_categorical(test_labels)
network = models.Sequential()
network.add(layers.Dense(512, activation='relu', input_shape=(28 * 28,)))
network.add(layers.Dense(10, activation='softmax'))
Epoch 1/5
469/469 [==============================] - 4s 9ms/step - loss: 0.2550 - accuracy: 0.9257
Epoch 2/5
469/469 [==============================] - 5s 10ms/step - loss: 0.1027 - accuracy: 0.9693
Epoch 3/5
469/469 [==============================] - 4s 9ms/step - loss: 0.0678 - accuracy: 0.9793
Epoch 4/5
469/469 [==============================] - 5s 10ms/step - loss: 0.0484 - accuracy: 0.9851
Epoch 5/5
469/469 [==============================] - 5s 11ms/step - loss: 0.0370 - accuracy: 0.9884
<tensorflow.python.keras.callbacks.History at 0x1d90ba331c8>
Out[41]: