Introducción a la API Sequential de Keras#

Introducción#

Este es un notebook de Google Colaboratory. Los programas de Python se ejecutan directamente en tu navegador, una gran manera de aprender y utilizar TensorFlow. Para poder seguir este tutorial, ejecuta este notebook en Google Colab presionando el botón en la parte superior de esta pagina.

from __future__ import absolute_import, division, print_function

import tensorflow as tf
print('Version de Tensorflow = ', tf.__version__)
Version de Tensorflow =  2.9.1

Prepara datos de MNIST#

mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train/255.0, x_test/255.0

Modelo Sequential de Keras#

import tensorflow.keras.layers as layer

model = tf.keras.models.Sequential([
    layer.Flatten(input_shape=(28,28)), #784
    layer.Dense(128, activation='relu'),
    layer.Dropout(0.2),
    layer.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
             loss='sparse_categorical_crossentropy',
             metrics=['accuracy'])

Summary y Plot Model#

model.summary()
Model: "sequential"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 flatten (Flatten)           (None, 784)               0         
                                                                 
 dense (Dense)               (None, 128)               100480    
                                                                 
 dropout (Dropout)           (None, 128)               0         
                                                                 
 dense_1 (Dense)             (None, 10)                1290      
                                                                 
=================================================================
Total params: 101,770
Trainable params: 101,770
Non-trainable params: 0
_________________________________________________________________
from tensorflow.keras.utils import plot_model

plot_model(model, to_file='../Imagenes/mnist_dense.png', 
          show_shapes=True, show_dtype=False)
You must install pydot (`pip install pydot`) and install graphviz (see instructions at https://graphviz.gitlab.io/download/) for plot_model/model_to_dot to work.

Puede necesitar instalar graphviz.

#from plot_model import plot_model
#plot_model(model)

Entrenamiento y evaluación del modelo#

history = model.fit(x_train, y_train, epochs=5)
Epoch 1/5
   1/1875 [..............................] - ETA: 31:43 - loss: 2.3449 - accuracy: 0.1250

  12/1875 [..............................] - ETA: 9s - loss: 2.0053 - accuracy: 0.2969   

  29/1875 [..............................] - ETA: 7s - loss: 1.6279 - accuracy: 0.5086

  47/1875 [..............................] - ETA: 6s - loss: 1.3364 - accuracy: 0.6190

  64/1875 [>.............................] - ETA: 6s - loss: 1.1658 - accuracy: 0.6689

  81/1875 [>.............................] - ETA: 6s - loss: 1.0478 - accuracy: 0.7041

 100/1875 [>.............................] - ETA: 6s - loss: 0.9528 - accuracy: 0.7306

 118/1875 [>.............................] - ETA: 6s - loss: 0.8858 - accuracy: 0.7484

 135/1875 [=>............................] - ETA: 6s - loss: 0.8334 - accuracy: 0.7632

 155/1875 [=>............................] - ETA: 5s - loss: 0.7893 - accuracy: 0.7750

 171/1875 [=>............................] - ETA: 5s - loss: 0.7594 - accuracy: 0.7823

 186/1875 [=>............................] - ETA: 5s - loss: 0.7331 - accuracy: 0.7900

 204/1875 [==>...........................] - ETA: 5s - loss: 0.7040 - accuracy: 0.7976

 221/1875 [==>...........................] - ETA: 5s - loss: 0.6811 - accuracy: 0.8039

 241/1875 [==>...........................] - ETA: 5s - loss: 0.6567 - accuracy: 0.8104

 260/1875 [===>..........................] - ETA: 5s - loss: 0.6344 - accuracy: 0.8166

 280/1875 [===>..........................] - ETA: 5s - loss: 0.6148 - accuracy: 0.8219

 299/1875 [===>..........................] - ETA: 5s - loss: 0.6053 - accuracy: 0.8253

 319/1875 [====>.........................] - ETA: 5s - loss: 0.5897 - accuracy: 0.8295

 339/1875 [====>.........................] - ETA: 5s - loss: 0.5768 - accuracy: 0.8335

 356/1875 [====>.........................] - ETA: 5s - loss: 0.5675 - accuracy: 0.8364

 372/1875 [====>.........................] - ETA: 5s - loss: 0.5560 - accuracy: 0.8389

 392/1875 [=====>........................] - ETA: 5s - loss: 0.5455 - accuracy: 0.8418

 411/1875 [=====>........................] - ETA: 4s - loss: 0.5362 - accuracy: 0.8447

 430/1875 [=====>........................] - ETA: 4s - loss: 0.5248 - accuracy: 0.8477

 444/1875 [======>.......................] - ETA: 4s - loss: 0.5190 - accuracy: 0.8499

 460/1875 [======>.......................] - ETA: 4s - loss: 0.5101 - accuracy: 0.8522

 479/1875 [======>.......................] - ETA: 4s - loss: 0.5023 - accuracy: 0.8545

 492/1875 [======>.......................] - ETA: 4s - loss: 0.4982 - accuracy: 0.8557

 505/1875 [=======>......................] - ETA: 4s - loss: 0.4929 - accuracy: 0.8571

 521/1875 [=======>......................] - ETA: 4s - loss: 0.4871 - accuracy: 0.8583

 537/1875 [=======>......................] - ETA: 4s - loss: 0.4832 - accuracy: 0.8594

 551/1875 [=======>......................] - ETA: 4s - loss: 0.4780 - accuracy: 0.8610

 567/1875 [========>.....................] - ETA: 4s - loss: 0.4735 - accuracy: 0.8624

 586/1875 [========>.....................] - ETA: 4s - loss: 0.4670 - accuracy: 0.8641

 604/1875 [========>.....................] - ETA: 4s - loss: 0.4624 - accuracy: 0.8652

 621/1875 [========>.....................] - ETA: 4s - loss: 0.4577 - accuracy: 0.8668

 639/1875 [=========>....................] - ETA: 4s - loss: 0.4514 - accuracy: 0.8688

 655/1875 [=========>....................] - ETA: 4s - loss: 0.4474 - accuracy: 0.8699

 669/1875 [=========>....................] - ETA: 4s - loss: 0.4456 - accuracy: 0.8703

 685/1875 [=========>....................] - ETA: 4s - loss: 0.4414 - accuracy: 0.8718

 700/1875 [==========>...................] - ETA: 4s - loss: 0.4377 - accuracy: 0.8729

 718/1875 [==========>...................] - ETA: 3s - loss: 0.4349 - accuracy: 0.8733

 736/1875 [==========>...................] - ETA: 3s - loss: 0.4310 - accuracy: 0.8745

 749/1875 [==========>...................] - ETA: 3s - loss: 0.4285 - accuracy: 0.8751

 767/1875 [===========>..................] - ETA: 3s - loss: 0.4242 - accuracy: 0.8763

 785/1875 [===========>..................] - ETA: 3s - loss: 0.4202 - accuracy: 0.8777

 804/1875 [===========>..................] - ETA: 3s - loss: 0.4164 - accuracy: 0.8788

 824/1875 [============>.................] - ETA: 3s - loss: 0.4127 - accuracy: 0.8800

 839/1875 [============>.................] - ETA: 3s - loss: 0.4110 - accuracy: 0.8805

 858/1875 [============>.................] - ETA: 3s - loss: 0.4074 - accuracy: 0.8816

 874/1875 [============>.................] - ETA: 3s - loss: 0.4040 - accuracy: 0.8828

 891/1875 [=============>................] - ETA: 3s - loss: 0.4012 - accuracy: 0.8836

 906/1875 [=============>................] - ETA: 3s - loss: 0.3991 - accuracy: 0.8841

 919/1875 [=============>................] - ETA: 3s - loss: 0.3963 - accuracy: 0.8848

 937/1875 [=============>................] - ETA: 3s - loss: 0.3931 - accuracy: 0.8858

 952/1875 [==============>...............] - ETA: 3s - loss: 0.3915 - accuracy: 0.8863

 966/1875 [==============>...............] - ETA: 3s - loss: 0.3890 - accuracy: 0.8870

 984/1875 [==============>...............] - ETA: 3s - loss: 0.3853 - accuracy: 0.8881

1003/1875 [===============>..............] - ETA: 3s - loss: 0.3836 - accuracy: 0.8886

1021/1875 [===============>..............] - ETA: 2s - loss: 0.3817 - accuracy: 0.8891

1036/1875 [===============>..............] - ETA: 2s - loss: 0.3798 - accuracy: 0.8898

1049/1875 [===============>..............] - ETA: 2s - loss: 0.3773 - accuracy: 0.8906

1061/1875 [===============>..............] - ETA: 2s - loss: 0.3755 - accuracy: 0.8910

1076/1875 [================>.............] - ETA: 2s - loss: 0.3739 - accuracy: 0.8914

1091/1875 [================>.............] - ETA: 2s - loss: 0.3715 - accuracy: 0.8922

1107/1875 [================>.............] - ETA: 2s - loss: 0.3690 - accuracy: 0.8929

1124/1875 [================>.............] - ETA: 2s - loss: 0.3664 - accuracy: 0.8937

1142/1875 [=================>............] - ETA: 2s - loss: 0.3641 - accuracy: 0.8944

1156/1875 [=================>............] - ETA: 2s - loss: 0.3627 - accuracy: 0.8948

1174/1875 [=================>............] - ETA: 2s - loss: 0.3604 - accuracy: 0.8957

1192/1875 [==================>...........] - ETA: 2s - loss: 0.3583 - accuracy: 0.8964

1207/1875 [==================>...........] - ETA: 2s - loss: 0.3561 - accuracy: 0.8971

1222/1875 [==================>...........] - ETA: 2s - loss: 0.3540 - accuracy: 0.8976

1239/1875 [==================>...........] - ETA: 2s - loss: 0.3521 - accuracy: 0.8980

1258/1875 [===================>..........] - ETA: 2s - loss: 0.3494 - accuracy: 0.8988

1272/1875 [===================>..........] - ETA: 2s - loss: 0.3472 - accuracy: 0.8994

1290/1875 [===================>..........] - ETA: 2s - loss: 0.3457 - accuracy: 0.8998

1308/1875 [===================>..........] - ETA: 1s - loss: 0.3440 - accuracy: 0.9003

1325/1875 [====================>.........] - ETA: 1s - loss: 0.3421 - accuracy: 0.9008

1340/1875 [====================>.........] - ETA: 1s - loss: 0.3406 - accuracy: 0.9013

1356/1875 [====================>.........] - ETA: 1s - loss: 0.3390 - accuracy: 0.9017

1375/1875 [=====================>........] - ETA: 1s - loss: 0.3370 - accuracy: 0.9024

1393/1875 [=====================>........] - ETA: 1s - loss: 0.3349 - accuracy: 0.9029

1412/1875 [=====================>........] - ETA: 1s - loss: 0.3330 - accuracy: 0.9036

1430/1875 [=====================>........] - ETA: 1s - loss: 0.3311 - accuracy: 0.9042

1445/1875 [======================>.......] - ETA: 1s - loss: 0.3297 - accuracy: 0.9046

1456/1875 [======================>.......] - ETA: 1s - loss: 0.3282 - accuracy: 0.9051

1464/1875 [======================>.......] - ETA: 1s - loss: 0.3272 - accuracy: 0.9054

1482/1875 [======================>.......] - ETA: 1s - loss: 0.3263 - accuracy: 0.9057

1502/1875 [=======================>......] - ETA: 1s - loss: 0.3247 - accuracy: 0.9063

1518/1875 [=======================>......] - ETA: 1s - loss: 0.3232 - accuracy: 0.9066

1534/1875 [=======================>......] - ETA: 1s - loss: 0.3219 - accuracy: 0.9071

1547/1875 [=======================>......] - ETA: 1s - loss: 0.3208 - accuracy: 0.9074

1564/1875 [========================>.....] - ETA: 1s - loss: 0.3190 - accuracy: 0.9080

1582/1875 [========================>.....] - ETA: 1s - loss: 0.3173 - accuracy: 0.9085

1599/1875 [========================>.....] - ETA: 0s - loss: 0.3162 - accuracy: 0.9088

1612/1875 [========================>.....] - ETA: 0s - loss: 0.3148 - accuracy: 0.9091

1626/1875 [=========================>....] - ETA: 0s - loss: 0.3135 - accuracy: 0.9096

1640/1875 [=========================>....] - ETA: 0s - loss: 0.3121 - accuracy: 0.9100

1656/1875 [=========================>....] - ETA: 0s - loss: 0.3111 - accuracy: 0.9102

1667/1875 [=========================>....] - ETA: 0s - loss: 0.3105 - accuracy: 0.9104

1679/1875 [=========================>....] - ETA: 0s - loss: 0.3095 - accuracy: 0.9107

1693/1875 [==========================>...] - ETA: 0s - loss: 0.3088 - accuracy: 0.9110

1708/1875 [==========================>...] - ETA: 0s - loss: 0.3075 - accuracy: 0.9114

1723/1875 [==========================>...] - ETA: 0s - loss: 0.3065 - accuracy: 0.9117

1736/1875 [==========================>...] - ETA: 0s - loss: 0.3052 - accuracy: 0.9121

1752/1875 [===========================>..] - ETA: 0s - loss: 0.3039 - accuracy: 0.9124

1767/1875 [===========================>..] - ETA: 0s - loss: 0.3033 - accuracy: 0.9126

1782/1875 [===========================>..] - ETA: 0s - loss: 0.3023 - accuracy: 0.9129

1797/1875 [===========================>..] - ETA: 0s - loss: 0.3011 - accuracy: 0.9132

1812/1875 [===========================>..] - ETA: 0s - loss: 0.3002 - accuracy: 0.9135

1829/1875 [============================>.] - ETA: 0s - loss: 0.2988 - accuracy: 0.9139

1844/1875 [============================>.] - ETA: 0s - loss: 0.2979 - accuracy: 0.9142

1863/1875 [============================>.] - ETA: 0s - loss: 0.2968 - accuracy: 0.9145

1875/1875 [==============================] - 8s 4ms/step - loss: 0.2959 - accuracy: 0.9147
Epoch 2/5
   1/1875 [..............................] - ETA: 14s - loss: 0.0879 - accuracy: 1.0000

  16/1875 [..............................] - ETA: 6s - loss: 0.1339 - accuracy: 0.9570 

  31/1875 [..............................] - ETA: 6s - loss: 0.1550 - accuracy: 0.9506

  47/1875 [..............................] - ETA: 6s - loss: 0.1631 - accuracy: 0.9501

  62/1875 [..............................] - ETA: 6s - loss: 0.1721 - accuracy: 0.9466

  79/1875 [>.............................] - ETA: 6s - loss: 0.1669 - accuracy: 0.9466

  99/1875 [>.............................] - ETA: 6s - loss: 0.1621 - accuracy: 0.9479

 119/1875 [>.............................] - ETA: 6s - loss: 0.1621 - accuracy: 0.9488

 139/1875 [=>............................] - ETA: 5s - loss: 0.1640 - accuracy: 0.9481

 154/1875 [=>............................] - ETA: 5s - loss: 0.1634 - accuracy: 0.9493

 171/1875 [=>............................] - ETA: 5s - loss: 0.1626 - accuracy: 0.9501

 186/1875 [=>............................] - ETA: 5s - loss: 0.1620 - accuracy: 0.9506

 201/1875 [==>...........................] - ETA: 5s - loss: 0.1623 - accuracy: 0.9510

 215/1875 [==>...........................] - ETA: 5s - loss: 0.1633 - accuracy: 0.9510

 230/1875 [==>...........................] - ETA: 5s - loss: 0.1634 - accuracy: 0.9511

 244/1875 [==>...........................] - ETA: 5s - loss: 0.1631 - accuracy: 0.9511

 261/1875 [===>..........................] - ETA: 5s - loss: 0.1630 - accuracy: 0.9514

 280/1875 [===>..........................] - ETA: 5s - loss: 0.1611 - accuracy: 0.9521

 298/1875 [===>..........................] - ETA: 5s - loss: 0.1637 - accuracy: 0.9514

 317/1875 [====>.........................] - ETA: 5s - loss: 0.1638 - accuracy: 0.9518

 336/1875 [====>.........................] - ETA: 5s - loss: 0.1640 - accuracy: 0.9515

 352/1875 [====>.........................] - ETA: 5s - loss: 0.1631 - accuracy: 0.9519

 367/1875 [====>.........................] - ETA: 5s - loss: 0.1640 - accuracy: 0.9514

 385/1875 [=====>........................] - ETA: 5s - loss: 0.1630 - accuracy: 0.9514

 404/1875 [=====>........................] - ETA: 5s - loss: 0.1622 - accuracy: 0.9516

 420/1875 [=====>........................] - ETA: 5s - loss: 0.1615 - accuracy: 0.9519

 435/1875 [=====>........................] - ETA: 5s - loss: 0.1608 - accuracy: 0.9521

 455/1875 [======>.......................] - ETA: 5s - loss: 0.1598 - accuracy: 0.9524

 470/1875 [======>.......................] - ETA: 4s - loss: 0.1584 - accuracy: 0.9530

 487/1875 [======>.......................] - ETA: 4s - loss: 0.1585 - accuracy: 0.9528

 501/1875 [=======>......................] - ETA: 4s - loss: 0.1578 - accuracy: 0.9532

 516/1875 [=======>......................] - ETA: 4s - loss: 0.1582 - accuracy: 0.9531

 532/1875 [=======>......................] - ETA: 4s - loss: 0.1577 - accuracy: 0.9534

 547/1875 [=======>......................] - ETA: 4s - loss: 0.1569 - accuracy: 0.9536

 562/1875 [=======>......................] - ETA: 4s - loss: 0.1565 - accuracy: 0.9536

 578/1875 [========>.....................] - ETA: 4s - loss: 0.1569 - accuracy: 0.9537

 595/1875 [========>.....................] - ETA: 4s - loss: 0.1560 - accuracy: 0.9539

 612/1875 [========>.....................] - ETA: 4s - loss: 0.1572 - accuracy: 0.9538

 627/1875 [=========>....................] - ETA: 4s - loss: 0.1566 - accuracy: 0.9541

 644/1875 [=========>....................] - ETA: 4s - loss: 0.1551 - accuracy: 0.9547

 664/1875 [=========>....................] - ETA: 4s - loss: 0.1549 - accuracy: 0.9548

 683/1875 [=========>....................] - ETA: 4s - loss: 0.1544 - accuracy: 0.9550

 704/1875 [==========>...................] - ETA: 4s - loss: 0.1534 - accuracy: 0.9555

 721/1875 [==========>...................] - ETA: 4s - loss: 0.1528 - accuracy: 0.9557

 736/1875 [==========>...................] - ETA: 4s - loss: 0.1527 - accuracy: 0.9554

 754/1875 [===========>..................] - ETA: 3s - loss: 0.1531 - accuracy: 0.9552

 773/1875 [===========>..................] - ETA: 3s - loss: 0.1526 - accuracy: 0.9552

 793/1875 [===========>..................] - ETA: 3s - loss: 0.1511 - accuracy: 0.9557

 811/1875 [===========>..................] - ETA: 3s - loss: 0.1511 - accuracy: 0.9556

 827/1875 [============>.................] - ETA: 3s - loss: 0.1503 - accuracy: 0.9559

 846/1875 [============>.................] - ETA: 3s - loss: 0.1504 - accuracy: 0.9560

 861/1875 [============>.................] - ETA: 3s - loss: 0.1507 - accuracy: 0.9560

 879/1875 [=============>................] - ETA: 3s - loss: 0.1498 - accuracy: 0.9563

 897/1875 [=============>................] - ETA: 3s - loss: 0.1498 - accuracy: 0.9562

 913/1875 [=============>................] - ETA: 3s - loss: 0.1500 - accuracy: 0.9561

 932/1875 [=============>................] - ETA: 3s - loss: 0.1505 - accuracy: 0.9559

 950/1875 [==============>...............] - ETA: 3s - loss: 0.1502 - accuracy: 0.9560

 969/1875 [==============>...............] - ETA: 3s - loss: 0.1495 - accuracy: 0.9561

 987/1875 [==============>...............] - ETA: 3s - loss: 0.1488 - accuracy: 0.9562

1007/1875 [===============>..............] - ETA: 3s - loss: 0.1489 - accuracy: 0.9563

1026/1875 [===============>..............] - ETA: 2s - loss: 0.1496 - accuracy: 0.9561

1045/1875 [===============>..............] - ETA: 2s - loss: 0.1498 - accuracy: 0.9561

1065/1875 [================>.............] - ETA: 2s - loss: 0.1498 - accuracy: 0.9562

1083/1875 [================>.............] - ETA: 2s - loss: 0.1490 - accuracy: 0.9563

1103/1875 [================>.............] - ETA: 2s - loss: 0.1483 - accuracy: 0.9565

1122/1875 [================>.............] - ETA: 2s - loss: 0.1482 - accuracy: 0.9563

1141/1875 [=================>............] - ETA: 2s - loss: 0.1485 - accuracy: 0.9564

1161/1875 [=================>............] - ETA: 2s - loss: 0.1483 - accuracy: 0.9565

1179/1875 [=================>............] - ETA: 2s - loss: 0.1477 - accuracy: 0.9566

1198/1875 [==================>...........] - ETA: 2s - loss: 0.1475 - accuracy: 0.9567

1217/1875 [==================>...........] - ETA: 2s - loss: 0.1472 - accuracy: 0.9568

1236/1875 [==================>...........] - ETA: 2s - loss: 0.1470 - accuracy: 0.9570

1254/1875 [===================>..........] - ETA: 2s - loss: 0.1470 - accuracy: 0.9569

1274/1875 [===================>..........] - ETA: 2s - loss: 0.1465 - accuracy: 0.9570

1292/1875 [===================>..........] - ETA: 2s - loss: 0.1462 - accuracy: 0.9571

1307/1875 [===================>..........] - ETA: 1s - loss: 0.1462 - accuracy: 0.9571

1322/1875 [====================>.........] - ETA: 1s - loss: 0.1459 - accuracy: 0.9572

1338/1875 [====================>.........] - ETA: 1s - loss: 0.1459 - accuracy: 0.9572

1353/1875 [====================>.........] - ETA: 1s - loss: 0.1459 - accuracy: 0.9571

1368/1875 [====================>.........] - ETA: 1s - loss: 0.1462 - accuracy: 0.9570

1383/1875 [=====================>........] - ETA: 1s - loss: 0.1457 - accuracy: 0.9571

1399/1875 [=====================>........] - ETA: 1s - loss: 0.1451 - accuracy: 0.9572

1413/1875 [=====================>........] - ETA: 1s - loss: 0.1449 - accuracy: 0.9573

1429/1875 [=====================>........] - ETA: 1s - loss: 0.1451 - accuracy: 0.9572

1445/1875 [======================>.......] - ETA: 1s - loss: 0.1447 - accuracy: 0.9573

1459/1875 [======================>.......] - ETA: 1s - loss: 0.1446 - accuracy: 0.9572

1473/1875 [======================>.......] - ETA: 1s - loss: 0.1443 - accuracy: 0.9573

1488/1875 [======================>.......] - ETA: 1s - loss: 0.1440 - accuracy: 0.9575

1504/1875 [=======================>......] - ETA: 1s - loss: 0.1442 - accuracy: 0.9574

1522/1875 [=======================>......] - ETA: 1s - loss: 0.1439 - accuracy: 0.9574

1540/1875 [=======================>......] - ETA: 1s - loss: 0.1436 - accuracy: 0.9574

1558/1875 [=======================>......] - ETA: 1s - loss: 0.1436 - accuracy: 0.9574

1571/1875 [========================>.....] - ETA: 1s - loss: 0.1431 - accuracy: 0.9576

1590/1875 [========================>.....] - ETA: 0s - loss: 0.1434 - accuracy: 0.9575

1608/1875 [========================>.....] - ETA: 0s - loss: 0.1432 - accuracy: 0.9575

1624/1875 [========================>.....] - ETA: 0s - loss: 0.1436 - accuracy: 0.9573

1643/1875 [=========================>....] - ETA: 0s - loss: 0.1436 - accuracy: 0.9574

1662/1875 [=========================>....] - ETA: 0s - loss: 0.1433 - accuracy: 0.9574

1681/1875 [=========================>....] - ETA: 0s - loss: 0.1437 - accuracy: 0.9573

1699/1875 [==========================>...] - ETA: 0s - loss: 0.1432 - accuracy: 0.9574

1719/1875 [==========================>...] - ETA: 0s - loss: 0.1430 - accuracy: 0.9574

1737/1875 [==========================>...] - ETA: 0s - loss: 0.1429 - accuracy: 0.9574

1753/1875 [===========================>..] - ETA: 0s - loss: 0.1432 - accuracy: 0.9573

1772/1875 [===========================>..] - ETA: 0s - loss: 0.1429 - accuracy: 0.9575

1791/1875 [===========================>..] - ETA: 0s - loss: 0.1434 - accuracy: 0.9574

1810/1875 [===========================>..] - ETA: 0s - loss: 0.1430 - accuracy: 0.9576

1830/1875 [============================>.] - ETA: 0s - loss: 0.1426 - accuracy: 0.9577

1847/1875 [============================>.] - ETA: 0s - loss: 0.1425 - accuracy: 0.9577

1864/1875 [============================>.] - ETA: 0s - loss: 0.1426 - accuracy: 0.9577

1875/1875 [==============================] - 6s 3ms/step - loss: 0.1425 - accuracy: 0.9577
Epoch 3/5
   1/1875 [..............................] - ETA: 0s - loss: 0.0727 - accuracy: 0.9688

  13/1875 [..............................] - ETA: 8s - loss: 0.1190 - accuracy: 0.9663

  32/1875 [..............................] - ETA: 6s - loss: 0.1169 - accuracy: 0.9639

  52/1875 [..............................] - ETA: 6s - loss: 0.1108 - accuracy: 0.9663

  72/1875 [>.............................] - ETA: 6s - loss: 0.1069 - accuracy: 0.9666

  92/1875 [>.............................] - ETA: 5s - loss: 0.1039 - accuracy: 0.9691

 111/1875 [>.............................] - ETA: 5s - loss: 0.1070 - accuracy: 0.9682

 130/1875 [=>............................] - ETA: 5s - loss: 0.1051 - accuracy: 0.9690

 149/1875 [=>............................] - ETA: 5s - loss: 0.1002 - accuracy: 0.9708

 168/1875 [=>............................] - ETA: 5s - loss: 0.1004 - accuracy: 0.9704

 187/1875 [=>............................] - ETA: 5s - loss: 0.1029 - accuracy: 0.9684

 202/1875 [==>...........................] - ETA: 5s - loss: 0.1033 - accuracy: 0.9674

 222/1875 [==>...........................] - ETA: 5s - loss: 0.1064 - accuracy: 0.9668

 238/1875 [==>...........................] - ETA: 5s - loss: 0.1054 - accuracy: 0.9674

 257/1875 [===>..........................] - ETA: 5s - loss: 0.1043 - accuracy: 0.9679

 270/1875 [===>..........................] - ETA: 5s - loss: 0.1059 - accuracy: 0.9671

 284/1875 [===>..........................] - ETA: 5s - loss: 0.1059 - accuracy: 0.9675

 303/1875 [===>..........................] - ETA: 5s - loss: 0.1058 - accuracy: 0.9675

 320/1875 [====>.........................] - ETA: 5s - loss: 0.1081 - accuracy: 0.9672

 334/1875 [====>.........................] - ETA: 5s - loss: 0.1080 - accuracy: 0.9671

 354/1875 [====>.........................] - ETA: 5s - loss: 0.1067 - accuracy: 0.9672

 371/1875 [====>.........................] - ETA: 5s - loss: 0.1070 - accuracy: 0.9673

 391/1875 [=====>........................] - ETA: 4s - loss: 0.1070 - accuracy: 0.9672

 411/1875 [=====>........................] - ETA: 4s - loss: 0.1080 - accuracy: 0.9669

 432/1875 [=====>........................] - ETA: 4s - loss: 0.1074 - accuracy: 0.9672

 451/1875 [======>.......................] - ETA: 4s - loss: 0.1085 - accuracy: 0.9671

 471/1875 [======>.......................] - ETA: 4s - loss: 0.1073 - accuracy: 0.9672

 487/1875 [======>.......................] - ETA: 4s - loss: 0.1075 - accuracy: 0.9670

 508/1875 [=======>......................] - ETA: 4s - loss: 0.1070 - accuracy: 0.9671

 526/1875 [=======>......................] - ETA: 4s - loss: 0.1063 - accuracy: 0.9673

 544/1875 [=======>......................] - ETA: 4s - loss: 0.1062 - accuracy: 0.9673

 561/1875 [=======>......................] - ETA: 4s - loss: 0.1082 - accuracy: 0.9667

 575/1875 [========>.....................] - ETA: 4s - loss: 0.1094 - accuracy: 0.9664

 593/1875 [========>.....................] - ETA: 4s - loss: 0.1091 - accuracy: 0.9666

 607/1875 [========>.....................] - ETA: 4s - loss: 0.1088 - accuracy: 0.9667

 623/1875 [========>.....................] - ETA: 4s - loss: 0.1088 - accuracy: 0.9669

 638/1875 [=========>....................] - ETA: 4s - loss: 0.1084 - accuracy: 0.9670

 653/1875 [=========>....................] - ETA: 4s - loss: 0.1085 - accuracy: 0.9669

 669/1875 [=========>....................] - ETA: 4s - loss: 0.1084 - accuracy: 0.9670

 685/1875 [=========>....................] - ETA: 3s - loss: 0.1084 - accuracy: 0.9671

 702/1875 [==========>...................] - ETA: 3s - loss: 0.1077 - accuracy: 0.9675

 722/1875 [==========>...................] - ETA: 3s - loss: 0.1081 - accuracy: 0.9673

 742/1875 [==========>...................] - ETA: 3s - loss: 0.1073 - accuracy: 0.9676

 762/1875 [===========>..................] - ETA: 3s - loss: 0.1071 - accuracy: 0.9677

 782/1875 [===========>..................] - ETA: 3s - loss: 0.1076 - accuracy: 0.9674

 801/1875 [===========>..................] - ETA: 3s - loss: 0.1079 - accuracy: 0.9674

 818/1875 [============>.................] - ETA: 3s - loss: 0.1073 - accuracy: 0.9676

 838/1875 [============>.................] - ETA: 3s - loss: 0.1073 - accuracy: 0.9676

 853/1875 [============>.................] - ETA: 3s - loss: 0.1070 - accuracy: 0.9675

 866/1875 [============>.................] - ETA: 3s - loss: 0.1067 - accuracy: 0.9677

 883/1875 [=============>................] - ETA: 3s - loss: 0.1070 - accuracy: 0.9675

 902/1875 [=============>................] - ETA: 3s - loss: 0.1074 - accuracy: 0.9673

 918/1875 [=============>................] - ETA: 3s - loss: 0.1071 - accuracy: 0.9674

 933/1875 [=============>................] - ETA: 3s - loss: 0.1071 - accuracy: 0.9673

 950/1875 [==============>...............] - ETA: 3s - loss: 0.1070 - accuracy: 0.9675

 967/1875 [==============>...............] - ETA: 3s - loss: 0.1076 - accuracy: 0.9674

 986/1875 [==============>...............] - ETA: 2s - loss: 0.1075 - accuracy: 0.9674

1004/1875 [===============>..............] - ETA: 2s - loss: 0.1073 - accuracy: 0.9673

1022/1875 [===============>..............] - ETA: 2s - loss: 0.1070 - accuracy: 0.9674

1042/1875 [===============>..............] - ETA: 2s - loss: 0.1070 - accuracy: 0.9675

1056/1875 [===============>..............] - ETA: 2s - loss: 0.1074 - accuracy: 0.9675

1070/1875 [================>.............] - ETA: 2s - loss: 0.1071 - accuracy: 0.9675

1086/1875 [================>.............] - ETA: 2s - loss: 0.1075 - accuracy: 0.9675

1103/1875 [================>.............] - ETA: 2s - loss: 0.1075 - accuracy: 0.9675

1117/1875 [================>.............] - ETA: 2s - loss: 0.1076 - accuracy: 0.9675

1131/1875 [=================>............] - ETA: 2s - loss: 0.1078 - accuracy: 0.9674

1144/1875 [=================>............] - ETA: 2s - loss: 0.1076 - accuracy: 0.9675

1161/1875 [=================>............] - ETA: 2s - loss: 0.1076 - accuracy: 0.9674

1174/1875 [=================>............] - ETA: 2s - loss: 0.1072 - accuracy: 0.9675

1188/1875 [==================>...........] - ETA: 2s - loss: 0.1070 - accuracy: 0.9676

1204/1875 [==================>...........] - ETA: 2s - loss: 0.1068 - accuracy: 0.9677

1217/1875 [==================>...........] - ETA: 2s - loss: 0.1067 - accuracy: 0.9677

1232/1875 [==================>...........] - ETA: 2s - loss: 0.1064 - accuracy: 0.9678

1246/1875 [==================>...........] - ETA: 2s - loss: 0.1063 - accuracy: 0.9677

1260/1875 [===================>..........] - ETA: 2s - loss: 0.1062 - accuracy: 0.9677

1273/1875 [===================>..........] - ETA: 2s - loss: 0.1065 - accuracy: 0.9676

1286/1875 [===================>..........] - ETA: 2s - loss: 0.1070 - accuracy: 0.9676

1301/1875 [===================>..........] - ETA: 1s - loss: 0.1067 - accuracy: 0.9677

1315/1875 [====================>.........] - ETA: 1s - loss: 0.1072 - accuracy: 0.9676

1331/1875 [====================>.........] - ETA: 1s - loss: 0.1069 - accuracy: 0.9677

1344/1875 [====================>.........] - ETA: 1s - loss: 0.1070 - accuracy: 0.9677

1360/1875 [====================>.........] - ETA: 1s - loss: 0.1069 - accuracy: 0.9677

1374/1875 [====================>.........] - ETA: 1s - loss: 0.1073 - accuracy: 0.9677

1388/1875 [=====================>........] - ETA: 1s - loss: 0.1074 - accuracy: 0.9677

1404/1875 [=====================>........] - ETA: 1s - loss: 0.1073 - accuracy: 0.9677

1418/1875 [=====================>........] - ETA: 1s - loss: 0.1074 - accuracy: 0.9676

1430/1875 [=====================>........] - ETA: 1s - loss: 0.1071 - accuracy: 0.9676

1442/1875 [======================>.......] - ETA: 1s - loss: 0.1070 - accuracy: 0.9677

1455/1875 [======================>.......] - ETA: 1s - loss: 0.1071 - accuracy: 0.9676

1473/1875 [======================>.......] - ETA: 1s - loss: 0.1069 - accuracy: 0.9676

1485/1875 [======================>.......] - ETA: 1s - loss: 0.1070 - accuracy: 0.9676

1500/1875 [=======================>......] - ETA: 1s - loss: 0.1069 - accuracy: 0.9676

1513/1875 [=======================>......] - ETA: 1s - loss: 0.1072 - accuracy: 0.9675

1529/1875 [=======================>......] - ETA: 1s - loss: 0.1070 - accuracy: 0.9675

1545/1875 [=======================>......] - ETA: 1s - loss: 0.1071 - accuracy: 0.9674

1558/1875 [=======================>......] - ETA: 1s - loss: 0.1068 - accuracy: 0.9675

1575/1875 [========================>.....] - ETA: 1s - loss: 0.1068 - accuracy: 0.9675

1590/1875 [========================>.....] - ETA: 1s - loss: 0.1067 - accuracy: 0.9676

1604/1875 [========================>.....] - ETA: 0s - loss: 0.1066 - accuracy: 0.9676

1618/1875 [========================>.....] - ETA: 0s - loss: 0.1067 - accuracy: 0.9675

1635/1875 [=========================>....] - ETA: 0s - loss: 0.1066 - accuracy: 0.9675

1650/1875 [=========================>....] - ETA: 0s - loss: 0.1063 - accuracy: 0.9676

1663/1875 [=========================>....] - ETA: 0s - loss: 0.1059 - accuracy: 0.9676

1679/1875 [=========================>....] - ETA: 0s - loss: 0.1059 - accuracy: 0.9677

1695/1875 [==========================>...] - ETA: 0s - loss: 0.1059 - accuracy: 0.9677

1711/1875 [==========================>...] - ETA: 0s - loss: 0.1059 - accuracy: 0.9677

1726/1875 [==========================>...] - ETA: 0s - loss: 0.1059 - accuracy: 0.9678

1742/1875 [==========================>...] - ETA: 0s - loss: 0.1055 - accuracy: 0.9679

1759/1875 [===========================>..] - ETA: 0s - loss: 0.1055 - accuracy: 0.9678

1773/1875 [===========================>..] - ETA: 0s - loss: 0.1052 - accuracy: 0.9679

1788/1875 [===========================>..] - ETA: 0s - loss: 0.1054 - accuracy: 0.9678

1803/1875 [===========================>..] - ETA: 0s - loss: 0.1056 - accuracy: 0.9677

1820/1875 [============================>.] - ETA: 0s - loss: 0.1058 - accuracy: 0.9677

1834/1875 [============================>.] - ETA: 0s - loss: 0.1059 - accuracy: 0.9676

1850/1875 [============================>.] - ETA: 0s - loss: 0.1060 - accuracy: 0.9676

1867/1875 [============================>.] - ETA: 0s - loss: 0.1059 - accuracy: 0.9676

1875/1875 [==============================] - 7s 4ms/step - loss: 0.1060 - accuracy: 0.9676
Epoch 4/5
   1/1875 [..............................] - ETA: 0s - loss: 0.0391 - accuracy: 1.0000

  15/1875 [..............................] - ETA: 8s - loss: 0.0769 - accuracy: 0.9771

  30/1875 [..............................] - ETA: 7s - loss: 0.0808 - accuracy: 0.9750

  45/1875 [..............................] - ETA: 7s - loss: 0.0852 - accuracy: 0.9757

  59/1875 [..............................] - ETA: 7s - loss: 0.0853 - accuracy: 0.9751

  75/1875 [>.............................] - ETA: 7s - loss: 0.0866 - accuracy: 0.9742

  92/1875 [>.............................] - ETA: 6s - loss: 0.0859 - accuracy: 0.9742

 104/1875 [>.............................] - ETA: 7s - loss: 0.0815 - accuracy: 0.9760

 121/1875 [>.............................] - ETA: 6s - loss: 0.0814 - accuracy: 0.9760

 137/1875 [=>............................] - ETA: 6s - loss: 0.0821 - accuracy: 0.9754

 153/1875 [=>............................] - ETA: 6s - loss: 0.0860 - accuracy: 0.9743

 170/1875 [=>............................] - ETA: 6s - loss: 0.0878 - accuracy: 0.9735

 184/1875 [=>............................] - ETA: 6s - loss: 0.0880 - accuracy: 0.9733

 200/1875 [==>...........................] - ETA: 6s - loss: 0.0866 - accuracy: 0.9741

 217/1875 [==>...........................] - ETA: 6s - loss: 0.0864 - accuracy: 0.9741

 233/1875 [==>...........................] - ETA: 6s - loss: 0.0861 - accuracy: 0.9738

 249/1875 [==>...........................] - ETA: 6s - loss: 0.0849 - accuracy: 0.9744

 263/1875 [===>..........................] - ETA: 6s - loss: 0.0864 - accuracy: 0.9739

 277/1875 [===>..........................] - ETA: 6s - loss: 0.0853 - accuracy: 0.9745

 294/1875 [===>..........................] - ETA: 6s - loss: 0.0849 - accuracy: 0.9749

 311/1875 [===>..........................] - ETA: 6s - loss: 0.0842 - accuracy: 0.9753

 325/1875 [====>.........................] - ETA: 6s - loss: 0.0842 - accuracy: 0.9755

 338/1875 [====>.........................] - ETA: 5s - loss: 0.0833 - accuracy: 0.9756

 355/1875 [====>.........................] - ETA: 5s - loss: 0.0834 - accuracy: 0.9756

 369/1875 [====>.........................] - ETA: 5s - loss: 0.0843 - accuracy: 0.9755

 387/1875 [=====>........................] - ETA: 5s - loss: 0.0831 - accuracy: 0.9758

 399/1875 [=====>........................] - ETA: 5s - loss: 0.0823 - accuracy: 0.9760

 415/1875 [=====>........................] - ETA: 5s - loss: 0.0826 - accuracy: 0.9755

 431/1875 [=====>........................] - ETA: 5s - loss: 0.0819 - accuracy: 0.9758

 447/1875 [======>.......................] - ETA: 5s - loss: 0.0822 - accuracy: 0.9756

 461/1875 [======>.......................] - ETA: 5s - loss: 0.0818 - accuracy: 0.9755

 475/1875 [======>.......................] - ETA: 5s - loss: 0.0806 - accuracy: 0.9761

 493/1875 [======>.......................] - ETA: 5s - loss: 0.0811 - accuracy: 0.9757

 509/1875 [=======>......................] - ETA: 5s - loss: 0.0808 - accuracy: 0.9754

 523/1875 [=======>......................] - ETA: 5s - loss: 0.0817 - accuracy: 0.9750

 541/1875 [=======>......................] - ETA: 5s - loss: 0.0826 - accuracy: 0.9751

 556/1875 [=======>......................] - ETA: 5s - loss: 0.0833 - accuracy: 0.9749

 574/1875 [========>.....................] - ETA: 4s - loss: 0.0833 - accuracy: 0.9751

 591/1875 [========>.....................] - ETA: 4s - loss: 0.0837 - accuracy: 0.9747

 606/1875 [========>.....................] - ETA: 4s - loss: 0.0834 - accuracy: 0.9748

 620/1875 [========>.....................] - ETA: 4s - loss: 0.0835 - accuracy: 0.9747

 636/1875 [=========>....................] - ETA: 4s - loss: 0.0839 - accuracy: 0.9744

 653/1875 [=========>....................] - ETA: 4s - loss: 0.0839 - accuracy: 0.9745

 668/1875 [=========>....................] - ETA: 4s - loss: 0.0844 - accuracy: 0.9745

 685/1875 [=========>....................] - ETA: 4s - loss: 0.0844 - accuracy: 0.9744

 697/1875 [==========>...................] - ETA: 4s - loss: 0.0850 - accuracy: 0.9743

 711/1875 [==========>...................] - ETA: 4s - loss: 0.0853 - accuracy: 0.9742

 726/1875 [==========>...................] - ETA: 4s - loss: 0.0855 - accuracy: 0.9742

 741/1875 [==========>...................] - ETA: 4s - loss: 0.0865 - accuracy: 0.9742

 754/1875 [===========>..................] - ETA: 4s - loss: 0.0864 - accuracy: 0.9743

 768/1875 [===========>..................] - ETA: 4s - loss: 0.0864 - accuracy: 0.9743

 785/1875 [===========>..................] - ETA: 4s - loss: 0.0870 - accuracy: 0.9740

 799/1875 [===========>..................] - ETA: 4s - loss: 0.0871 - accuracy: 0.9740

 814/1875 [============>.................] - ETA: 4s - loss: 0.0871 - accuracy: 0.9740

 829/1875 [============>.................] - ETA: 3s - loss: 0.0867 - accuracy: 0.9741

 844/1875 [============>.................] - ETA: 3s - loss: 0.0866 - accuracy: 0.9743

 862/1875 [============>.................] - ETA: 3s - loss: 0.0865 - accuracy: 0.9742

 877/1875 [=============>................] - ETA: 3s - loss: 0.0869 - accuracy: 0.9741

 894/1875 [=============>................] - ETA: 3s - loss: 0.0868 - accuracy: 0.9744

 911/1875 [=============>................] - ETA: 3s - loss: 0.0869 - accuracy: 0.9744

 929/1875 [=============>................] - ETA: 3s - loss: 0.0869 - accuracy: 0.9744

 946/1875 [==============>...............] - ETA: 3s - loss: 0.0869 - accuracy: 0.9745

 962/1875 [==============>...............] - ETA: 3s - loss: 0.0877 - accuracy: 0.9742

 976/1875 [==============>...............] - ETA: 3s - loss: 0.0874 - accuracy: 0.9743

 992/1875 [==============>...............] - ETA: 3s - loss: 0.0871 - accuracy: 0.9742

1008/1875 [===============>..............] - ETA: 3s - loss: 0.0868 - accuracy: 0.9742

1027/1875 [===============>..............] - ETA: 3s - loss: 0.0868 - accuracy: 0.9743

1046/1875 [===============>..............] - ETA: 3s - loss: 0.0868 - accuracy: 0.9741

1067/1875 [================>.............] - ETA: 3s - loss: 0.0866 - accuracy: 0.9741

1087/1875 [================>.............] - ETA: 2s - loss: 0.0875 - accuracy: 0.9739

1102/1875 [================>.............] - ETA: 2s - loss: 0.0875 - accuracy: 0.9738

1116/1875 [================>.............] - ETA: 2s - loss: 0.0879 - accuracy: 0.9737

1136/1875 [=================>............] - ETA: 2s - loss: 0.0874 - accuracy: 0.9739

1155/1875 [=================>............] - ETA: 2s - loss: 0.0879 - accuracy: 0.9736

1174/1875 [=================>............] - ETA: 2s - loss: 0.0881 - accuracy: 0.9736

1194/1875 [==================>...........] - ETA: 2s - loss: 0.0880 - accuracy: 0.9736

1214/1875 [==================>...........] - ETA: 2s - loss: 0.0880 - accuracy: 0.9735

1233/1875 [==================>...........] - ETA: 2s - loss: 0.0880 - accuracy: 0.9734

1253/1875 [===================>..........] - ETA: 2s - loss: 0.0880 - accuracy: 0.9734

1272/1875 [===================>..........] - ETA: 2s - loss: 0.0879 - accuracy: 0.9734

1288/1875 [===================>..........] - ETA: 2s - loss: 0.0878 - accuracy: 0.9735

1306/1875 [===================>..........] - ETA: 2s - loss: 0.0878 - accuracy: 0.9735

1319/1875 [====================>.........] - ETA: 2s - loss: 0.0874 - accuracy: 0.9736

1335/1875 [====================>.........] - ETA: 1s - loss: 0.0873 - accuracy: 0.9736

1350/1875 [====================>.........] - ETA: 1s - loss: 0.0871 - accuracy: 0.9736

1369/1875 [====================>.........] - ETA: 1s - loss: 0.0875 - accuracy: 0.9734

1386/1875 [=====================>........] - ETA: 1s - loss: 0.0874 - accuracy: 0.9734

1402/1875 [=====================>........] - ETA: 1s - loss: 0.0877 - accuracy: 0.9733

1422/1875 [=====================>........] - ETA: 1s - loss: 0.0879 - accuracy: 0.9733

1440/1875 [======================>.......] - ETA: 1s - loss: 0.0878 - accuracy: 0.9733

1456/1875 [======================>.......] - ETA: 1s - loss: 0.0873 - accuracy: 0.9734

1476/1875 [======================>.......] - ETA: 1s - loss: 0.0872 - accuracy: 0.9735

1496/1875 [======================>.......] - ETA: 1s - loss: 0.0871 - accuracy: 0.9735

1515/1875 [=======================>......] - ETA: 1s - loss: 0.0871 - accuracy: 0.9735

1530/1875 [=======================>......] - ETA: 1s - loss: 0.0869 - accuracy: 0.9734

1547/1875 [=======================>......] - ETA: 1s - loss: 0.0867 - accuracy: 0.9735

1567/1875 [========================>.....] - ETA: 1s - loss: 0.0866 - accuracy: 0.9736

1587/1875 [========================>.....] - ETA: 1s - loss: 0.0868 - accuracy: 0.9734

1607/1875 [========================>.....] - ETA: 0s - loss: 0.0865 - accuracy: 0.9736

1627/1875 [=========================>....] - ETA: 0s - loss: 0.0866 - accuracy: 0.9735

1647/1875 [=========================>....] - ETA: 0s - loss: 0.0867 - accuracy: 0.9736

1666/1875 [=========================>....] - ETA: 0s - loss: 0.0868 - accuracy: 0.9735

1682/1875 [=========================>....] - ETA: 0s - loss: 0.0866 - accuracy: 0.9736

1699/1875 [==========================>...] - ETA: 0s - loss: 0.0864 - accuracy: 0.9736

1715/1875 [==========================>...] - ETA: 0s - loss: 0.0865 - accuracy: 0.9735

1727/1875 [==========================>...] - ETA: 0s - loss: 0.0862 - accuracy: 0.9736

1743/1875 [==========================>...] - ETA: 0s - loss: 0.0861 - accuracy: 0.9737

1759/1875 [===========================>..] - ETA: 0s - loss: 0.0858 - accuracy: 0.9738

1779/1875 [===========================>..] - ETA: 0s - loss: 0.0857 - accuracy: 0.9739

1796/1875 [===========================>..] - ETA: 0s - loss: 0.0858 - accuracy: 0.9739

1812/1875 [===========================>..] - ETA: 0s - loss: 0.0859 - accuracy: 0.9739

1830/1875 [============================>.] - ETA: 0s - loss: 0.0858 - accuracy: 0.9740

1847/1875 [============================>.] - ETA: 0s - loss: 0.0857 - accuracy: 0.9740

1868/1875 [============================>.] - ETA: 0s - loss: 0.0861 - accuracy: 0.9738

1875/1875 [==============================] - 7s 4ms/step - loss: 0.0862 - accuracy: 0.9737
Epoch 5/5
   1/1875 [..............................] - ETA: 29s - loss: 0.0282 - accuracy: 1.0000

  21/1875 [..............................] - ETA: 5s - loss: 0.0791 - accuracy: 0.9732 

  39/1875 [..............................] - ETA: 5s - loss: 0.0833 - accuracy: 0.9704

  55/1875 [..............................] - ETA: 5s - loss: 0.0811 - accuracy: 0.9733

  75/1875 [>.............................] - ETA: 5s - loss: 0.0785 - accuracy: 0.9762

  92/1875 [>.............................] - ETA: 5s - loss: 0.0778 - accuracy: 0.9769

 108/1875 [>.............................] - ETA: 5s - loss: 0.0734 - accuracy: 0.9777

 124/1875 [>.............................] - ETA: 5s - loss: 0.0737 - accuracy: 0.9776

 142/1875 [=>............................] - ETA: 5s - loss: 0.0711 - accuracy: 0.9780

 162/1875 [=>............................] - ETA: 5s - loss: 0.0705 - accuracy: 0.9788

 183/1875 [=>............................] - ETA: 5s - loss: 0.0717 - accuracy: 0.9781

 203/1875 [==>...........................] - ETA: 5s - loss: 0.0745 - accuracy: 0.9771

 222/1875 [==>...........................] - ETA: 5s - loss: 0.0739 - accuracy: 0.9771

 239/1875 [==>...........................] - ETA: 5s - loss: 0.0738 - accuracy: 0.9774

 259/1875 [===>..........................] - ETA: 5s - loss: 0.0730 - accuracy: 0.9774

 279/1875 [===>..........................] - ETA: 5s - loss: 0.0718 - accuracy: 0.9777

 294/1875 [===>..........................] - ETA: 5s - loss: 0.0718 - accuracy: 0.9779

 312/1875 [===>..........................] - ETA: 5s - loss: 0.0729 - accuracy: 0.9775

 332/1875 [====>.........................] - ETA: 5s - loss: 0.0736 - accuracy: 0.9768

 351/1875 [====>.........................] - ETA: 4s - loss: 0.0729 - accuracy: 0.9769

 371/1875 [====>.........................] - ETA: 4s - loss: 0.0725 - accuracy: 0.9769

 391/1875 [=====>........................] - ETA: 4s - loss: 0.0720 - accuracy: 0.9771

 409/1875 [=====>........................] - ETA: 4s - loss: 0.0723 - accuracy: 0.9769

 424/1875 [=====>........................] - ETA: 4s - loss: 0.0722 - accuracy: 0.9769

 442/1875 [======>.......................] - ETA: 4s - loss: 0.0728 - accuracy: 0.9765

 458/1875 [======>.......................] - ETA: 4s - loss: 0.0731 - accuracy: 0.9764

 475/1875 [======>.......................] - ETA: 4s - loss: 0.0743 - accuracy: 0.9762

 495/1875 [======>.......................] - ETA: 4s - loss: 0.0745 - accuracy: 0.9763

 513/1875 [=======>......................] - ETA: 4s - loss: 0.0749 - accuracy: 0.9762

 531/1875 [=======>......................] - ETA: 4s - loss: 0.0750 - accuracy: 0.9764

 548/1875 [=======>......................] - ETA: 4s - loss: 0.0753 - accuracy: 0.9763

 568/1875 [========>.....................] - ETA: 4s - loss: 0.0753 - accuracy: 0.9763

 588/1875 [========>.....................] - ETA: 4s - loss: 0.0748 - accuracy: 0.9762

 607/1875 [========>.....................] - ETA: 4s - loss: 0.0752 - accuracy: 0.9761

 625/1875 [=========>....................] - ETA: 4s - loss: 0.0751 - accuracy: 0.9761

 645/1875 [=========>....................] - ETA: 3s - loss: 0.0753 - accuracy: 0.9762

 665/1875 [=========>....................] - ETA: 3s - loss: 0.0751 - accuracy: 0.9761
model.evaluate(x_test, y_test, verbose=2)
313/313 - 2s - loss: 0.0738 - accuracy: 0.9786
[0.07382926344871521, 0.978600025177002]

Primeros gráficos#

Extrae datos#

import matplotlib.pyplot as plt
import pandas as pd
hist = pd.DataFrame(history.history)
hist['epoch'] = history.epoch 
hist
loss accuracy epoch
0 0.293235 0.916267 0
1 0.140098 0.958250 1
2 0.105634 0.968300 2
3 0.088549 0.972383 3
4 0.076502 0.976267 4

Pérdida#

plt.figure()
plt.xlabel('Epoca')
plt.ylabel('Loss: Entropía cruzada')
plt.plot(hist['epoch'], hist['loss'],
           label='Error en entrenamiento')
plt.ylim([0,0.5])
plt.legend()
plt.show()
../../_images/Intro_Keras_Sequential_21_0.png

Exactitud#

plt.figure()
plt.xlabel('Epoca')
plt.ylabel('Exactitud')
plt.plot(hist['epoch'], hist['accuracy'],
           label='Exactitud en entrenamiento')
plt.ylim([0.9,1])
plt.legend()
plt.show()
../../_images/Intro_Keras_Sequential_23_0.png