Symulowanie-wizualne/sw_lab8.ipynb
2022-12-10 11:12:06 +01:00

216 KiB

Zadanie 8 - Alexnet + Dropout & BatchRegularization

Aleksandra Jonas, Aleksandra Gronowska, Iwona Christop

Przygotowanie danych

from IPython.display import Image, display
import sys
import subprocess
import pkg_resources
import numpy as np

required = { 'scikit-image'}
installed = {pkg.key for pkg in pkg_resources.working_set}
missing = required - installed
# Alexnet requires images to be of dim = (227, 227, 3)
newSize = (227,227)

if missing: 
    python = sys.executable
    subprocess.check_call([python, '-m', 'pip', 'install', *missing], stdout=subprocess.DEVNULL)

def load_train_data(input_dir):
    import numpy as np
    import pandas as pd
    import os
    from skimage.io import imread
    import cv2 as cv
    from pathlib import Path
    import random
    from shutil import copyfile, rmtree
    import json

    import seaborn as sns
    import matplotlib.pyplot as plt

    import matplotlib
    
    image_dir = Path(input_dir)
    categories_name = []
    for file in os.listdir(image_dir):
        d = os.path.join(image_dir, file)
        if os.path.isdir(d):
            categories_name.append(file)

    folders = [directory for directory in image_dir.iterdir() if directory.is_dir()]

    train_img = []
    categories_count=[]
    labels=[]
    for i, direc in enumerate(folders):
        count = 0
        for obj in direc.iterdir():
            if os.path.isfile(obj) and os.path.basename(os.path.normpath(obj)) != 'desktop.ini':
                labels.append(os.path.basename(os.path.normpath(direc)))
                count += 1
                img = imread(obj)#zwraca ndarry postaci xSize x ySize x colorDepth
                img = img[:, :, :3]
                img = cv.resize(img, newSize, interpolation=cv.INTER_AREA)# zwraca ndarray
                img = img / 255 #normalizacja
                train_img.append(img)
        categories_count.append(count)
    X={}
    X["values"] = np.array(train_img)
    X["categories_name"] = categories_name
    X["categories_count"] = categories_count
    X["labels"]=labels
    return X

def load_test_data(input_dir):
    import numpy as np
    import pandas as pd
    import os
    from skimage.io import imread
    import cv2 as cv
    from pathlib import Path
    import random
    from shutil import copyfile, rmtree
    import json

    import seaborn as sns
    import matplotlib.pyplot as plt

    import matplotlib

    image_path = Path(input_dir)

    labels_path = image_path.parents[0] / 'test_labels.json'

    jsonString = labels_path.read_text()
    objects = json.loads(jsonString)

    categories_name = []
    categories_count=[]
    count = 0
    c = objects[0]['value']
    for e in  objects:
        if e['value'] != c:
            categories_count.append(count)
            c = e['value']
            count = 1
        else:
            count += 1
        if not e['value'] in categories_name:
            categories_name.append(e['value'])

    categories_count.append(count)
    
    test_img = []

    labels=[]
    for e in objects:
        p = image_path / e['filename']
        img = imread(p)#zwraca ndarry postaci xSize x ySize x colorDepth
        img = img[:, :, :3]
        img = cv.resize(img, newSize, interpolation=cv.INTER_AREA)# zwraca ndarray
        img = img / 255#normalizacja
        test_img.append(img)
        labels.append(e['value'])

    X={}
    X["values"] = np.array(test_img)
    X["categories_name"] = categories_name
    X["categories_count"] = categories_count
    X["labels"]=labels
    return X
# Data load
data_train = load_train_data("./train_test_sw/train_sw")
values_train = data_train['values']
labels_train = data_train['labels']

data_test = load_test_data("./train_test_sw/test_sw")
X_test = data_test['values']
y_test = data_test['labels']
from sklearn.model_selection import train_test_split
X_train, X_validate, y_train, y_validate = train_test_split(values_train, labels_train, test_size=0.2, random_state=42)
from sklearn.preprocessing import LabelEncoder
class_le = LabelEncoder()
y_train_enc = class_le.fit_transform(y_train)
y_validate_enc = class_le.fit_transform(y_validate)
y_test_enc = class_le.fit_transform(y_test)
import tensorflow as tf
train_ds = tf.data.Dataset.from_tensor_slices((X_train, y_train_enc))
validation_ds = tf.data.Dataset.from_tensor_slices((X_validate, y_validate_enc))
test_ds = tf.data.Dataset.from_tensor_slices((X_test, y_test_enc))
train_ds_size = tf.data.experimental.cardinality(train_ds).numpy()
test_ds_size = tf.data.experimental.cardinality(test_ds).numpy()
validation_ds_size = tf.data.experimental.cardinality(validation_ds).numpy()
print("Training data size:", train_ds_size)
print("Test data size:", test_ds_size)
print("Validation data size:", validation_ds_size)
Training data size: 820
Test data size: 259
Validation data size: 206
train_ds = (train_ds
                  .shuffle(buffer_size=train_ds_size)
                  .batch(batch_size=32, drop_remainder=True))
test_ds = (test_ds
                  .shuffle(buffer_size=train_ds_size)
                  .batch(batch_size=32, drop_remainder=True))
validation_ds = (validation_ds
                  .shuffle(buffer_size=train_ds_size)
                  .batch(batch_size=32, drop_remainder=True))
from tensorflow import keras
import os
import time
root_logdir = os.path.join(os.curdir, "logs\\\\fit\\\\")
def get_run_logdir():
    run_id = time.strftime("run_%Y_%m_%d-%H_%M_%S")
    return os.path.join(root_logdir, run_id)
run_logdir = get_run_logdir()
tensorboard_cb = keras.callbacks.TensorBoard(run_logdir)

Dropout

Do warstw spłaszczonych

model_flat_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(10, activation='softmax')
])
model_flat_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_flat_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d (Conv2D)             (None, 55, 55, 96)        34944     
                                                                 
 max_pooling2d (MaxPooling2D  (None, 27, 27, 96)       0         
 )                                                               
                                                                 
 conv2d_1 (Conv2D)           (None, 27, 27, 256)       614656    
                                                                 
 max_pooling2d_1 (MaxPooling  (None, 13, 13, 256)      0         
 2D)                                                             
                                                                 
 conv2d_2 (Conv2D)           (None, 13, 13, 384)       885120    
                                                                 
 conv2d_3 (Conv2D)           (None, 13, 13, 384)       1327488   
                                                                 
 conv2d_4 (Conv2D)           (None, 13, 13, 256)       884992    
                                                                 
 max_pooling2d_2 (MaxPooling  (None, 6, 6, 256)        0         
 2D)                                                             
                                                                 
 flatten (Flatten)           (None, 9216)              0         
                                                                 
 dense (Dense)               (None, 4096)              37752832  
                                                                 
 dropout (Dropout)           (None, 4096)              0         
                                                                 
 dense_1 (Dense)             (None, 4096)              16781312  
                                                                 
 dropout_1 (Dropout)         (None, 4096)              0         
                                                                 
 dense_2 (Dense)             (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_flat_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 39s 1s/step - loss: 2.2584 - accuracy: 0.2000 - val_loss: 2.1890 - val_accuracy: 0.3073
Epoch 2/100
25/25 [==============================] - 33s 1s/step - loss: 1.9739 - accuracy: 0.2275 - val_loss: 1.6961 - val_accuracy: 0.1875
Epoch 3/100
25/25 [==============================] - 33s 1s/step - loss: 1.6904 - accuracy: 0.2288 - val_loss: 1.6021 - val_accuracy: 0.2604
Epoch 4/100
25/25 [==============================] - 34s 1s/step - loss: 1.6571 - accuracy: 0.2138 - val_loss: 1.5939 - val_accuracy: 0.3333
Epoch 5/100
25/25 [==============================] - 34s 1s/step - loss: 1.6340 - accuracy: 0.2400 - val_loss: 1.5403 - val_accuracy: 0.3438
Epoch 6/100
25/25 [==============================] - 34s 1s/step - loss: 1.6254 - accuracy: 0.2650 - val_loss: 1.5925 - val_accuracy: 0.2917
Epoch 7/100
25/25 [==============================] - 34s 1s/step - loss: 1.6075 - accuracy: 0.2600 - val_loss: 1.5318 - val_accuracy: 0.3698
Epoch 8/100
25/25 [==============================] - 34s 1s/step - loss: 1.5569 - accuracy: 0.3338 - val_loss: 1.5195 - val_accuracy: 0.4167
Epoch 9/100
25/25 [==============================] - 34s 1s/step - loss: 1.5345 - accuracy: 0.3425 - val_loss: 1.5741 - val_accuracy: 0.2917
Epoch 10/100
25/25 [==============================] - 34s 1s/step - loss: 1.5055 - accuracy: 0.3500 - val_loss: 1.3982 - val_accuracy: 0.4115
Epoch 11/100
25/25 [==============================] - 34s 1s/step - loss: 1.4744 - accuracy: 0.3600 - val_loss: 1.5340 - val_accuracy: 0.3854
Epoch 12/100
25/25 [==============================] - 34s 1s/step - loss: 1.4548 - accuracy: 0.3913 - val_loss: 1.4387 - val_accuracy: 0.4115
Epoch 13/100
25/25 [==============================] - 34s 1s/step - loss: 1.4088 - accuracy: 0.4038 - val_loss: 1.4665 - val_accuracy: 0.4323
Epoch 14/100
25/25 [==============================] - 34s 1s/step - loss: 1.3404 - accuracy: 0.4437 - val_loss: 1.3196 - val_accuracy: 0.5052
Epoch 15/100
25/25 [==============================] - 37s 1s/step - loss: 1.3122 - accuracy: 0.4512 - val_loss: 1.2624 - val_accuracy: 0.5052
Epoch 16/100
25/25 [==============================] - 37s 1s/step - loss: 1.2144 - accuracy: 0.4925 - val_loss: 1.1976 - val_accuracy: 0.5521
Epoch 17/100
25/25 [==============================] - 36s 1s/step - loss: 1.1543 - accuracy: 0.5000 - val_loss: 1.1166 - val_accuracy: 0.5104
Epoch 18/100
25/25 [==============================] - 34s 1s/step - loss: 1.1334 - accuracy: 0.5100 - val_loss: 1.3203 - val_accuracy: 0.4635
Epoch 19/100
25/25 [==============================] - 34s 1s/step - loss: 1.1212 - accuracy: 0.5288 - val_loss: 1.1281 - val_accuracy: 0.5208
Epoch 20/100
25/25 [==============================] - 34s 1s/step - loss: 1.0779 - accuracy: 0.5250 - val_loss: 1.1841 - val_accuracy: 0.5365
Epoch 21/100
25/25 [==============================] - 35s 1s/step - loss: 1.0472 - accuracy: 0.5300 - val_loss: 1.0747 - val_accuracy: 0.5677
Epoch 22/100
25/25 [==============================] - 32s 1s/step - loss: 1.0487 - accuracy: 0.5337 - val_loss: 1.1981 - val_accuracy: 0.5312
Epoch 23/100
25/25 [==============================] - 35s 1s/step - loss: 1.0377 - accuracy: 0.5288 - val_loss: 1.1231 - val_accuracy: 0.5312
Epoch 24/100
25/25 [==============================] - 34s 1s/step - loss: 1.0117 - accuracy: 0.5600 - val_loss: 1.1580 - val_accuracy: 0.5208
Epoch 25/100
25/25 [==============================] - 33s 1s/step - loss: 0.9578 - accuracy: 0.5813 - val_loss: 1.1586 - val_accuracy: 0.5052
Epoch 26/100
25/25 [==============================] - 34s 1s/step - loss: 0.9469 - accuracy: 0.5913 - val_loss: 1.0026 - val_accuracy: 0.5625
Epoch 27/100
25/25 [==============================] - 33s 1s/step - loss: 0.9810 - accuracy: 0.5600 - val_loss: 0.9896 - val_accuracy: 0.5781
Epoch 28/100
25/25 [==============================] - 34s 1s/step - loss: 0.9239 - accuracy: 0.5825 - val_loss: 1.3049 - val_accuracy: 0.5312
Epoch 29/100
25/25 [==============================] - 36s 1s/step - loss: 0.9495 - accuracy: 0.5625 - val_loss: 0.9832 - val_accuracy: 0.5990
Epoch 30/100
25/25 [==============================] - 37s 1s/step - loss: 0.9322 - accuracy: 0.5725 - val_loss: 1.0204 - val_accuracy: 0.5677
Epoch 31/100
25/25 [==============================] - 36s 1s/step - loss: 0.9098 - accuracy: 0.5925 - val_loss: 1.0027 - val_accuracy: 0.5208
Epoch 32/100
25/25 [==============================] - 36s 1s/step - loss: 0.9288 - accuracy: 0.6050 - val_loss: 1.0639 - val_accuracy: 0.5625
Epoch 33/100
25/25 [==============================] - 37s 1s/step - loss: 0.8865 - accuracy: 0.6000 - val_loss: 0.9128 - val_accuracy: 0.6250
Epoch 34/100
25/25 [==============================] - 37s 1s/step - loss: 0.8653 - accuracy: 0.6137 - val_loss: 0.9095 - val_accuracy: 0.6146
Epoch 35/100
25/25 [==============================] - 39s 2s/step - loss: 0.8462 - accuracy: 0.6250 - val_loss: 1.0470 - val_accuracy: 0.5625
Epoch 36/100
25/25 [==============================] - 38s 2s/step - loss: 0.8485 - accuracy: 0.6012 - val_loss: 1.0561 - val_accuracy: 0.5312
Epoch 37/100
25/25 [==============================] - 34s 1s/step - loss: 0.8349 - accuracy: 0.6363 - val_loss: 0.9282 - val_accuracy: 0.6198
Epoch 38/100
25/25 [==============================] - 34s 1s/step - loss: 0.8450 - accuracy: 0.6137 - val_loss: 0.9833 - val_accuracy: 0.5885
Epoch 39/100
25/25 [==============================] - 34s 1s/step - loss: 0.8209 - accuracy: 0.6288 - val_loss: 1.0049 - val_accuracy: 0.5729
Epoch 40/100
25/25 [==============================] - 34s 1s/step - loss: 0.8213 - accuracy: 0.6237 - val_loss: 0.8432 - val_accuracy: 0.6406
Epoch 41/100
25/25 [==============================] - 36s 1s/step - loss: 0.7931 - accuracy: 0.6413 - val_loss: 1.0859 - val_accuracy: 0.5469
Epoch 42/100
25/25 [==============================] - 34s 1s/step - loss: 0.7652 - accuracy: 0.6612 - val_loss: 0.9302 - val_accuracy: 0.6094
Epoch 43/100
25/25 [==============================] - 34s 1s/step - loss: 0.7603 - accuracy: 0.6562 - val_loss: 0.8186 - val_accuracy: 0.6458
Epoch 44/100
25/25 [==============================] - 34s 1s/step - loss: 0.7221 - accuracy: 0.7125 - val_loss: 0.9047 - val_accuracy: 0.6458
Epoch 45/100
25/25 [==============================] - 33s 1s/step - loss: 0.7501 - accuracy: 0.6675 - val_loss: 0.8114 - val_accuracy: 0.6562
Epoch 46/100
25/25 [==============================] - 34s 1s/step - loss: 0.7169 - accuracy: 0.6925 - val_loss: 0.6990 - val_accuracy: 0.7031
Epoch 47/100
25/25 [==============================] - 35s 1s/step - loss: 0.6610 - accuracy: 0.7212 - val_loss: 0.7242 - val_accuracy: 0.6927
Epoch 48/100
25/25 [==============================] - 34s 1s/step - loss: 0.6846 - accuracy: 0.7075 - val_loss: 0.8100 - val_accuracy: 0.6510
Epoch 49/100
25/25 [==============================] - 35s 1s/step - loss: 0.6308 - accuracy: 0.7300 - val_loss: 0.7077 - val_accuracy: 0.6771
Epoch 50/100
25/25 [==============================] - 36s 1s/step - loss: 0.5996 - accuracy: 0.7425 - val_loss: 0.6889 - val_accuracy: 0.7031
Epoch 51/100
25/25 [==============================] - 36s 1s/step - loss: 0.6341 - accuracy: 0.7575 - val_loss: 0.6953 - val_accuracy: 0.7344
Epoch 52/100
25/25 [==============================] - 36s 1s/step - loss: 0.5816 - accuracy: 0.7525 - val_loss: 0.6998 - val_accuracy: 0.7031
Epoch 53/100
25/25 [==============================] - 36s 1s/step - loss: 0.5872 - accuracy: 0.7650 - val_loss: 0.7242 - val_accuracy: 0.7188
Epoch 54/100
25/25 [==============================] - 36s 1s/step - loss: 0.5597 - accuracy: 0.7812 - val_loss: 0.8982 - val_accuracy: 0.6719
Epoch 55/100
25/25 [==============================] - 38s 2s/step - loss: 0.5644 - accuracy: 0.7825 - val_loss: 0.6864 - val_accuracy: 0.7396
Epoch 56/100
25/25 [==============================] - 36s 1s/step - loss: 0.5228 - accuracy: 0.7763 - val_loss: 0.6602 - val_accuracy: 0.7031
Epoch 57/100
25/25 [==============================] - 35s 1s/step - loss: 0.4987 - accuracy: 0.7887 - val_loss: 0.6512 - val_accuracy: 0.7812
Epoch 58/100
25/25 [==============================] - 35s 1s/step - loss: 0.5320 - accuracy: 0.7862 - val_loss: 0.6612 - val_accuracy: 0.7604
Epoch 59/100
25/25 [==============================] - 33s 1s/step - loss: 0.5273 - accuracy: 0.7775 - val_loss: 0.6148 - val_accuracy: 0.7708
Epoch 60/100
25/25 [==============================] - 34s 1s/step - loss: 0.5277 - accuracy: 0.7875 - val_loss: 0.6853 - val_accuracy: 0.7448
Epoch 61/100
25/25 [==============================] - 34s 1s/step - loss: 0.4958 - accuracy: 0.7975 - val_loss: 0.7478 - val_accuracy: 0.7188
Epoch 62/100
25/25 [==============================] - 36s 1s/step - loss: 0.4867 - accuracy: 0.7900 - val_loss: 0.5890 - val_accuracy: 0.7188
Epoch 63/100
25/25 [==============================] - 34s 1s/step - loss: 0.4677 - accuracy: 0.8050 - val_loss: 0.7454 - val_accuracy: 0.6927
Epoch 64/100
25/25 [==============================] - 33s 1s/step - loss: 0.4793 - accuracy: 0.8225 - val_loss: 0.6097 - val_accuracy: 0.7656
Epoch 65/100
25/25 [==============================] - 34s 1s/step - loss: 0.4755 - accuracy: 0.8188 - val_loss: 0.6033 - val_accuracy: 0.7604
Epoch 66/100
25/25 [==============================] - 33s 1s/step - loss: 0.4239 - accuracy: 0.8263 - val_loss: 0.6168 - val_accuracy: 0.7865
Epoch 67/100
25/25 [==============================] - 33s 1s/step - loss: 0.4531 - accuracy: 0.8200 - val_loss: 0.5624 - val_accuracy: 0.7812
Epoch 68/100
25/25 [==============================] - 33s 1s/step - loss: 0.4397 - accuracy: 0.8388 - val_loss: 0.5696 - val_accuracy: 0.8229
Epoch 69/100
25/25 [==============================] - 33s 1s/step - loss: 0.4543 - accuracy: 0.8087 - val_loss: 0.6307 - val_accuracy: 0.7865
Epoch 70/100
25/25 [==============================] - 37s 1s/step - loss: 0.3984 - accuracy: 0.8438 - val_loss: 0.6143 - val_accuracy: 0.8125
Epoch 71/100
25/25 [==============================] - 36s 1s/step - loss: 0.3903 - accuracy: 0.8525 - val_loss: 0.6269 - val_accuracy: 0.7656
Epoch 72/100
25/25 [==============================] - 34s 1s/step - loss: 0.3671 - accuracy: 0.8525 - val_loss: 0.5292 - val_accuracy: 0.7917
Epoch 73/100
25/25 [==============================] - 33s 1s/step - loss: 0.4349 - accuracy: 0.8175 - val_loss: 0.6612 - val_accuracy: 0.7552
Epoch 74/100
25/25 [==============================] - 33s 1s/step - loss: 0.3605 - accuracy: 0.8712 - val_loss: 0.8456 - val_accuracy: 0.6615
Epoch 75/100
25/25 [==============================] - 34s 1s/step - loss: 0.4310 - accuracy: 0.8300 - val_loss: 0.6901 - val_accuracy: 0.7344
Epoch 76/100
25/25 [==============================] - 35s 1s/step - loss: 0.4062 - accuracy: 0.8263 - val_loss: 0.5469 - val_accuracy: 0.8021
Epoch 77/100
25/25 [==============================] - 34s 1s/step - loss: 0.3645 - accuracy: 0.8612 - val_loss: 0.5918 - val_accuracy: 0.7656
Epoch 78/100
25/25 [==============================] - 33s 1s/step - loss: 0.3444 - accuracy: 0.8600 - val_loss: 0.5622 - val_accuracy: 0.7969
Epoch 79/100
25/25 [==============================] - 34s 1s/step - loss: 0.3611 - accuracy: 0.8562 - val_loss: 0.6412 - val_accuracy: 0.7760
Epoch 80/100
25/25 [==============================] - 33s 1s/step - loss: 0.3853 - accuracy: 0.8475 - val_loss: 0.6283 - val_accuracy: 0.7969
Epoch 81/100
25/25 [==============================] - 35s 1s/step - loss: 0.3076 - accuracy: 0.8763 - val_loss: 0.6677 - val_accuracy: 0.7500
Epoch 82/100
25/25 [==============================] - 37s 1s/step - loss: 0.3204 - accuracy: 0.8813 - val_loss: 0.6045 - val_accuracy: 0.7865
Epoch 83/100
25/25 [==============================] - 34s 1s/step - loss: 0.3183 - accuracy: 0.8763 - val_loss: 0.6581 - val_accuracy: 0.8281
Epoch 84/100
25/25 [==============================] - 34s 1s/step - loss: 0.2913 - accuracy: 0.8863 - val_loss: 0.6067 - val_accuracy: 0.8073
Epoch 85/100
25/25 [==============================] - 34s 1s/step - loss: 0.3194 - accuracy: 0.8662 - val_loss: 0.6241 - val_accuracy: 0.8281
Epoch 86/100
25/25 [==============================] - 33s 1s/step - loss: 0.4045 - accuracy: 0.8487 - val_loss: 0.6254 - val_accuracy: 0.8073
Epoch 87/100
25/25 [==============================] - 35s 1s/step - loss: 0.2853 - accuracy: 0.8863 - val_loss: 0.6204 - val_accuracy: 0.7917
Epoch 88/100
25/25 [==============================] - 36s 1s/step - loss: 0.2844 - accuracy: 0.8737 - val_loss: 0.5187 - val_accuracy: 0.8177
Epoch 89/100
25/25 [==============================] - 34s 1s/step - loss: 0.2622 - accuracy: 0.8913 - val_loss: 0.7985 - val_accuracy: 0.7656
Epoch 90/100
25/25 [==============================] - 33s 1s/step - loss: 0.3699 - accuracy: 0.8550 - val_loss: 0.5994 - val_accuracy: 0.7917
Epoch 91/100
25/25 [==============================] - 33s 1s/step - loss: 0.3292 - accuracy: 0.8800 - val_loss: 0.5560 - val_accuracy: 0.8125
Epoch 92/100
25/25 [==============================] - 33s 1s/step - loss: 0.2759 - accuracy: 0.8913 - val_loss: 0.5550 - val_accuracy: 0.8229
Epoch 93/100
25/25 [==============================] - 35s 1s/step - loss: 0.3063 - accuracy: 0.8788 - val_loss: 0.6402 - val_accuracy: 0.8125
Epoch 94/100
25/25 [==============================] - 36s 1s/step - loss: 0.2841 - accuracy: 0.8863 - val_loss: 0.6440 - val_accuracy: 0.7760
Epoch 95/100
25/25 [==============================] - 37s 1s/step - loss: 0.2735 - accuracy: 0.8938 - val_loss: 0.6554 - val_accuracy: 0.8281
Epoch 96/100
25/25 [==============================] - 34s 1s/step - loss: 0.2625 - accuracy: 0.9025 - val_loss: 0.7760 - val_accuracy: 0.7240
Epoch 97/100
25/25 [==============================] - 34s 1s/step - loss: 0.2929 - accuracy: 0.8712 - val_loss: 0.5337 - val_accuracy: 0.8125
Epoch 98/100
25/25 [==============================] - 34s 1s/step - loss: 0.3274 - accuracy: 0.8838 - val_loss: 0.5662 - val_accuracy: 0.8021
Epoch 99/100
25/25 [==============================] - 34s 1s/step - loss: 0.2644 - accuracy: 0.8800 - val_loss: 0.5249 - val_accuracy: 0.8333
Epoch 100/100
25/25 [==============================] - 33s 1s/step - loss: 0.2609 - accuracy: 0.8950 - val_loss: 0.5722 - val_accuracy: 0.8281
<keras.callbacks.History at 0x2b047d192b0>
model_flat_drop.evaluate(test_ds)
8/8 [==============================] - 8s 256ms/step - loss: 0.5354 - accuracy: 0.8008
[0.535420835018158, 0.80078125]

Do warstw maxpooling

model_pool_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])
model_pool_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_pool_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_1"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_5 (Conv2D)           (None, 55, 55, 96)        34944     
                                                                 
 max_pooling2d_3 (MaxPooling  (None, 27, 27, 96)       0         
 2D)                                                             
                                                                 
 dropout_2 (Dropout)         (None, 27, 27, 96)        0         
                                                                 
 conv2d_6 (Conv2D)           (None, 27, 27, 256)       614656    
                                                                 
 max_pooling2d_4 (MaxPooling  (None, 13, 13, 256)      0         
 2D)                                                             
                                                                 
 dropout_3 (Dropout)         (None, 13, 13, 256)       0         
                                                                 
 conv2d_7 (Conv2D)           (None, 13, 13, 384)       885120    
                                                                 
 conv2d_8 (Conv2D)           (None, 13, 13, 384)       1327488   
                                                                 
 conv2d_9 (Conv2D)           (None, 13, 13, 256)       884992    
                                                                 
 max_pooling2d_5 (MaxPooling  (None, 6, 6, 256)        0         
 2D)                                                             
                                                                 
 dropout_4 (Dropout)         (None, 6, 6, 256)         0         
                                                                 
 flatten_1 (Flatten)         (None, 9216)              0         
                                                                 
 dense_3 (Dense)             (None, 4096)              37752832  
                                                                 
 dense_4 (Dense)             (None, 4096)              16781312  
                                                                 
 dense_5 (Dense)             (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_pool_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 38s 1s/step - loss: 2.1540 - accuracy: 0.1675 - val_loss: 2.0134 - val_accuracy: 0.1979
Epoch 2/100
25/25 [==============================] - 37s 1s/step - loss: 1.6939 - accuracy: 0.2037 - val_loss: 1.7293 - val_accuracy: 0.1875
Epoch 3/100
25/25 [==============================] - 35s 1s/step - loss: 1.6265 - accuracy: 0.2512 - val_loss: 1.7483 - val_accuracy: 0.2031
Epoch 4/100
25/25 [==============================] - 34s 1s/step - loss: 1.6241 - accuracy: 0.2463 - val_loss: 1.7277 - val_accuracy: 0.2135
Epoch 5/100
25/25 [==============================] - 34s 1s/step - loss: 1.6075 - accuracy: 0.2675 - val_loss: 1.6551 - val_accuracy: 0.2292
Epoch 6/100
25/25 [==============================] - 34s 1s/step - loss: 1.5647 - accuracy: 0.3025 - val_loss: 1.6350 - val_accuracy: 0.4219
Epoch 7/100
25/25 [==============================] - 36s 1s/step - loss: 1.5461 - accuracy: 0.2937 - val_loss: 1.6199 - val_accuracy: 0.2812
Epoch 8/100
25/25 [==============================] - 36s 1s/step - loss: 1.5298 - accuracy: 0.3250 - val_loss: 1.6913 - val_accuracy: 0.3594
Epoch 9/100
25/25 [==============================] - 34s 1s/step - loss: 1.4970 - accuracy: 0.3338 - val_loss: 1.6024 - val_accuracy: 0.4167
Epoch 10/100
25/25 [==============================] - 34s 1s/step - loss: 1.4647 - accuracy: 0.3625 - val_loss: 1.6006 - val_accuracy: 0.3646
Epoch 11/100
25/25 [==============================] - 34s 1s/step - loss: 1.4492 - accuracy: 0.3925 - val_loss: 1.6130 - val_accuracy: 0.3542
Epoch 12/100
25/25 [==============================] - 34s 1s/step - loss: 1.3774 - accuracy: 0.4112 - val_loss: 1.6229 - val_accuracy: 0.3646
Epoch 13/100
25/25 [==============================] - 35s 1s/step - loss: 1.3320 - accuracy: 0.4375 - val_loss: 1.5338 - val_accuracy: 0.4219
Epoch 14/100
25/25 [==============================] - 37s 1s/step - loss: 1.3045 - accuracy: 0.4412 - val_loss: 1.4971 - val_accuracy: 0.3802
Epoch 15/100
25/25 [==============================] - 36s 1s/step - loss: 1.2122 - accuracy: 0.4938 - val_loss: 1.5767 - val_accuracy: 0.4271
Epoch 16/100
25/25 [==============================] - 34s 1s/step - loss: 1.2045 - accuracy: 0.5038 - val_loss: 1.3564 - val_accuracy: 0.4583
Epoch 17/100
25/25 [==============================] - 34s 1s/step - loss: 1.1888 - accuracy: 0.5050 - val_loss: 1.3598 - val_accuracy: 0.4323
Epoch 18/100
25/25 [==============================] - 32s 1s/step - loss: 1.1004 - accuracy: 0.5400 - val_loss: 1.3798 - val_accuracy: 0.4010
Epoch 19/100
25/25 [==============================] - 35s 1s/step - loss: 1.1161 - accuracy: 0.5138 - val_loss: 1.4139 - val_accuracy: 0.4688
Epoch 20/100
25/25 [==============================] - 36s 1s/step - loss: 1.1024 - accuracy: 0.5300 - val_loss: 1.3807 - val_accuracy: 0.4115
Epoch 21/100
25/25 [==============================] - 34s 1s/step - loss: 1.0852 - accuracy: 0.5350 - val_loss: 1.2784 - val_accuracy: 0.4688
Epoch 22/100
25/25 [==============================] - 34s 1s/step - loss: 0.9935 - accuracy: 0.5500 - val_loss: 1.0615 - val_accuracy: 0.5260
Epoch 23/100
25/25 [==============================] - 34s 1s/step - loss: 1.0719 - accuracy: 0.5300 - val_loss: 1.6332 - val_accuracy: 0.4479
Epoch 24/100
25/25 [==============================] - 34s 1s/step - loss: 0.9728 - accuracy: 0.5625 - val_loss: 1.3436 - val_accuracy: 0.4531
Epoch 25/100
25/25 [==============================] - 35s 1s/step - loss: 0.9514 - accuracy: 0.5788 - val_loss: 1.1052 - val_accuracy: 0.4792
Epoch 26/100
25/25 [==============================] - 36s 1s/step - loss: 1.0354 - accuracy: 0.5437 - val_loss: 1.2274 - val_accuracy: 0.4896
Epoch 27/100
25/25 [==============================] - 38s 1s/step - loss: 0.9764 - accuracy: 0.5675 - val_loss: 1.2700 - val_accuracy: 0.4531
Epoch 28/100
25/25 [==============================] - 35s 1s/step - loss: 0.9111 - accuracy: 0.5800 - val_loss: 1.3311 - val_accuracy: 0.4792
Epoch 29/100
25/25 [==============================] - 35s 1s/step - loss: 0.8978 - accuracy: 0.5987 - val_loss: 1.2087 - val_accuracy: 0.5208
Epoch 30/100
25/25 [==============================] - 34s 1s/step - loss: 0.9541 - accuracy: 0.5913 - val_loss: 1.0234 - val_accuracy: 0.5885
Epoch 31/100
25/25 [==============================] - 34s 1s/step - loss: 0.9083 - accuracy: 0.6000 - val_loss: 1.1497 - val_accuracy: 0.4844
Epoch 32/100
25/25 [==============================] - 34s 1s/step - loss: 0.8709 - accuracy: 0.6263 - val_loss: 0.9774 - val_accuracy: 0.6146
Epoch 33/100
25/25 [==============================] - 34s 1s/step - loss: 0.8831 - accuracy: 0.6400 - val_loss: 1.3298 - val_accuracy: 0.4635
Epoch 34/100
25/25 [==============================] - 37s 1s/step - loss: 0.9105 - accuracy: 0.6000 - val_loss: 1.0325 - val_accuracy: 0.5312
Epoch 35/100
25/25 [==============================] - 34s 1s/step - loss: 0.8981 - accuracy: 0.6225 - val_loss: 0.9792 - val_accuracy: 0.5833
Epoch 36/100
25/25 [==============================] - 34s 1s/step - loss: 0.8302 - accuracy: 0.6325 - val_loss: 1.0503 - val_accuracy: 0.5417
Epoch 37/100
25/25 [==============================] - 34s 1s/step - loss: 0.8196 - accuracy: 0.6450 - val_loss: 1.1518 - val_accuracy: 0.5208
Epoch 38/100
25/25 [==============================] - 34s 1s/step - loss: 0.7978 - accuracy: 0.6450 - val_loss: 1.0733 - val_accuracy: 0.5521
Epoch 39/100
25/25 [==============================] - 36s 1s/step - loss: 0.8764 - accuracy: 0.6200 - val_loss: 1.1687 - val_accuracy: 0.5521
Epoch 40/100
25/25 [==============================] - 35s 1s/step - loss: 0.8347 - accuracy: 0.6350 - val_loss: 0.9538 - val_accuracy: 0.5521
Epoch 41/100
25/25 [==============================] - 34s 1s/step - loss: 0.7740 - accuracy: 0.6600 - val_loss: 0.9828 - val_accuracy: 0.5573
Epoch 42/100
25/25 [==============================] - 34s 1s/step - loss: 0.7792 - accuracy: 0.6575 - val_loss: 0.9347 - val_accuracy: 0.6146
Epoch 43/100
25/25 [==============================] - 34s 1s/step - loss: 0.7643 - accuracy: 0.6637 - val_loss: 1.0073 - val_accuracy: 0.5521
Epoch 44/100
25/25 [==============================] - 34s 1s/step - loss: 0.8491 - accuracy: 0.6300 - val_loss: 0.9072 - val_accuracy: 0.5781
Epoch 45/100
25/25 [==============================] - 36s 1s/step - loss: 0.7689 - accuracy: 0.6662 - val_loss: 0.9700 - val_accuracy: 0.5885
Epoch 46/100
25/25 [==============================] - 35s 1s/step - loss: 0.7808 - accuracy: 0.6762 - val_loss: 0.8849 - val_accuracy: 0.5885
Epoch 47/100
25/25 [==============================] - 34s 1s/step - loss: 0.7912 - accuracy: 0.6700 - val_loss: 0.9794 - val_accuracy: 0.5938
Epoch 48/100
25/25 [==============================] - 35s 1s/step - loss: 0.7140 - accuracy: 0.6900 - val_loss: 1.0859 - val_accuracy: 0.5156
Epoch 49/100
25/25 [==============================] - 34s 1s/step - loss: 0.7231 - accuracy: 0.6812 - val_loss: 0.9919 - val_accuracy: 0.5312
Epoch 50/100
25/25 [==============================] - 34s 1s/step - loss: 0.7164 - accuracy: 0.6775 - val_loss: 0.8754 - val_accuracy: 0.5938
Epoch 51/100
25/25 [==============================] - 36s 1s/step - loss: 0.6902 - accuracy: 0.7000 - val_loss: 0.7496 - val_accuracy: 0.6667
Epoch 52/100
25/25 [==============================] - 35s 1s/step - loss: 0.6941 - accuracy: 0.6950 - val_loss: 0.8111 - val_accuracy: 0.6406
Epoch 53/100
25/25 [==============================] - 34s 1s/step - loss: 0.6511 - accuracy: 0.6963 - val_loss: 0.9502 - val_accuracy: 0.5365
Epoch 54/100
25/25 [==============================] - 34s 1s/step - loss: 0.7010 - accuracy: 0.6775 - val_loss: 1.1635 - val_accuracy: 0.5156
Epoch 55/100
25/25 [==============================] - 34s 1s/step - loss: 0.6365 - accuracy: 0.7063 - val_loss: 0.7768 - val_accuracy: 0.6615
Epoch 56/100
25/25 [==============================] - 34s 1s/step - loss: 0.6422 - accuracy: 0.7138 - val_loss: 0.8124 - val_accuracy: 0.6667
Epoch 57/100
25/25 [==============================] - 36s 1s/step - loss: 0.6389 - accuracy: 0.7050 - val_loss: 0.7729 - val_accuracy: 0.6719
Epoch 58/100
25/25 [==============================] - 34s 1s/step - loss: 0.6144 - accuracy: 0.7312 - val_loss: 1.0041 - val_accuracy: 0.5312
Epoch 59/100
25/25 [==============================] - 34s 1s/step - loss: 0.7239 - accuracy: 0.6963 - val_loss: 0.8224 - val_accuracy: 0.6510
Epoch 60/100
25/25 [==============================] - 34s 1s/step - loss: 0.6382 - accuracy: 0.7000 - val_loss: 0.6888 - val_accuracy: 0.6823
Epoch 61/100
25/25 [==============================] - 34s 1s/step - loss: 0.6108 - accuracy: 0.7225 - val_loss: 0.6762 - val_accuracy: 0.6823
Epoch 62/100
25/25 [==============================] - 37s 1s/step - loss: 0.5994 - accuracy: 0.7412 - val_loss: 0.8999 - val_accuracy: 0.5573
Epoch 63/100
25/25 [==============================] - 35s 1s/step - loss: 0.5431 - accuracy: 0.7487 - val_loss: 0.7129 - val_accuracy: 0.6771
Epoch 64/100
25/25 [==============================] - 35s 1s/step - loss: 0.5872 - accuracy: 0.7550 - val_loss: 0.7451 - val_accuracy: 0.6406
Epoch 65/100
25/25 [==============================] - 34s 1s/step - loss: 0.5637 - accuracy: 0.7425 - val_loss: 0.6809 - val_accuracy: 0.6927
Epoch 66/100
25/25 [==============================] - 34s 1s/step - loss: 0.5531 - accuracy: 0.7412 - val_loss: 0.8347 - val_accuracy: 0.6094
Epoch 67/100
25/25 [==============================] - 34s 1s/step - loss: 0.5204 - accuracy: 0.7625 - val_loss: 0.9630 - val_accuracy: 0.5833
Epoch 68/100
25/25 [==============================] - 36s 1s/step - loss: 0.5477 - accuracy: 0.7613 - val_loss: 0.7513 - val_accuracy: 0.6302
Epoch 69/100
25/25 [==============================] - 34s 1s/step - loss: 0.5896 - accuracy: 0.7500 - val_loss: 0.6534 - val_accuracy: 0.6927
Epoch 70/100
25/25 [==============================] - 34s 1s/step - loss: 0.5651 - accuracy: 0.7375 - val_loss: 0.6118 - val_accuracy: 0.7292
Epoch 71/100
25/25 [==============================] - 34s 1s/step - loss: 0.4896 - accuracy: 0.7788 - val_loss: 0.6155 - val_accuracy: 0.7292
Epoch 72/100
25/25 [==============================] - 34s 1s/step - loss: 0.4835 - accuracy: 0.7625 - val_loss: 0.8160 - val_accuracy: 0.6250
Epoch 73/100
25/25 [==============================] - 34s 1s/step - loss: 0.5748 - accuracy: 0.7412 - val_loss: 0.7547 - val_accuracy: 0.6302
Epoch 74/100
25/25 [==============================] - 34s 1s/step - loss: 0.4459 - accuracy: 0.7937 - val_loss: 0.7444 - val_accuracy: 0.6667
Epoch 75/100
25/25 [==============================] - 35s 1s/step - loss: 0.4576 - accuracy: 0.7775 - val_loss: 1.0260 - val_accuracy: 0.6667
Epoch 76/100
25/25 [==============================] - 35s 1s/step - loss: 0.8701 - accuracy: 0.6825 - val_loss: 0.8563 - val_accuracy: 0.6198
Epoch 77/100
25/25 [==============================] - 35s 1s/step - loss: 0.5644 - accuracy: 0.7462 - val_loss: 0.7395 - val_accuracy: 0.6406
Epoch 78/100
25/25 [==============================] - 35s 1s/step - loss: 0.4464 - accuracy: 0.7950 - val_loss: 0.7404 - val_accuracy: 0.6510
Epoch 79/100
25/25 [==============================] - 35s 1s/step - loss: 0.4584 - accuracy: 0.7862 - val_loss: 0.7534 - val_accuracy: 0.6510
Epoch 80/100
25/25 [==============================] - 35s 1s/step - loss: 0.5297 - accuracy: 0.7700 - val_loss: 0.6617 - val_accuracy: 0.7083
Epoch 81/100
25/25 [==============================] - 35s 1s/step - loss: 0.4441 - accuracy: 0.7950 - val_loss: 0.7048 - val_accuracy: 0.6927
Epoch 82/100
25/25 [==============================] - 35s 1s/step - loss: 0.5024 - accuracy: 0.7713 - val_loss: 0.7456 - val_accuracy: 0.6875
Epoch 83/100
25/25 [==============================] - 35s 1s/step - loss: 0.4858 - accuracy: 0.7750 - val_loss: 0.6363 - val_accuracy: 0.7552
Epoch 84/100
25/25 [==============================] - 35s 1s/step - loss: 0.4293 - accuracy: 0.8112 - val_loss: 0.6452 - val_accuracy: 0.6875
Epoch 85/100
25/25 [==============================] - 35s 1s/step - loss: 0.4369 - accuracy: 0.8000 - val_loss: 0.7804 - val_accuracy: 0.6510
Epoch 86/100
25/25 [==============================] - 35s 1s/step - loss: 0.3787 - accuracy: 0.8125 - val_loss: 0.7369 - val_accuracy: 0.6719
Epoch 87/100
25/25 [==============================] - 35s 1s/step - loss: 0.5366 - accuracy: 0.7837 - val_loss: 0.9294 - val_accuracy: 0.6615
Epoch 88/100
25/25 [==============================] - 35s 1s/step - loss: 0.4486 - accuracy: 0.8037 - val_loss: 0.6532 - val_accuracy: 0.6875
Epoch 89/100
25/25 [==============================] - 35s 1s/step - loss: 0.3971 - accuracy: 0.8263 - val_loss: 0.5793 - val_accuracy: 0.7188
Epoch 90/100
25/25 [==============================] - 34s 1s/step - loss: 0.4023 - accuracy: 0.8087 - val_loss: 0.6973 - val_accuracy: 0.7135
Epoch 91/100
25/25 [==============================] - 35s 1s/step - loss: 0.3739 - accuracy: 0.8338 - val_loss: 0.6377 - val_accuracy: 0.6927
Epoch 92/100
25/25 [==============================] - 35s 1s/step - loss: 0.4167 - accuracy: 0.7950 - val_loss: 0.6365 - val_accuracy: 0.7188
Epoch 93/100
25/25 [==============================] - 35s 1s/step - loss: 0.4039 - accuracy: 0.8163 - val_loss: 0.7140 - val_accuracy: 0.6719
Epoch 94/100
25/25 [==============================] - 35s 1s/step - loss: 0.3655 - accuracy: 0.8125 - val_loss: 0.5506 - val_accuracy: 0.7500
Epoch 95/100
25/25 [==============================] - 35s 1s/step - loss: 0.4764 - accuracy: 0.7925 - val_loss: 0.6725 - val_accuracy: 0.6927
Epoch 96/100
25/25 [==============================] - 35s 1s/step - loss: 0.3864 - accuracy: 0.8163 - val_loss: 0.7746 - val_accuracy: 0.6615
Epoch 97/100
25/25 [==============================] - 35s 1s/step - loss: 0.3479 - accuracy: 0.8413 - val_loss: 0.6701 - val_accuracy: 0.7083
Epoch 98/100
25/25 [==============================] - 34s 1s/step - loss: 0.3446 - accuracy: 0.8388 - val_loss: 0.5623 - val_accuracy: 0.7656
Epoch 99/100
25/25 [==============================] - 34s 1s/step - loss: 0.3953 - accuracy: 0.8150 - val_loss: 0.6013 - val_accuracy: 0.7448
Epoch 100/100
25/25 [==============================] - 35s 1s/step - loss: 0.3247 - accuracy: 0.8400 - val_loss: 0.6237 - val_accuracy: 0.7552
<keras.callbacks.History at 0x2b04806d160>
model_pool_drop.evaluate(test_ds)
8/8 [==============================] - 3s 278ms/step - loss: 0.6054 - accuracy: 0.7578
[0.6054161787033081, 0.7578125]

Do warstw splotowych

model_conv_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])
model_conv_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_conv_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_2"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_10 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 dropout_5 (Dropout)         (None, 55, 55, 96)        0         
                                                                 
 max_pooling2d_6 (MaxPooling  (None, 27, 27, 96)       0         
 2D)                                                             
                                                                 
 conv2d_11 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 dropout_6 (Dropout)         (None, 27, 27, 256)       0         
                                                                 
 max_pooling2d_7 (MaxPooling  (None, 13, 13, 256)      0         
 2D)                                                             
                                                                 
 conv2d_12 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 dropout_7 (Dropout)         (None, 13, 13, 384)       0         
                                                                 
 conv2d_13 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 dropout_8 (Dropout)         (None, 13, 13, 384)       0         
                                                                 
 conv2d_14 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 dropout_9 (Dropout)         (None, 13, 13, 256)       0         
                                                                 
 max_pooling2d_8 (MaxPooling  (None, 6, 6, 256)        0         
 2D)                                                             
                                                                 
 flatten_2 (Flatten)         (None, 9216)              0         
                                                                 
 dense_6 (Dense)             (None, 4096)              37752832  
                                                                 
 dense_7 (Dense)             (None, 4096)              16781312  
                                                                 
 dense_8 (Dense)             (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_conv_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 39s 1s/step - loss: 1.8422 - accuracy: 0.2313 - val_loss: 2.1335 - val_accuracy: 0.2604
Epoch 2/100
25/25 [==============================] - 37s 1s/step - loss: 1.7023 - accuracy: 0.2837 - val_loss: 2.0904 - val_accuracy: 0.2969
Epoch 3/100
25/25 [==============================] - 37s 1s/step - loss: 1.5376 - accuracy: 0.3313 - val_loss: 2.0778 - val_accuracy: 0.2292
Epoch 4/100
25/25 [==============================] - 37s 1s/step - loss: 1.4663 - accuracy: 0.3800 - val_loss: 2.0102 - val_accuracy: 0.3542
Epoch 5/100
25/25 [==============================] - 37s 1s/step - loss: 1.4467 - accuracy: 0.3938 - val_loss: 1.9956 - val_accuracy: 0.3073
Epoch 6/100
25/25 [==============================] - 38s 1s/step - loss: 1.2621 - accuracy: 0.4863 - val_loss: 1.8875 - val_accuracy: 0.3333
Epoch 7/100
25/25 [==============================] - 37s 1s/step - loss: 1.2946 - accuracy: 0.4675 - val_loss: 1.8695 - val_accuracy: 0.3958
Epoch 8/100
25/25 [==============================] - 38s 2s/step - loss: 1.1517 - accuracy: 0.5100 - val_loss: 1.7409 - val_accuracy: 0.4583
Epoch 9/100
25/25 [==============================] - 37s 1s/step - loss: 1.1045 - accuracy: 0.5350 - val_loss: 1.8332 - val_accuracy: 0.2031
Epoch 10/100
25/25 [==============================] - 37s 1s/step - loss: 1.0446 - accuracy: 0.5462 - val_loss: 1.7515 - val_accuracy: 0.3490
Epoch 11/100
25/25 [==============================] - 37s 1s/step - loss: 1.0663 - accuracy: 0.5575 - val_loss: 1.7029 - val_accuracy: 0.3594
Epoch 12/100
25/25 [==============================] - 37s 1s/step - loss: 1.0778 - accuracy: 0.5650 - val_loss: 1.7780 - val_accuracy: 0.3021
Epoch 13/100
25/25 [==============================] - 37s 1s/step - loss: 1.0175 - accuracy: 0.5663 - val_loss: 1.8585 - val_accuracy: 0.2760
Epoch 14/100
25/25 [==============================] - 37s 1s/step - loss: 0.9161 - accuracy: 0.6100 - val_loss: 1.6880 - val_accuracy: 0.3802
Epoch 15/100
25/25 [==============================] - 37s 1s/step - loss: 0.8277 - accuracy: 0.6488 - val_loss: 1.5378 - val_accuracy: 0.4323
Epoch 16/100
25/25 [==============================] - 37s 1s/step - loss: 0.8719 - accuracy: 0.6463 - val_loss: 1.6053 - val_accuracy: 0.5052
Epoch 17/100
25/25 [==============================] - 37s 1s/step - loss: 0.7539 - accuracy: 0.6812 - val_loss: 1.6414 - val_accuracy: 0.4115
Epoch 18/100
25/25 [==============================] - 37s 1s/step - loss: 0.7815 - accuracy: 0.6812 - val_loss: 1.4664 - val_accuracy: 0.6146
Epoch 19/100
25/25 [==============================] - 37s 1s/step - loss: 0.7458 - accuracy: 0.6913 - val_loss: 1.4077 - val_accuracy: 0.5677
Epoch 20/100
25/25 [==============================] - 37s 1s/step - loss: 0.9790 - accuracy: 0.5913 - val_loss: 1.7290 - val_accuracy: 0.2812
Epoch 21/100
25/25 [==============================] - 37s 1s/step - loss: 0.7419 - accuracy: 0.6950 - val_loss: 1.4896 - val_accuracy: 0.5000
Epoch 22/100
25/25 [==============================] - 37s 1s/step - loss: 0.6879 - accuracy: 0.7200 - val_loss: 1.3856 - val_accuracy: 0.5469
Epoch 23/100
25/25 [==============================] - 37s 1s/step - loss: 0.6642 - accuracy: 0.7125 - val_loss: 1.4391 - val_accuracy: 0.3594
Epoch 24/100
25/25 [==============================] - 37s 1s/step - loss: 0.6317 - accuracy: 0.7412 - val_loss: 1.3867 - val_accuracy: 0.5417
Epoch 25/100
25/25 [==============================] - 37s 1s/step - loss: 0.6106 - accuracy: 0.7462 - val_loss: 1.3900 - val_accuracy: 0.5469
Epoch 26/100
25/25 [==============================] - 37s 1s/step - loss: 0.6000 - accuracy: 0.7287 - val_loss: 1.3455 - val_accuracy: 0.5677
Epoch 27/100
25/25 [==============================] - 37s 1s/step - loss: 0.5725 - accuracy: 0.7900 - val_loss: 1.2634 - val_accuracy: 0.6667
Epoch 28/100
25/25 [==============================] - 37s 1s/step - loss: 0.5605 - accuracy: 0.7688 - val_loss: 1.2915 - val_accuracy: 0.6198
Epoch 29/100
25/25 [==============================] - 37s 1s/step - loss: 0.5432 - accuracy: 0.7875 - val_loss: 1.2972 - val_accuracy: 0.5469
Epoch 30/100
25/25 [==============================] - 37s 1s/step - loss: 0.5862 - accuracy: 0.7663 - val_loss: 1.3937 - val_accuracy: 0.4375
Epoch 31/100
25/25 [==============================] - 37s 1s/step - loss: 0.5134 - accuracy: 0.8000 - val_loss: 1.3887 - val_accuracy: 0.4792
Epoch 32/100
25/25 [==============================] - 37s 1s/step - loss: 0.5530 - accuracy: 0.7800 - val_loss: 1.3789 - val_accuracy: 0.4219
Epoch 33/100
25/25 [==============================] - 37s 1s/step - loss: 0.4936 - accuracy: 0.7763 - val_loss: 1.1190 - val_accuracy: 0.6771
Epoch 34/100
25/25 [==============================] - 38s 1s/step - loss: 0.5085 - accuracy: 0.7950 - val_loss: 1.3130 - val_accuracy: 0.5260
Epoch 35/100
25/25 [==============================] - 37s 1s/step - loss: 0.4900 - accuracy: 0.7962 - val_loss: 1.2185 - val_accuracy: 0.5573
Epoch 36/100
25/25 [==============================] - 37s 1s/step - loss: 0.4537 - accuracy: 0.8263 - val_loss: 1.5491 - val_accuracy: 0.3438
Epoch 37/100
25/25 [==============================] - 37s 1s/step - loss: 0.4313 - accuracy: 0.8325 - val_loss: 1.3085 - val_accuracy: 0.5052
Epoch 38/100
25/25 [==============================] - 37s 1s/step - loss: 0.4185 - accuracy: 0.8288 - val_loss: 1.1157 - val_accuracy: 0.6667
Epoch 39/100
25/25 [==============================] - 37s 1s/step - loss: 0.4420 - accuracy: 0.8037 - val_loss: 1.0747 - val_accuracy: 0.6719
Epoch 40/100
25/25 [==============================] - 37s 1s/step - loss: 0.6217 - accuracy: 0.7613 - val_loss: 1.2203 - val_accuracy: 0.5938
Epoch 41/100
25/25 [==============================] - 37s 1s/step - loss: 0.4495 - accuracy: 0.8125 - val_loss: 1.2375 - val_accuracy: 0.5573
Epoch 42/100
25/25 [==============================] - 37s 1s/step - loss: 0.3707 - accuracy: 0.8413 - val_loss: 1.1054 - val_accuracy: 0.5885
Epoch 43/100
25/25 [==============================] - 37s 1s/step - loss: 0.4187 - accuracy: 0.8138 - val_loss: 1.1526 - val_accuracy: 0.6198
Epoch 44/100
25/25 [==============================] - 37s 1s/step - loss: 0.3886 - accuracy: 0.8462 - val_loss: 1.0597 - val_accuracy: 0.6458
Epoch 45/100
25/25 [==============================] - 37s 1s/step - loss: 0.3577 - accuracy: 0.8425 - val_loss: 1.0726 - val_accuracy: 0.6302
Epoch 46/100
25/25 [==============================] - 37s 1s/step - loss: 0.4222 - accuracy: 0.8225 - val_loss: 1.1023 - val_accuracy: 0.6146
Epoch 47/100
25/25 [==============================] - 37s 1s/step - loss: 0.3652 - accuracy: 0.8462 - val_loss: 1.1679 - val_accuracy: 0.6250
Epoch 48/100
25/25 [==============================] - 37s 1s/step - loss: 0.3453 - accuracy: 0.8537 - val_loss: 1.1139 - val_accuracy: 0.5781
Epoch 49/100
25/25 [==============================] - 37s 1s/step - loss: 0.3015 - accuracy: 0.8763 - val_loss: 1.0735 - val_accuracy: 0.6302
Epoch 50/100
25/25 [==============================] - 37s 1s/step - loss: 0.3289 - accuracy: 0.8587 - val_loss: 1.0207 - val_accuracy: 0.6667
Epoch 51/100
25/25 [==============================] - 37s 1s/step - loss: 0.3748 - accuracy: 0.8475 - val_loss: 1.1093 - val_accuracy: 0.5885
Epoch 52/100
25/25 [==============================] - 37s 1s/step - loss: 0.4012 - accuracy: 0.8375 - val_loss: 1.2312 - val_accuracy: 0.5417
Epoch 53/100
25/25 [==============================] - 37s 1s/step - loss: 0.2989 - accuracy: 0.8813 - val_loss: 1.0820 - val_accuracy: 0.6615
Epoch 54/100
25/25 [==============================] - 38s 1s/step - loss: 0.2973 - accuracy: 0.8750 - val_loss: 0.9210 - val_accuracy: 0.7188
Epoch 55/100
25/25 [==============================] - 37s 1s/step - loss: 0.3219 - accuracy: 0.8650 - val_loss: 1.1205 - val_accuracy: 0.6198
Epoch 56/100
25/25 [==============================] - 37s 1s/step - loss: 0.3142 - accuracy: 0.8750 - val_loss: 0.9678 - val_accuracy: 0.6771
Epoch 57/100
25/25 [==============================] - 37s 1s/step - loss: 0.2701 - accuracy: 0.8788 - val_loss: 0.9047 - val_accuracy: 0.6927
Epoch 58/100
25/25 [==============================] - 38s 1s/step - loss: 0.2940 - accuracy: 0.8788 - val_loss: 1.0407 - val_accuracy: 0.6458
Epoch 59/100
25/25 [==============================] - 37s 1s/step - loss: 0.2552 - accuracy: 0.9025 - val_loss: 0.9503 - val_accuracy: 0.6719
Epoch 60/100
25/25 [==============================] - 37s 1s/step - loss: 0.2430 - accuracy: 0.8913 - val_loss: 0.9695 - val_accuracy: 0.6719
Epoch 61/100
25/25 [==============================] - 39s 2s/step - loss: 0.3017 - accuracy: 0.8850 - val_loss: 0.9939 - val_accuracy: 0.6771
Epoch 62/100
25/25 [==============================] - 37s 1s/step - loss: 0.2430 - accuracy: 0.8938 - val_loss: 0.8850 - val_accuracy: 0.7083
Epoch 63/100
25/25 [==============================] - 38s 1s/step - loss: 0.2560 - accuracy: 0.9025 - val_loss: 1.0165 - val_accuracy: 0.6146
Epoch 64/100
25/25 [==============================] - 37s 1s/step - loss: 0.2406 - accuracy: 0.8938 - val_loss: 0.9506 - val_accuracy: 0.6198
Epoch 65/100
25/25 [==============================] - 37s 1s/step - loss: 0.2375 - accuracy: 0.9125 - val_loss: 1.0983 - val_accuracy: 0.5312
Epoch 66/100
25/25 [==============================] - 37s 1s/step - loss: 0.3581 - accuracy: 0.8625 - val_loss: 1.0290 - val_accuracy: 0.6875
Epoch 67/100
25/25 [==============================] - 38s 1s/step - loss: 0.2074 - accuracy: 0.9175 - val_loss: 0.9548 - val_accuracy: 0.6146
Epoch 68/100
25/25 [==============================] - 38s 1s/step - loss: 0.2374 - accuracy: 0.9025 - val_loss: 1.0477 - val_accuracy: 0.6146
Epoch 69/100
25/25 [==============================] - 39s 2s/step - loss: 0.2269 - accuracy: 0.9075 - val_loss: 1.2301 - val_accuracy: 0.5312
Epoch 70/100
25/25 [==============================] - 41s 2s/step - loss: 0.1970 - accuracy: 0.9300 - val_loss: 1.2733 - val_accuracy: 0.5052
Epoch 71/100
25/25 [==============================] - 39s 2s/step - loss: 0.2358 - accuracy: 0.9112 - val_loss: 0.9070 - val_accuracy: 0.6979
Epoch 72/100
25/25 [==============================] - 37s 1s/step - loss: 0.2292 - accuracy: 0.9125 - val_loss: 1.0493 - val_accuracy: 0.5469
Epoch 73/100
25/25 [==============================] - 37s 1s/step - loss: 0.1826 - accuracy: 0.9250 - val_loss: 0.8005 - val_accuracy: 0.7552
Epoch 74/100
25/25 [==============================] - 37s 1s/step - loss: 0.2046 - accuracy: 0.9237 - val_loss: 0.9878 - val_accuracy: 0.6615
Epoch 75/100
25/25 [==============================] - 37s 1s/step - loss: 0.1801 - accuracy: 0.9225 - val_loss: 0.9359 - val_accuracy: 0.6719
Epoch 76/100
25/25 [==============================] - 37s 1s/step - loss: 0.2322 - accuracy: 0.9125 - val_loss: 0.8830 - val_accuracy: 0.6927
Epoch 77/100
25/25 [==============================] - 38s 2s/step - loss: 0.1762 - accuracy: 0.9325 - val_loss: 1.0842 - val_accuracy: 0.4844
Epoch 78/100
25/25 [==============================] - 38s 1s/step - loss: 0.1705 - accuracy: 0.9413 - val_loss: 0.9062 - val_accuracy: 0.6667
Epoch 79/100
25/25 [==============================] - 38s 2s/step - loss: 0.4088 - accuracy: 0.8625 - val_loss: 1.0009 - val_accuracy: 0.6875
Epoch 80/100
25/25 [==============================] - 38s 1s/step - loss: 0.1877 - accuracy: 0.9388 - val_loss: 0.9098 - val_accuracy: 0.6719
Epoch 81/100
25/25 [==============================] - 38s 1s/step - loss: 0.1855 - accuracy: 0.9362 - val_loss: 1.0068 - val_accuracy: 0.6302
Epoch 82/100
25/25 [==============================] - 37s 1s/step - loss: 0.1567 - accuracy: 0.9375 - val_loss: 0.9050 - val_accuracy: 0.6823
Epoch 83/100
25/25 [==============================] - 37s 1s/step - loss: 0.1537 - accuracy: 0.9475 - val_loss: 0.9882 - val_accuracy: 0.5885
Epoch 84/100
25/25 [==============================] - 37s 1s/step - loss: 0.1718 - accuracy: 0.9425 - val_loss: 1.1189 - val_accuracy: 0.5729
Epoch 85/100
25/25 [==============================] - 38s 1s/step - loss: 0.1222 - accuracy: 0.9575 - val_loss: 0.9589 - val_accuracy: 0.5677
Epoch 86/100
25/25 [==============================] - 38s 2s/step - loss: 0.2028 - accuracy: 0.9212 - val_loss: 1.0172 - val_accuracy: 0.6146
Epoch 87/100
25/25 [==============================] - 38s 1s/step - loss: 0.1412 - accuracy: 0.9488 - val_loss: 0.9860 - val_accuracy: 0.6458
Epoch 88/100
25/25 [==============================] - 38s 1s/step - loss: 0.1566 - accuracy: 0.9513 - val_loss: 0.9333 - val_accuracy: 0.6510
Epoch 89/100
25/25 [==============================] - 40s 2s/step - loss: 0.3019 - accuracy: 0.9062 - val_loss: 1.5026 - val_accuracy: 0.3854
Epoch 90/100
25/25 [==============================] - 38s 2s/step - loss: 0.1974 - accuracy: 0.9438 - val_loss: 0.9424 - val_accuracy: 0.6719
Epoch 91/100
25/25 [==============================] - 37s 1s/step - loss: 0.1236 - accuracy: 0.9550 - val_loss: 0.9276 - val_accuracy: 0.5990
Epoch 92/100
25/25 [==============================] - 37s 1s/step - loss: 0.1786 - accuracy: 0.9350 - val_loss: 0.7350 - val_accuracy: 0.7760
Epoch 93/100
25/25 [==============================] - 37s 1s/step - loss: 0.2246 - accuracy: 0.9287 - val_loss: 0.8939 - val_accuracy: 0.6771
Epoch 94/100
25/25 [==============================] - 37s 1s/step - loss: 0.1033 - accuracy: 0.9663 - val_loss: 0.8567 - val_accuracy: 0.6406
Epoch 95/100
25/25 [==============================] - 37s 1s/step - loss: 0.1007 - accuracy: 0.9688 - val_loss: 0.8316 - val_accuracy: 0.7083
Epoch 96/100
25/25 [==============================] - 37s 1s/step - loss: 0.1740 - accuracy: 0.9325 - val_loss: 0.8963 - val_accuracy: 0.6771
Epoch 97/100
25/25 [==============================] - 37s 1s/step - loss: 0.0915 - accuracy: 0.9700 - val_loss: 0.7647 - val_accuracy: 0.7552
Epoch 98/100
25/25 [==============================] - 37s 1s/step - loss: 0.1030 - accuracy: 0.9625 - val_loss: 0.8457 - val_accuracy: 0.7135
Epoch 99/100
25/25 [==============================] - 38s 1s/step - loss: 0.1826 - accuracy: 0.9312 - val_loss: 1.0152 - val_accuracy: 0.6719
Epoch 100/100
25/25 [==============================] - 37s 1s/step - loss: 0.1084 - accuracy: 0.9575 - val_loss: 1.0453 - val_accuracy: 0.5312
<keras.callbacks.History at 0x2b04825a3a0>
model_conv_drop.evaluate(test_ds)
8/8 [==============================] - 3s 289ms/step - loss: 0.9870 - accuracy: 0.5664
[0.9869575500488281, 0.56640625]

Do warstw spłaszczonych i maxpooling

model_flat_pool_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(10, activation='softmax')
])
model_flat_pool_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_flat_pool_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_3"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_15 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 max_pooling2d_9 (MaxPooling  (None, 27, 27, 96)       0         
 2D)                                                             
                                                                 
 dropout_10 (Dropout)        (None, 27, 27, 96)        0         
                                                                 
 conv2d_16 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 max_pooling2d_10 (MaxPoolin  (None, 13, 13, 256)      0         
 g2D)                                                            
                                                                 
 dropout_11 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 conv2d_17 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 conv2d_18 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 conv2d_19 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 max_pooling2d_11 (MaxPoolin  (None, 6, 6, 256)        0         
 g2D)                                                            
                                                                 
 dropout_12 (Dropout)        (None, 6, 6, 256)         0         
                                                                 
 flatten_3 (Flatten)         (None, 9216)              0         
                                                                 
 dense_9 (Dense)             (None, 4096)              37752832  
                                                                 
 dropout_13 (Dropout)        (None, 4096)              0         
                                                                 
 dense_10 (Dense)            (None, 4096)              16781312  
                                                                 
 dropout_14 (Dropout)        (None, 4096)              0         
                                                                 
 dense_11 (Dense)            (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_flat_pool_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 37s 1s/step - loss: 2.0917 - accuracy: 0.1775 - val_loss: 1.9565 - val_accuracy: 0.2708
Epoch 2/100
25/25 [==============================] - 34s 1s/step - loss: 1.7322 - accuracy: 0.2000 - val_loss: 1.8304 - val_accuracy: 0.3177
Epoch 3/100
25/25 [==============================] - 34s 1s/step - loss: 1.6923 - accuracy: 0.2325 - val_loss: 1.8261 - val_accuracy: 0.3073
Epoch 4/100
25/25 [==============================] - 34s 1s/step - loss: 1.6810 - accuracy: 0.2175 - val_loss: 1.7829 - val_accuracy: 0.2656
Epoch 5/100
25/25 [==============================] - 34s 1s/step - loss: 1.6517 - accuracy: 0.2225 - val_loss: 1.7979 - val_accuracy: 0.2396
Epoch 6/100
25/25 [==============================] - 35s 1s/step - loss: 1.6633 - accuracy: 0.2225 - val_loss: 1.7933 - val_accuracy: 0.2240
Epoch 7/100
25/25 [==============================] - 35s 1s/step - loss: 1.6198 - accuracy: 0.2637 - val_loss: 1.7102 - val_accuracy: 0.3906
Epoch 8/100
25/25 [==============================] - 34s 1s/step - loss: 1.6002 - accuracy: 0.2763 - val_loss: 1.7037 - val_accuracy: 0.3490
Epoch 9/100
25/25 [==============================] - 34s 1s/step - loss: 1.6232 - accuracy: 0.2612 - val_loss: 1.7178 - val_accuracy: 0.4219
Epoch 10/100
25/25 [==============================] - 34s 1s/step - loss: 1.5658 - accuracy: 0.3038 - val_loss: 1.6378 - val_accuracy: 0.3333
Epoch 11/100
25/25 [==============================] - 35s 1s/step - loss: 1.5433 - accuracy: 0.3137 - val_loss: 1.6015 - val_accuracy: 0.3385
Epoch 12/100
25/25 [==============================] - 35s 1s/step - loss: 1.4841 - accuracy: 0.3363 - val_loss: 1.5526 - val_accuracy: 0.3438
Epoch 13/100
25/25 [==============================] - 35s 1s/step - loss: 1.4081 - accuracy: 0.3837 - val_loss: 1.4210 - val_accuracy: 0.3802
Epoch 14/100
25/25 [==============================] - 34s 1s/step - loss: 1.3291 - accuracy: 0.4375 - val_loss: 1.2532 - val_accuracy: 0.4948
Epoch 15/100
25/25 [==============================] - 34s 1s/step - loss: 1.2583 - accuracy: 0.4550 - val_loss: 1.2151 - val_accuracy: 0.4531
Epoch 16/100
25/25 [==============================] - 34s 1s/step - loss: 1.1925 - accuracy: 0.5088 - val_loss: 1.2792 - val_accuracy: 0.3698
Epoch 17/100
25/25 [==============================] - 34s 1s/step - loss: 1.1364 - accuracy: 0.5163 - val_loss: 1.2483 - val_accuracy: 0.4635
Epoch 18/100
25/25 [==============================] - 33s 1s/step - loss: 1.1357 - accuracy: 0.5038 - val_loss: 1.1645 - val_accuracy: 0.4479
Epoch 19/100
25/25 [==============================] - 33s 1s/step - loss: 1.1218 - accuracy: 0.4963 - val_loss: 1.2317 - val_accuracy: 0.4479
Epoch 20/100
25/25 [==============================] - 33s 1s/step - loss: 1.1589 - accuracy: 0.5038 - val_loss: 1.0579 - val_accuracy: 0.5312
Epoch 21/100
25/25 [==============================] - 33s 1s/step - loss: 1.0452 - accuracy: 0.5675 - val_loss: 1.0819 - val_accuracy: 0.5312
Epoch 22/100
25/25 [==============================] - 33s 1s/step - loss: 1.0479 - accuracy: 0.5688 - val_loss: 1.0547 - val_accuracy: 0.5573
Epoch 23/100
25/25 [==============================] - 33s 1s/step - loss: 1.0540 - accuracy: 0.5450 - val_loss: 0.9755 - val_accuracy: 0.5312
Epoch 24/100
25/25 [==============================] - 33s 1s/step - loss: 1.0686 - accuracy: 0.5638 - val_loss: 1.0784 - val_accuracy: 0.5573
Epoch 25/100
25/25 [==============================] - 33s 1s/step - loss: 0.9795 - accuracy: 0.5750 - val_loss: 0.9952 - val_accuracy: 0.5625
Epoch 26/100
25/25 [==============================] - 33s 1s/step - loss: 1.0000 - accuracy: 0.5638 - val_loss: 1.2539 - val_accuracy: 0.4635
Epoch 27/100
25/25 [==============================] - 33s 1s/step - loss: 1.0407 - accuracy: 0.5537 - val_loss: 1.2266 - val_accuracy: 0.4948
Epoch 28/100
25/25 [==============================] - 33s 1s/step - loss: 1.0390 - accuracy: 0.5450 - val_loss: 0.9923 - val_accuracy: 0.5833
Epoch 29/100
25/25 [==============================] - 33s 1s/step - loss: 0.9594 - accuracy: 0.5913 - val_loss: 1.0368 - val_accuracy: 0.5469
Epoch 30/100
25/25 [==============================] - 33s 1s/step - loss: 0.9869 - accuracy: 0.5738 - val_loss: 0.8615 - val_accuracy: 0.5573
Epoch 31/100
25/25 [==============================] - 33s 1s/step - loss: 0.9585 - accuracy: 0.5775 - val_loss: 1.0329 - val_accuracy: 0.5260
Epoch 32/100
25/25 [==============================] - 33s 1s/step - loss: 0.9576 - accuracy: 0.5713 - val_loss: 1.1186 - val_accuracy: 0.5208
Epoch 33/100
25/25 [==============================] - 33s 1s/step - loss: 0.9654 - accuracy: 0.5638 - val_loss: 0.8668 - val_accuracy: 0.5938
Epoch 34/100
25/25 [==============================] - 33s 1s/step - loss: 0.9641 - accuracy: 0.5600 - val_loss: 0.8702 - val_accuracy: 0.6094
Epoch 35/100
25/25 [==============================] - 33s 1s/step - loss: 0.9572 - accuracy: 0.5875 - val_loss: 0.9063 - val_accuracy: 0.5677
Epoch 36/100
25/25 [==============================] - 33s 1s/step - loss: 0.9522 - accuracy: 0.5962 - val_loss: 1.0374 - val_accuracy: 0.5521
Epoch 37/100
25/25 [==============================] - 33s 1s/step - loss: 0.9262 - accuracy: 0.6087 - val_loss: 1.5964 - val_accuracy: 0.3542
Epoch 38/100
25/25 [==============================] - 33s 1s/step - loss: 0.9213 - accuracy: 0.6150 - val_loss: 0.8814 - val_accuracy: 0.6250
Epoch 39/100
25/25 [==============================] - 33s 1s/step - loss: 0.9015 - accuracy: 0.6125 - val_loss: 1.1375 - val_accuracy: 0.4948
Epoch 40/100
25/25 [==============================] - 33s 1s/step - loss: 0.8985 - accuracy: 0.6100 - val_loss: 1.0702 - val_accuracy: 0.5469
Epoch 41/100
25/25 [==============================] - 33s 1s/step - loss: 0.9110 - accuracy: 0.5987 - val_loss: 1.1127 - val_accuracy: 0.5260
Epoch 42/100
25/25 [==============================] - 33s 1s/step - loss: 0.9490 - accuracy: 0.5888 - val_loss: 0.8745 - val_accuracy: 0.6354
Epoch 43/100
25/25 [==============================] - 33s 1s/step - loss: 0.8498 - accuracy: 0.6388 - val_loss: 0.9744 - val_accuracy: 0.6094
Epoch 44/100
25/25 [==============================] - 33s 1s/step - loss: 0.9338 - accuracy: 0.6000 - val_loss: 0.7914 - val_accuracy: 0.6771
Epoch 45/100
25/25 [==============================] - 33s 1s/step - loss: 0.8778 - accuracy: 0.6187 - val_loss: 0.9569 - val_accuracy: 0.6094
Epoch 46/100
25/25 [==============================] - 33s 1s/step - loss: 0.8683 - accuracy: 0.6488 - val_loss: 0.8768 - val_accuracy: 0.6302
Epoch 47/100
25/25 [==============================] - 33s 1s/step - loss: 0.9314 - accuracy: 0.5888 - val_loss: 0.8695 - val_accuracy: 0.6510
Epoch 48/100
25/25 [==============================] - 33s 1s/step - loss: 0.8562 - accuracy: 0.6087 - val_loss: 0.9378 - val_accuracy: 0.6146
Epoch 49/100
25/25 [==============================] - 34s 1s/step - loss: 0.8526 - accuracy: 0.6425 - val_loss: 0.7878 - val_accuracy: 0.6771
Epoch 50/100
25/25 [==============================] - 33s 1s/step - loss: 0.8686 - accuracy: 0.6075 - val_loss: 0.7986 - val_accuracy: 0.6823
Epoch 51/100
25/25 [==============================] - 33s 1s/step - loss: 0.8529 - accuracy: 0.6338 - val_loss: 0.9565 - val_accuracy: 0.6094
Epoch 52/100
25/25 [==============================] - 33s 1s/step - loss: 0.8452 - accuracy: 0.6425 - val_loss: 0.8586 - val_accuracy: 0.6510
Epoch 53/100
25/25 [==============================] - 33s 1s/step - loss: 0.7898 - accuracy: 0.6438 - val_loss: 0.7577 - val_accuracy: 0.6823
Epoch 54/100
25/25 [==============================] - 33s 1s/step - loss: 0.7980 - accuracy: 0.6488 - val_loss: 0.8313 - val_accuracy: 0.6510
Epoch 55/100
25/25 [==============================] - 33s 1s/step - loss: 0.8150 - accuracy: 0.6388 - val_loss: 0.7770 - val_accuracy: 0.6823
Epoch 56/100
25/25 [==============================] - 33s 1s/step - loss: 0.8610 - accuracy: 0.6538 - val_loss: 0.7361 - val_accuracy: 0.6927
Epoch 57/100
25/25 [==============================] - 33s 1s/step - loss: 0.8102 - accuracy: 0.6612 - val_loss: 0.9088 - val_accuracy: 0.6302
Epoch 58/100
25/25 [==============================] - 33s 1s/step - loss: 0.8354 - accuracy: 0.6388 - val_loss: 0.8243 - val_accuracy: 0.6250
Epoch 59/100
25/25 [==============================] - 33s 1s/step - loss: 0.7939 - accuracy: 0.6513 - val_loss: 0.7328 - val_accuracy: 0.6823
Epoch 60/100
25/25 [==============================] - 33s 1s/step - loss: 0.8086 - accuracy: 0.6338 - val_loss: 1.4440 - val_accuracy: 0.5417
Epoch 61/100
25/25 [==============================] - 33s 1s/step - loss: 0.8329 - accuracy: 0.6500 - val_loss: 1.1445 - val_accuracy: 0.5729
Epoch 62/100
25/25 [==============================] - 33s 1s/step - loss: 0.7804 - accuracy: 0.6425 - val_loss: 0.7927 - val_accuracy: 0.6615
Epoch 63/100
25/25 [==============================] - 34s 1s/step - loss: 0.7279 - accuracy: 0.6925 - val_loss: 0.8555 - val_accuracy: 0.6719
Epoch 64/100
25/25 [==============================] - 33s 1s/step - loss: 0.7491 - accuracy: 0.6862 - val_loss: 0.7689 - val_accuracy: 0.6823
Epoch 65/100
25/25 [==============================] - 33s 1s/step - loss: 0.7468 - accuracy: 0.6775 - val_loss: 0.8862 - val_accuracy: 0.5990
Epoch 66/100
25/25 [==============================] - 33s 1s/step - loss: 0.7560 - accuracy: 0.6950 - val_loss: 0.9006 - val_accuracy: 0.6198
Epoch 67/100
25/25 [==============================] - 33s 1s/step - loss: 0.6820 - accuracy: 0.6950 - val_loss: 0.9478 - val_accuracy: 0.5990
Epoch 68/100
25/25 [==============================] - 33s 1s/step - loss: 0.6749 - accuracy: 0.7250 - val_loss: 0.7632 - val_accuracy: 0.6719
Epoch 69/100
25/25 [==============================] - 33s 1s/step - loss: 0.8980 - accuracy: 0.6313 - val_loss: 1.2917 - val_accuracy: 0.5208
Epoch 70/100
25/25 [==============================] - 33s 1s/step - loss: 0.8385 - accuracy: 0.6250 - val_loss: 0.9292 - val_accuracy: 0.5677
Epoch 71/100
25/25 [==============================] - 33s 1s/step - loss: 0.8319 - accuracy: 0.6400 - val_loss: 0.9105 - val_accuracy: 0.5990
Epoch 72/100
25/25 [==============================] - 33s 1s/step - loss: 0.8015 - accuracy: 0.6562 - val_loss: 0.9724 - val_accuracy: 0.6250
Epoch 73/100
25/25 [==============================] - 33s 1s/step - loss: 0.7114 - accuracy: 0.7000 - val_loss: 0.7665 - val_accuracy: 0.6771
Epoch 74/100
25/25 [==============================] - 33s 1s/step - loss: 0.8950 - accuracy: 0.6150 - val_loss: 0.8339 - val_accuracy: 0.6042
Epoch 75/100
25/25 [==============================] - 33s 1s/step - loss: 0.8064 - accuracy: 0.6637 - val_loss: 0.7158 - val_accuracy: 0.7240
Epoch 76/100
25/25 [==============================] - 33s 1s/step - loss: 0.7647 - accuracy: 0.6800 - val_loss: 0.8539 - val_accuracy: 0.5677
Epoch 77/100
25/25 [==============================] - 34s 1s/step - loss: 0.7230 - accuracy: 0.6875 - val_loss: 0.9702 - val_accuracy: 0.5781
Epoch 78/100
25/25 [==============================] - 36s 1s/step - loss: 0.7361 - accuracy: 0.7063 - val_loss: 1.1083 - val_accuracy: 0.5677
Epoch 79/100
25/25 [==============================] - 35s 1s/step - loss: 0.7267 - accuracy: 0.7075 - val_loss: 0.8585 - val_accuracy: 0.6615
Epoch 80/100
25/25 [==============================] - 33s 1s/step - loss: 0.7779 - accuracy: 0.6775 - val_loss: 1.3162 - val_accuracy: 0.5104
Epoch 81/100
25/25 [==============================] - 33s 1s/step - loss: 0.7000 - accuracy: 0.6975 - val_loss: 0.8335 - val_accuracy: 0.6250
Epoch 82/100
25/25 [==============================] - 33s 1s/step - loss: 0.6793 - accuracy: 0.7262 - val_loss: 0.9848 - val_accuracy: 0.6146
Epoch 83/100
25/25 [==============================] - 32s 1s/step - loss: 0.6640 - accuracy: 0.7025 - val_loss: 0.7998 - val_accuracy: 0.6250
Epoch 84/100
25/25 [==============================] - 33s 1s/step - loss: 0.7114 - accuracy: 0.7063 - val_loss: 0.8843 - val_accuracy: 0.6146
Epoch 85/100
25/25 [==============================] - 33s 1s/step - loss: 0.7037 - accuracy: 0.7138 - val_loss: 0.7425 - val_accuracy: 0.6562
Epoch 86/100
25/25 [==============================] - 33s 1s/step - loss: 0.6398 - accuracy: 0.7437 - val_loss: 0.6782 - val_accuracy: 0.7240
Epoch 87/100
25/25 [==============================] - 33s 1s/step - loss: 0.6463 - accuracy: 0.7175 - val_loss: 1.0489 - val_accuracy: 0.5885
Epoch 88/100
25/25 [==============================] - 33s 1s/step - loss: 0.6026 - accuracy: 0.7462 - val_loss: 1.8062 - val_accuracy: 0.5365
Epoch 89/100
25/25 [==============================] - 33s 1s/step - loss: 0.5925 - accuracy: 0.7538 - val_loss: 1.4441 - val_accuracy: 0.5573
Epoch 90/100
25/25 [==============================] - 35s 1s/step - loss: 0.6420 - accuracy: 0.7262 - val_loss: 0.7644 - val_accuracy: 0.6719
Epoch 91/100
25/25 [==============================] - 34s 1s/step - loss: 0.5179 - accuracy: 0.7837 - val_loss: 0.6801 - val_accuracy: 0.6927
Epoch 92/100
25/25 [==============================] - 33s 1s/step - loss: 0.6311 - accuracy: 0.7387 - val_loss: 0.8016 - val_accuracy: 0.7031
Epoch 93/100
25/25 [==============================] - 33s 1s/step - loss: 0.6578 - accuracy: 0.7412 - val_loss: 0.9470 - val_accuracy: 0.6510
Epoch 94/100
25/25 [==============================] - 33s 1s/step - loss: 0.6059 - accuracy: 0.7450 - val_loss: 0.6827 - val_accuracy: 0.7083
Epoch 95/100
25/25 [==============================] - 33s 1s/step - loss: 0.5553 - accuracy: 0.7575 - val_loss: 0.7752 - val_accuracy: 0.6979
Epoch 96/100
25/25 [==============================] - 33s 1s/step - loss: 0.5328 - accuracy: 0.7812 - val_loss: 0.5755 - val_accuracy: 0.7448
Epoch 97/100
25/25 [==============================] - 33s 1s/step - loss: 0.4946 - accuracy: 0.7887 - val_loss: 0.8354 - val_accuracy: 0.6823
Epoch 98/100
25/25 [==============================] - 33s 1s/step - loss: 0.5000 - accuracy: 0.7812 - val_loss: 0.7233 - val_accuracy: 0.6875
Epoch 99/100
25/25 [==============================] - 33s 1s/step - loss: 0.5272 - accuracy: 0.7750 - val_loss: 1.0468 - val_accuracy: 0.5990
Epoch 100/100
25/25 [==============================] - 33s 1s/step - loss: 0.4910 - accuracy: 0.7900 - val_loss: 0.7302 - val_accuracy: 0.6562
<keras.callbacks.History at 0x2b04856fa60>
model_flat_pool_drop.evaluate(test_ds)
8/8 [==============================] - 3s 272ms/step - loss: 0.6817 - accuracy: 0.7227
[0.6817080974578857, 0.72265625]

Do warstw spłaszczonych i splotowych

model_flat_conv_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(10, activation='softmax')
])
model_flat_conv_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_flat_conv_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_4"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_20 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 dropout_15 (Dropout)        (None, 55, 55, 96)        0         
                                                                 
 max_pooling2d_12 (MaxPoolin  (None, 27, 27, 96)       0         
 g2D)                                                            
                                                                 
 conv2d_21 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 dropout_16 (Dropout)        (None, 27, 27, 256)       0         
                                                                 
 max_pooling2d_13 (MaxPoolin  (None, 13, 13, 256)      0         
 g2D)                                                            
                                                                 
 conv2d_22 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 dropout_17 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_23 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 dropout_18 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_24 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 dropout_19 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 max_pooling2d_14 (MaxPoolin  (None, 6, 6, 256)        0         
 g2D)                                                            
                                                                 
 flatten_4 (Flatten)         (None, 9216)              0         
                                                                 
 dense_12 (Dense)            (None, 4096)              37752832  
                                                                 
 dropout_20 (Dropout)        (None, 4096)              0         
                                                                 
 dense_13 (Dense)            (None, 4096)              16781312  
                                                                 
 dropout_21 (Dropout)        (None, 4096)              0         
                                                                 
 dense_14 (Dense)            (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_flat_conv_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 38s 1s/step - loss: 1.8599 - accuracy: 0.2175 - val_loss: 2.1514 - val_accuracy: 0.2500
Epoch 2/100
25/25 [==============================] - 36s 1s/step - loss: 1.6948 - accuracy: 0.2500 - val_loss: 2.1303 - val_accuracy: 0.2656
Epoch 3/100
25/25 [==============================] - 36s 1s/step - loss: 1.5830 - accuracy: 0.3088 - val_loss: 2.0759 - val_accuracy: 0.1875
Epoch 4/100
25/25 [==============================] - 36s 1s/step - loss: 1.5122 - accuracy: 0.3425 - val_loss: 2.0394 - val_accuracy: 0.2344
Epoch 5/100
25/25 [==============================] - 36s 1s/step - loss: 1.4322 - accuracy: 0.3787 - val_loss: 1.9146 - val_accuracy: 0.3594
Epoch 6/100
25/25 [==============================] - 36s 1s/step - loss: 1.2522 - accuracy: 0.4450 - val_loss: 1.9610 - val_accuracy: 0.2448
Epoch 7/100
25/25 [==============================] - 35s 1s/step - loss: 1.2729 - accuracy: 0.4475 - val_loss: 1.7461 - val_accuracy: 0.4792
Epoch 8/100
25/25 [==============================] - 35s 1s/step - loss: 1.3159 - accuracy: 0.4475 - val_loss: 1.7940 - val_accuracy: 0.4323
Epoch 9/100
25/25 [==============================] - 36s 1s/step - loss: 1.1717 - accuracy: 0.4988 - val_loss: 1.6668 - val_accuracy: 0.5208
Epoch 10/100
25/25 [==============================] - 36s 1s/step - loss: 1.1578 - accuracy: 0.4825 - val_loss: 1.6895 - val_accuracy: 0.4062
Epoch 11/100
25/25 [==============================] - 35s 1s/step - loss: 1.0373 - accuracy: 0.5225 - val_loss: 1.6572 - val_accuracy: 0.4271
Epoch 12/100
25/25 [==============================] - 36s 1s/step - loss: 1.1024 - accuracy: 0.5050 - val_loss: 1.7203 - val_accuracy: 0.4062
Epoch 13/100
25/25 [==============================] - 35s 1s/step - loss: 1.0335 - accuracy: 0.5487 - val_loss: 1.5971 - val_accuracy: 0.4583
Epoch 14/100
25/25 [==============================] - 35s 1s/step - loss: 1.0407 - accuracy: 0.5238 - val_loss: 1.7055 - val_accuracy: 0.4010
Epoch 15/100
25/25 [==============================] - 36s 1s/step - loss: 1.0026 - accuracy: 0.5462 - val_loss: 1.5315 - val_accuracy: 0.4583
Epoch 16/100
25/25 [==============================] - 36s 1s/step - loss: 1.0267 - accuracy: 0.5350 - val_loss: 1.5610 - val_accuracy: 0.4844
Epoch 17/100
25/25 [==============================] - 35s 1s/step - loss: 0.9454 - accuracy: 0.5663 - val_loss: 1.7559 - val_accuracy: 0.2708
Epoch 18/100
25/25 [==============================] - 36s 1s/step - loss: 0.9948 - accuracy: 0.5675 - val_loss: 1.6200 - val_accuracy: 0.4219
Epoch 19/100
25/25 [==============================] - 36s 1s/step - loss: 0.9074 - accuracy: 0.5987 - val_loss: 1.7146 - val_accuracy: 0.2917
Epoch 20/100
25/25 [==============================] - 35s 1s/step - loss: 0.9107 - accuracy: 0.5950 - val_loss: 1.5316 - val_accuracy: 0.4427
Epoch 21/100
25/25 [==============================] - 36s 1s/step - loss: 0.8628 - accuracy: 0.6212 - val_loss: 1.6812 - val_accuracy: 0.3021
Epoch 22/100
25/25 [==============================] - 35s 1s/step - loss: 0.9339 - accuracy: 0.6200 - val_loss: 1.4395 - val_accuracy: 0.5104
Epoch 23/100
25/25 [==============================] - 36s 1s/step - loss: 0.8752 - accuracy: 0.6150 - val_loss: 1.5659 - val_accuracy: 0.4219
Epoch 24/100
25/25 [==============================] - 36s 1s/step - loss: 0.8968 - accuracy: 0.6200 - val_loss: 1.4972 - val_accuracy: 0.4531
Epoch 25/100
25/25 [==============================] - 36s 1s/step - loss: 0.8278 - accuracy: 0.6463 - val_loss: 1.5808 - val_accuracy: 0.3958
Epoch 26/100
25/25 [==============================] - 36s 1s/step - loss: 0.8339 - accuracy: 0.6450 - val_loss: 1.4826 - val_accuracy: 0.4427
Epoch 27/100
25/25 [==============================] - 36s 1s/step - loss: 0.7643 - accuracy: 0.6675 - val_loss: 1.3160 - val_accuracy: 0.5573
Epoch 28/100
25/25 [==============================] - 36s 1s/step - loss: 0.8465 - accuracy: 0.6325 - val_loss: 1.4294 - val_accuracy: 0.4844
Epoch 29/100
25/25 [==============================] - 36s 1s/step - loss: 0.7217 - accuracy: 0.7000 - val_loss: 1.4546 - val_accuracy: 0.4427
Epoch 30/100
25/25 [==============================] - 35s 1s/step - loss: 0.7759 - accuracy: 0.6700 - val_loss: 1.5743 - val_accuracy: 0.3854
Epoch 31/100
25/25 [==============================] - 35s 1s/step - loss: 0.7494 - accuracy: 0.6737 - val_loss: 1.4131 - val_accuracy: 0.4427
Epoch 32/100
25/25 [==============================] - 35s 1s/step - loss: 0.8117 - accuracy: 0.6712 - val_loss: 1.5993 - val_accuracy: 0.3229
Epoch 33/100
25/25 [==============================] - 36s 1s/step - loss: 0.6711 - accuracy: 0.7063 - val_loss: 1.4211 - val_accuracy: 0.4635
Epoch 34/100
25/25 [==============================] - 36s 1s/step - loss: 0.7168 - accuracy: 0.6988 - val_loss: 1.4401 - val_accuracy: 0.4115
Epoch 35/100
25/25 [==============================] - 36s 1s/step - loss: 0.6766 - accuracy: 0.7287 - val_loss: 1.3782 - val_accuracy: 0.4583
Epoch 36/100
25/25 [==============================] - 36s 1s/step - loss: 0.6349 - accuracy: 0.7312 - val_loss: 1.3980 - val_accuracy: 0.4219
Epoch 37/100
25/25 [==============================] - 35s 1s/step - loss: 0.6949 - accuracy: 0.7163 - val_loss: 1.4965 - val_accuracy: 0.3646
Epoch 38/100
25/25 [==============================] - 36s 1s/step - loss: 0.6801 - accuracy: 0.7375 - val_loss: 1.4329 - val_accuracy: 0.4219
Epoch 39/100
25/25 [==============================] - 36s 1s/step - loss: 0.6067 - accuracy: 0.7538 - val_loss: 1.2681 - val_accuracy: 0.5260
Epoch 40/100
25/25 [==============================] - 36s 1s/step - loss: 0.6001 - accuracy: 0.7450 - val_loss: 1.4195 - val_accuracy: 0.4062
Epoch 41/100
25/25 [==============================] - 36s 1s/step - loss: 0.6434 - accuracy: 0.7287 - val_loss: 1.4461 - val_accuracy: 0.3854
Epoch 42/100
25/25 [==============================] - 36s 1s/step - loss: 0.5218 - accuracy: 0.7738 - val_loss: 1.4192 - val_accuracy: 0.4010
Epoch 43/100
25/25 [==============================] - 35s 1s/step - loss: 0.5784 - accuracy: 0.7425 - val_loss: 1.5090 - val_accuracy: 0.3958
Epoch 44/100
25/25 [==============================] - 36s 1s/step - loss: 0.4925 - accuracy: 0.7950 - val_loss: 1.4046 - val_accuracy: 0.3750
Epoch 45/100
25/25 [==============================] - 35s 1s/step - loss: 0.5452 - accuracy: 0.7788 - val_loss: 1.4319 - val_accuracy: 0.4062
Epoch 46/100
25/25 [==============================] - 35s 1s/step - loss: 0.4841 - accuracy: 0.7725 - val_loss: 1.1874 - val_accuracy: 0.5729
Epoch 47/100
25/25 [==============================] - 36s 1s/step - loss: 0.4485 - accuracy: 0.8175 - val_loss: 1.1916 - val_accuracy: 0.5469
Epoch 48/100
25/25 [==============================] - 35s 1s/step - loss: 0.6050 - accuracy: 0.7513 - val_loss: 1.2601 - val_accuracy: 0.4948
Epoch 49/100
25/25 [==============================] - 36s 1s/step - loss: 0.5776 - accuracy: 0.7563 - val_loss: 1.2410 - val_accuracy: 0.5052
Epoch 50/100
25/25 [==============================] - 36s 1s/step - loss: 0.4671 - accuracy: 0.7925 - val_loss: 1.3867 - val_accuracy: 0.4219
Epoch 51/100
25/25 [==============================] - 36s 1s/step - loss: 0.4418 - accuracy: 0.8075 - val_loss: 1.1037 - val_accuracy: 0.6250
Epoch 52/100
25/25 [==============================] - 36s 1s/step - loss: 0.4319 - accuracy: 0.8175 - val_loss: 1.5872 - val_accuracy: 0.3385
Epoch 53/100
25/25 [==============================] - 35s 1s/step - loss: 0.4272 - accuracy: 0.8213 - val_loss: 1.3312 - val_accuracy: 0.4583
Epoch 54/100
25/25 [==============================] - 35s 1s/step - loss: 0.4158 - accuracy: 0.8275 - val_loss: 1.3446 - val_accuracy: 0.4167
Epoch 55/100
25/25 [==============================] - 35s 1s/step - loss: 0.5541 - accuracy: 0.8062 - val_loss: 1.3947 - val_accuracy: 0.4115
Epoch 56/100
25/25 [==============================] - 36s 1s/step - loss: 0.4572 - accuracy: 0.8012 - val_loss: 1.5154 - val_accuracy: 0.3698
Epoch 57/100
25/25 [==============================] - 36s 1s/step - loss: 0.4160 - accuracy: 0.8150 - val_loss: 1.2559 - val_accuracy: 0.4740
Epoch 58/100
25/25 [==============================] - 36s 1s/step - loss: 0.3743 - accuracy: 0.8313 - val_loss: 1.0860 - val_accuracy: 0.5729
Epoch 59/100
25/25 [==============================] - 36s 1s/step - loss: 0.4149 - accuracy: 0.8250 - val_loss: 1.2052 - val_accuracy: 0.5052
Epoch 60/100
25/25 [==============================] - 36s 1s/step - loss: 0.4006 - accuracy: 0.8062 - val_loss: 0.9254 - val_accuracy: 0.6615
Epoch 61/100
25/25 [==============================] - 36s 1s/step - loss: 0.3485 - accuracy: 0.8712 - val_loss: 1.2242 - val_accuracy: 0.5000
Epoch 62/100
25/25 [==============================] - 36s 1s/step - loss: 0.3578 - accuracy: 0.8612 - val_loss: 1.1742 - val_accuracy: 0.5312
Epoch 63/100
25/25 [==============================] - 35s 1s/step - loss: 0.9528 - accuracy: 0.7188 - val_loss: 1.4248 - val_accuracy: 0.4115
Epoch 64/100
25/25 [==============================] - 35s 1s/step - loss: 0.5106 - accuracy: 0.7962 - val_loss: 1.3560 - val_accuracy: 0.4062
Epoch 65/100
25/25 [==============================] - 35s 1s/step - loss: 0.4529 - accuracy: 0.8075 - val_loss: 1.2284 - val_accuracy: 0.4896
Epoch 66/100
25/25 [==============================] - 35s 1s/step - loss: 0.4449 - accuracy: 0.8238 - val_loss: 1.3032 - val_accuracy: 0.4271
Epoch 67/100
25/25 [==============================] - 37s 1s/step - loss: 0.3620 - accuracy: 0.8512 - val_loss: 1.3937 - val_accuracy: 0.3802
Epoch 68/100
25/25 [==============================] - 36s 1s/step - loss: 0.4211 - accuracy: 0.8413 - val_loss: 1.5752 - val_accuracy: 0.3229
Epoch 69/100
25/25 [==============================] - 35s 1s/step - loss: 0.3619 - accuracy: 0.8500 - val_loss: 1.3213 - val_accuracy: 0.4583
Epoch 70/100
25/25 [==============================] - 35s 1s/step - loss: 0.3436 - accuracy: 0.8587 - val_loss: 1.3979 - val_accuracy: 0.3854
Epoch 71/100
25/25 [==============================] - 35s 1s/step - loss: 0.3347 - accuracy: 0.8550 - val_loss: 1.3089 - val_accuracy: 0.4844
Epoch 72/100
25/25 [==============================] - 35s 1s/step - loss: 0.3278 - accuracy: 0.8562 - val_loss: 1.1956 - val_accuracy: 0.5052
Epoch 73/100
25/25 [==============================] - 35s 1s/step - loss: 0.3228 - accuracy: 0.8687 - val_loss: 1.2078 - val_accuracy: 0.5000
Epoch 74/100
25/25 [==============================] - 35s 1s/step - loss: 0.5337 - accuracy: 0.8037 - val_loss: 1.2706 - val_accuracy: 0.4792
Epoch 75/100
25/25 [==============================] - 35s 1s/step - loss: 0.3490 - accuracy: 0.8650 - val_loss: 1.4795 - val_accuracy: 0.4062
Epoch 76/100
25/25 [==============================] - 35s 1s/step - loss: 0.2937 - accuracy: 0.8737 - val_loss: 1.1618 - val_accuracy: 0.5417
Epoch 77/100
25/25 [==============================] - 35s 1s/step - loss: 0.5818 - accuracy: 0.8112 - val_loss: 1.3942 - val_accuracy: 0.4062
Epoch 78/100
25/25 [==============================] - 35s 1s/step - loss: 0.4328 - accuracy: 0.8225 - val_loss: 1.3289 - val_accuracy: 0.4271
Epoch 79/100
25/25 [==============================] - 37s 1s/step - loss: 0.3534 - accuracy: 0.8625 - val_loss: 1.3902 - val_accuracy: 0.3906
Epoch 80/100
25/25 [==============================] - 39s 2s/step - loss: 0.3293 - accuracy: 0.8725 - val_loss: 1.2934 - val_accuracy: 0.4740
Epoch 81/100
25/25 [==============================] - 36s 1s/step - loss: 0.3620 - accuracy: 0.8562 - val_loss: 1.2229 - val_accuracy: 0.4688
Epoch 82/100
25/25 [==============================] - 35s 1s/step - loss: 0.2888 - accuracy: 0.8813 - val_loss: 1.2308 - val_accuracy: 0.5000
Epoch 83/100
25/25 [==============================] - 35s 1s/step - loss: 0.2521 - accuracy: 0.8975 - val_loss: 1.0596 - val_accuracy: 0.5365
Epoch 84/100
25/25 [==============================] - 35s 1s/step - loss: 0.2750 - accuracy: 0.8725 - val_loss: 1.2119 - val_accuracy: 0.5052
Epoch 85/100
25/25 [==============================] - 35s 1s/step - loss: 0.2639 - accuracy: 0.9087 - val_loss: 1.2608 - val_accuracy: 0.4740
Epoch 86/100
25/25 [==============================] - 35s 1s/step - loss: 0.3473 - accuracy: 0.8512 - val_loss: 1.0966 - val_accuracy: 0.5990
Epoch 87/100
25/25 [==============================] - 35s 1s/step - loss: 0.2814 - accuracy: 0.8800 - val_loss: 1.0908 - val_accuracy: 0.5625
Epoch 88/100
25/25 [==============================] - 35s 1s/step - loss: 0.2442 - accuracy: 0.8988 - val_loss: 1.0714 - val_accuracy: 0.5521
Epoch 89/100
25/25 [==============================] - 35s 1s/step - loss: 0.2632 - accuracy: 0.9000 - val_loss: 1.2409 - val_accuracy: 0.5000
Epoch 90/100
25/25 [==============================] - 35s 1s/step - loss: 0.2928 - accuracy: 0.8687 - val_loss: 1.2651 - val_accuracy: 0.5208
Epoch 91/100
25/25 [==============================] - 35s 1s/step - loss: 0.2357 - accuracy: 0.9025 - val_loss: 1.1588 - val_accuracy: 0.5312
Epoch 92/100
25/25 [==============================] - 35s 1s/step - loss: 0.2177 - accuracy: 0.9075 - val_loss: 1.1720 - val_accuracy: 0.5469
Epoch 93/100
25/25 [==============================] - 35s 1s/step - loss: 0.7621 - accuracy: 0.7962 - val_loss: 1.3168 - val_accuracy: 0.5260
Epoch 94/100
25/25 [==============================] - 35s 1s/step - loss: 0.4913 - accuracy: 0.8150 - val_loss: 1.3253 - val_accuracy: 0.4479
Epoch 95/100
25/25 [==============================] - 35s 1s/step - loss: 0.3095 - accuracy: 0.8850 - val_loss: 1.0981 - val_accuracy: 0.5312
Epoch 96/100
25/25 [==============================] - 35s 1s/step - loss: 0.3121 - accuracy: 0.8662 - val_loss: 1.1353 - val_accuracy: 0.5260
Epoch 97/100
25/25 [==============================] - 35s 1s/step - loss: 0.2517 - accuracy: 0.9038 - val_loss: 1.1186 - val_accuracy: 0.5625
Epoch 98/100
25/25 [==============================] - 35s 1s/step - loss: 0.2424 - accuracy: 0.9112 - val_loss: 1.2868 - val_accuracy: 0.4844
Epoch 99/100
25/25 [==============================] - 35s 1s/step - loss: 0.2683 - accuracy: 0.8900 - val_loss: 1.1035 - val_accuracy: 0.5729
Epoch 100/100
25/25 [==============================] - 35s 1s/step - loss: 0.2120 - accuracy: 0.9075 - val_loss: 1.0550 - val_accuracy: 0.5781
<keras.callbacks.History at 0x2b049b321c0>
model_flat_conv_drop.evaluate(test_ds)
8/8 [==============================] - 4s 260ms/step - loss: 0.9765 - accuracy: 0.6445
[0.9765039086341858, 0.64453125]

Do warstw maxpooling i splotowych

model_pool_conv_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])
model_pool_conv_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_pool_conv_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_5"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_25 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 dropout_22 (Dropout)        (None, 55, 55, 96)        0         
                                                                 
 max_pooling2d_15 (MaxPoolin  (None, 27, 27, 96)       0         
 g2D)                                                            
                                                                 
 dropout_23 (Dropout)        (None, 27, 27, 96)        0         
                                                                 
 conv2d_26 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 dropout_24 (Dropout)        (None, 27, 27, 256)       0         
                                                                 
 max_pooling2d_16 (MaxPoolin  (None, 13, 13, 256)      0         
 g2D)                                                            
                                                                 
 dropout_25 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 conv2d_27 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 dropout_26 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_28 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 dropout_27 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_29 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 dropout_28 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 max_pooling2d_17 (MaxPoolin  (None, 6, 6, 256)        0         
 g2D)                                                            
                                                                 
 dropout_29 (Dropout)        (None, 6, 6, 256)         0         
                                                                 
 flatten_5 (Flatten)         (None, 9216)              0         
                                                                 
 dense_15 (Dense)            (None, 4096)              37752832  
                                                                 
 dense_16 (Dense)            (None, 4096)              16781312  
                                                                 
 dense_17 (Dense)            (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_pool_conv_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 38s 1s/step - loss: 1.8169 - accuracy: 0.2000 - val_loss: 2.2493 - val_accuracy: 0.1875
Epoch 2/100
25/25 [==============================] - 36s 1s/step - loss: 1.6415 - accuracy: 0.2438 - val_loss: 2.2203 - val_accuracy: 0.1979
Epoch 3/100
25/25 [==============================] - 36s 1s/step - loss: 1.5604 - accuracy: 0.2862 - val_loss: 2.1751 - val_accuracy: 0.2083
Epoch 4/100
25/25 [==============================] - 36s 1s/step - loss: 1.5147 - accuracy: 0.3113 - val_loss: 2.1321 - val_accuracy: 0.1927
Epoch 5/100
25/25 [==============================] - 36s 1s/step - loss: 1.3579 - accuracy: 0.4162 - val_loss: 2.0497 - val_accuracy: 0.2865
Epoch 6/100
25/25 [==============================] - 36s 1s/step - loss: 1.3016 - accuracy: 0.4525 - val_loss: 2.0358 - val_accuracy: 0.2344
Epoch 7/100
25/25 [==============================] - 36s 1s/step - loss: 1.2612 - accuracy: 0.4512 - val_loss: 1.9886 - val_accuracy: 0.2292
Epoch 8/100
25/25 [==============================] - 36s 1s/step - loss: 1.3036 - accuracy: 0.4437 - val_loss: 2.0800 - val_accuracy: 0.1927
Epoch 9/100
25/25 [==============================] - 36s 1s/step - loss: 1.1765 - accuracy: 0.4850 - val_loss: 1.8733 - val_accuracy: 0.3021
Epoch 10/100
25/25 [==============================] - 36s 1s/step - loss: 1.2216 - accuracy: 0.5000 - val_loss: 2.0504 - val_accuracy: 0.1927
Epoch 11/100
25/25 [==============================] - 37s 1s/step - loss: 1.1682 - accuracy: 0.4850 - val_loss: 1.9643 - val_accuracy: 0.2396
Epoch 12/100
25/25 [==============================] - 36s 1s/step - loss: 1.1334 - accuracy: 0.5150 - val_loss: 1.9832 - val_accuracy: 0.2292
Epoch 13/100
25/25 [==============================] - 36s 1s/step - loss: 1.0921 - accuracy: 0.5113 - val_loss: 1.8860 - val_accuracy: 0.2500
Epoch 14/100
25/25 [==============================] - 36s 1s/step - loss: 1.0653 - accuracy: 0.5050 - val_loss: 1.8309 - val_accuracy: 0.2604
Epoch 15/100
25/25 [==============================] - 36s 1s/step - loss: 1.0711 - accuracy: 0.5325 - val_loss: 1.8706 - val_accuracy: 0.2604
Epoch 16/100
25/25 [==============================] - 36s 1s/step - loss: 1.0179 - accuracy: 0.5562 - val_loss: 1.8749 - val_accuracy: 0.2188
Epoch 17/100
25/25 [==============================] - 36s 1s/step - loss: 1.0475 - accuracy: 0.5462 - val_loss: 1.8350 - val_accuracy: 0.2240
Epoch 18/100
25/25 [==============================] - 36s 1s/step - loss: 1.0022 - accuracy: 0.5738 - val_loss: 1.6695 - val_accuracy: 0.4115
Epoch 19/100
25/25 [==============================] - 36s 1s/step - loss: 0.9710 - accuracy: 0.5938 - val_loss: 1.8079 - val_accuracy: 0.2240
Epoch 20/100
25/25 [==============================] - 36s 1s/step - loss: 1.0680 - accuracy: 0.5612 - val_loss: 1.7820 - val_accuracy: 0.2500
Epoch 21/100
25/25 [==============================] - 36s 1s/step - loss: 1.0123 - accuracy: 0.5713 - val_loss: 1.7886 - val_accuracy: 0.2500
Epoch 22/100
25/25 [==============================] - 36s 1s/step - loss: 0.9476 - accuracy: 0.6100 - val_loss: 1.6905 - val_accuracy: 0.3125
Epoch 23/100
25/25 [==============================] - 36s 1s/step - loss: 0.9235 - accuracy: 0.6000 - val_loss: 1.6969 - val_accuracy: 0.3073
Epoch 24/100
25/25 [==============================] - 36s 1s/step - loss: 0.8894 - accuracy: 0.5987 - val_loss: 1.7731 - val_accuracy: 0.2396
Epoch 25/100
25/25 [==============================] - 36s 1s/step - loss: 0.9201 - accuracy: 0.6212 - val_loss: 1.7130 - val_accuracy: 0.2448
Epoch 26/100
25/25 [==============================] - 36s 1s/step - loss: 0.9261 - accuracy: 0.6150 - val_loss: 1.7654 - val_accuracy: 0.2552
Epoch 27/100
25/25 [==============================] - 36s 1s/step - loss: 0.9241 - accuracy: 0.6250 - val_loss: 1.6630 - val_accuracy: 0.3021
Epoch 28/100
25/25 [==============================] - 36s 1s/step - loss: 0.9109 - accuracy: 0.6200 - val_loss: 1.5995 - val_accuracy: 0.3542
Epoch 29/100
25/25 [==============================] - 36s 1s/step - loss: 0.8485 - accuracy: 0.6450 - val_loss: 1.7325 - val_accuracy: 0.2344
Epoch 30/100
25/25 [==============================] - 36s 1s/step - loss: 0.8655 - accuracy: 0.6388 - val_loss: 1.6539 - val_accuracy: 0.3229
Epoch 31/100
25/25 [==============================] - 36s 1s/step - loss: 0.8572 - accuracy: 0.6338 - val_loss: 1.7899 - val_accuracy: 0.2240
Epoch 32/100
25/25 [==============================] - 36s 1s/step - loss: 0.9136 - accuracy: 0.6313 - val_loss: 1.7606 - val_accuracy: 0.2240
Epoch 33/100
25/25 [==============================] - 36s 1s/step - loss: 0.7934 - accuracy: 0.6550 - val_loss: 1.7149 - val_accuracy: 0.2292
Epoch 34/100
25/25 [==============================] - 36s 1s/step - loss: 0.8042 - accuracy: 0.6463 - val_loss: 1.7325 - val_accuracy: 0.2604
Epoch 35/100
25/25 [==============================] - 36s 1s/step - loss: 0.8510 - accuracy: 0.6388 - val_loss: 1.6244 - val_accuracy: 0.3021
Epoch 36/100
25/25 [==============================] - 36s 1s/step - loss: 0.7933 - accuracy: 0.6562 - val_loss: 1.7268 - val_accuracy: 0.2552
Epoch 37/100
25/25 [==============================] - 36s 1s/step - loss: 0.7170 - accuracy: 0.7075 - val_loss: 1.4832 - val_accuracy: 0.4323
Epoch 38/100
25/25 [==============================] - 36s 1s/step - loss: 0.8339 - accuracy: 0.6413 - val_loss: 1.6859 - val_accuracy: 0.2604
Epoch 39/100
25/25 [==============================] - 36s 1s/step - loss: 0.7030 - accuracy: 0.6825 - val_loss: 1.6517 - val_accuracy: 0.2500
Epoch 40/100
25/25 [==============================] - 36s 1s/step - loss: 0.7162 - accuracy: 0.6913 - val_loss: 1.6911 - val_accuracy: 0.2708
Epoch 41/100
25/25 [==============================] - 36s 1s/step - loss: 0.7770 - accuracy: 0.6650 - val_loss: 1.6254 - val_accuracy: 0.3125
Epoch 42/100
25/25 [==============================] - 36s 1s/step - loss: 0.6581 - accuracy: 0.7225 - val_loss: 1.6136 - val_accuracy: 0.3229
Epoch 43/100
25/25 [==============================] - 36s 1s/step - loss: 0.6846 - accuracy: 0.7100 - val_loss: 1.6485 - val_accuracy: 0.2865
Epoch 44/100
25/25 [==============================] - 36s 1s/step - loss: 0.6980 - accuracy: 0.6888 - val_loss: 1.7597 - val_accuracy: 0.2552
Epoch 45/100
25/25 [==============================] - 36s 1s/step - loss: 0.6496 - accuracy: 0.7400 - val_loss: 1.6483 - val_accuracy: 0.3073
Epoch 46/100
25/25 [==============================] - 36s 1s/step - loss: 0.6251 - accuracy: 0.7250 - val_loss: 1.6830 - val_accuracy: 0.2917
Epoch 47/100
25/25 [==============================] - 36s 1s/step - loss: 0.6244 - accuracy: 0.7163 - val_loss: 1.6909 - val_accuracy: 0.3177
Epoch 48/100
25/25 [==============================] - 36s 1s/step - loss: 0.7036 - accuracy: 0.7088 - val_loss: 1.6145 - val_accuracy: 0.2708
Epoch 49/100
25/25 [==============================] - 36s 1s/step - loss: 0.6414 - accuracy: 0.7088 - val_loss: 1.8017 - val_accuracy: 0.2500
Epoch 50/100
25/25 [==============================] - 36s 1s/step - loss: 0.6729 - accuracy: 0.6988 - val_loss: 1.6652 - val_accuracy: 0.3229
Epoch 51/100
25/25 [==============================] - 36s 1s/step - loss: 0.5843 - accuracy: 0.7350 - val_loss: 1.5871 - val_accuracy: 0.3385
Epoch 52/100
25/25 [==============================] - 36s 1s/step - loss: 0.6044 - accuracy: 0.7300 - val_loss: 1.6579 - val_accuracy: 0.2708
Epoch 53/100
25/25 [==============================] - 36s 1s/step - loss: 0.5451 - accuracy: 0.7475 - val_loss: 1.6316 - val_accuracy: 0.3125
Epoch 54/100
25/25 [==============================] - 36s 1s/step - loss: 0.5658 - accuracy: 0.7475 - val_loss: 1.4053 - val_accuracy: 0.4635
Epoch 55/100
25/25 [==============================] - 36s 1s/step - loss: 0.5437 - accuracy: 0.7500 - val_loss: 1.8277 - val_accuracy: 0.2448
Epoch 56/100
25/25 [==============================] - 36s 1s/step - loss: 0.5834 - accuracy: 0.7462 - val_loss: 1.9969 - val_accuracy: 0.2292
Epoch 57/100
25/25 [==============================] - 36s 1s/step - loss: 0.5382 - accuracy: 0.7462 - val_loss: 1.6513 - val_accuracy: 0.3229
Epoch 58/100
25/25 [==============================] - 36s 1s/step - loss: 0.5030 - accuracy: 0.7825 - val_loss: 1.6703 - val_accuracy: 0.3490
Epoch 59/100
25/25 [==============================] - 36s 1s/step - loss: 0.6065 - accuracy: 0.7275 - val_loss: 1.6761 - val_accuracy: 0.2708
Epoch 60/100
25/25 [==============================] - 36s 1s/step - loss: 0.5541 - accuracy: 0.7625 - val_loss: 1.6730 - val_accuracy: 0.2500
Epoch 61/100
25/25 [==============================] - 37s 1s/step - loss: 0.4906 - accuracy: 0.7713 - val_loss: 1.6541 - val_accuracy: 0.2865
Epoch 62/100
25/25 [==============================] - 36s 1s/step - loss: 0.5298 - accuracy: 0.7675 - val_loss: 1.7023 - val_accuracy: 0.2865
Epoch 63/100
25/25 [==============================] - 36s 1s/step - loss: 0.4985 - accuracy: 0.7875 - val_loss: 1.9830 - val_accuracy: 0.2344
Epoch 64/100
25/25 [==============================] - 36s 1s/step - loss: 0.4888 - accuracy: 0.7750 - val_loss: 1.6680 - val_accuracy: 0.2969
Epoch 65/100
25/25 [==============================] - 36s 1s/step - loss: 0.4419 - accuracy: 0.7875 - val_loss: 1.8855 - val_accuracy: 0.2656
Epoch 66/100
25/25 [==============================] - 36s 1s/step - loss: 0.4638 - accuracy: 0.7800 - val_loss: 1.6730 - val_accuracy: 0.3229
Epoch 67/100
25/25 [==============================] - 38s 2s/step - loss: 0.4665 - accuracy: 0.7875 - val_loss: 1.7077 - val_accuracy: 0.3229
Epoch 68/100
25/25 [==============================] - 36s 1s/step - loss: 0.4436 - accuracy: 0.7837 - val_loss: 1.8192 - val_accuracy: 0.3073
Epoch 69/100
25/25 [==============================] - 36s 1s/step - loss: 0.4956 - accuracy: 0.7800 - val_loss: 1.7902 - val_accuracy: 0.2917
Epoch 70/100
25/25 [==============================] - 36s 1s/step - loss: 0.4772 - accuracy: 0.7875 - val_loss: 1.7419 - val_accuracy: 0.2969
Epoch 71/100
25/25 [==============================] - 36s 1s/step - loss: 0.3955 - accuracy: 0.8263 - val_loss: 1.8084 - val_accuracy: 0.2708
Epoch 72/100
25/25 [==============================] - 36s 1s/step - loss: 0.4335 - accuracy: 0.8037 - val_loss: 1.8921 - val_accuracy: 0.2812
Epoch 73/100
25/25 [==============================] - 36s 1s/step - loss: 0.4031 - accuracy: 0.8138 - val_loss: 1.9873 - val_accuracy: 0.2656
Epoch 74/100
25/25 [==============================] - 38s 1s/step - loss: 1.2079 - accuracy: 0.6175 - val_loss: 1.9448 - val_accuracy: 0.2188
Epoch 75/100
25/25 [==============================] - 36s 1s/step - loss: 0.6683 - accuracy: 0.7350 - val_loss: 1.9602 - val_accuracy: 0.2396
Epoch 76/100
25/25 [==============================] - 36s 1s/step - loss: 0.5714 - accuracy: 0.7725 - val_loss: 1.5198 - val_accuracy: 0.3333
Epoch 77/100
25/25 [==============================] - 36s 1s/step - loss: 0.4513 - accuracy: 0.7950 - val_loss: 1.6600 - val_accuracy: 0.3021
Epoch 78/100
25/25 [==============================] - 36s 1s/step - loss: 0.4323 - accuracy: 0.8062 - val_loss: 1.7079 - val_accuracy: 0.3177
Epoch 79/100
25/25 [==============================] - 36s 1s/step - loss: 0.4245 - accuracy: 0.8037 - val_loss: 1.8053 - val_accuracy: 0.2708
Epoch 80/100
25/25 [==============================] - 37s 1s/step - loss: 0.4046 - accuracy: 0.8163 - val_loss: 1.8561 - val_accuracy: 0.2760
Epoch 81/100
25/25 [==============================] - 36s 1s/step - loss: 0.4789 - accuracy: 0.7775 - val_loss: 1.9273 - val_accuracy: 0.2552
Epoch 82/100
25/25 [==============================] - 36s 1s/step - loss: 0.4086 - accuracy: 0.8138 - val_loss: 2.1020 - val_accuracy: 0.2656
Epoch 83/100
25/25 [==============================] - 36s 1s/step - loss: 0.4059 - accuracy: 0.8238 - val_loss: 2.0258 - val_accuracy: 0.2917
Epoch 84/100
25/25 [==============================] - 36s 1s/step - loss: 0.3803 - accuracy: 0.8163 - val_loss: 1.7981 - val_accuracy: 0.2812
Epoch 85/100
25/25 [==============================] - 36s 1s/step - loss: 0.4042 - accuracy: 0.8138 - val_loss: 1.7933 - val_accuracy: 0.2083
Epoch 86/100
25/25 [==============================] - 37s 1s/step - loss: 0.4212 - accuracy: 0.8413 - val_loss: 1.6624 - val_accuracy: 0.2812
Epoch 87/100
25/25 [==============================] - 36s 1s/step - loss: 0.3808 - accuracy: 0.8363 - val_loss: 2.4115 - val_accuracy: 0.2292
Epoch 88/100
25/25 [==============================] - 36s 1s/step - loss: 0.6500 - accuracy: 0.7550 - val_loss: 1.9146 - val_accuracy: 0.2396
Epoch 89/100
25/25 [==============================] - 36s 1s/step - loss: 0.4128 - accuracy: 0.8188 - val_loss: 2.1177 - val_accuracy: 0.2500
Epoch 90/100
25/25 [==============================] - 36s 1s/step - loss: 0.3811 - accuracy: 0.8313 - val_loss: 2.1652 - val_accuracy: 0.2396
Epoch 91/100
25/25 [==============================] - 36s 1s/step - loss: 0.3584 - accuracy: 0.8363 - val_loss: 1.9992 - val_accuracy: 0.2604
Epoch 92/100
25/25 [==============================] - 37s 1s/step - loss: 0.3575 - accuracy: 0.8375 - val_loss: 1.9204 - val_accuracy: 0.2656
Epoch 93/100
25/25 [==============================] - 36s 1s/step - loss: 0.3357 - accuracy: 0.8413 - val_loss: 2.0910 - val_accuracy: 0.2396
Epoch 94/100
25/25 [==============================] - 36s 1s/step - loss: 0.4440 - accuracy: 0.8175 - val_loss: 2.1375 - val_accuracy: 0.2292
Epoch 95/100
25/25 [==============================] - 36s 1s/step - loss: 0.3838 - accuracy: 0.8300 - val_loss: 2.0104 - val_accuracy: 0.2708
Epoch 96/100
25/25 [==============================] - 36s 1s/step - loss: 0.3214 - accuracy: 0.8575 - val_loss: 2.2511 - val_accuracy: 0.2552
Epoch 97/100
25/25 [==============================] - 36s 1s/step - loss: 0.3630 - accuracy: 0.8300 - val_loss: 2.1232 - val_accuracy: 0.2604
Epoch 98/100
25/25 [==============================] - 38s 2s/step - loss: 0.3356 - accuracy: 0.8512 - val_loss: 2.0751 - val_accuracy: 0.2865
Epoch 99/100
25/25 [==============================] - 38s 2s/step - loss: 0.3300 - accuracy: 0.8475 - val_loss: 1.9835 - val_accuracy: 0.3073
Epoch 100/100
25/25 [==============================] - 37s 1s/step - loss: 0.3392 - accuracy: 0.8500 - val_loss: 2.2578 - val_accuracy: 0.2552
<keras.callbacks.History at 0x2b04c65e7f0>
model_pool_conv_drop.evaluate(test_ds)
8/8 [==============================] - 2s 269ms/step - loss: 2.1567 - accuracy: 0.2891
[2.1567039489746094, 0.2890625]

Do warstw spłaszczonych, maxpooling i splotowych

model_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(10, activation='softmax')
])
model_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_6"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_30 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 dropout_30 (Dropout)        (None, 55, 55, 96)        0         
                                                                 
 max_pooling2d_18 (MaxPoolin  (None, 27, 27, 96)       0         
 g2D)                                                            
                                                                 
 dropout_31 (Dropout)        (None, 27, 27, 96)        0         
                                                                 
 conv2d_31 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 dropout_32 (Dropout)        (None, 27, 27, 256)       0         
                                                                 
 max_pooling2d_19 (MaxPoolin  (None, 13, 13, 256)      0         
 g2D)                                                            
                                                                 
 dropout_33 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 conv2d_32 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 dropout_34 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_33 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 dropout_35 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_34 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 dropout_36 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 max_pooling2d_20 (MaxPoolin  (None, 6, 6, 256)        0         
 g2D)                                                            
                                                                 
 dropout_37 (Dropout)        (None, 6, 6, 256)         0         
                                                                 
 flatten_6 (Flatten)         (None, 9216)              0         
                                                                 
 dense_18 (Dense)            (None, 4096)              37752832  
                                                                 
 dropout_38 (Dropout)        (None, 4096)              0         
                                                                 
 dense_19 (Dense)            (None, 4096)              16781312  
                                                                 
 dropout_39 (Dropout)        (None, 4096)              0         
                                                                 
 dense_20 (Dense)            (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,322,314
Trainable params: 58,322,314
Non-trainable params: 0
_________________________________________________________________
model_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 39s 1s/step - loss: 1.9247 - accuracy: 0.1900 - val_loss: 2.2491 - val_accuracy: 0.1875
Epoch 2/100
25/25 [==============================] - 38s 2s/step - loss: 1.7130 - accuracy: 0.2062 - val_loss: 2.2165 - val_accuracy: 0.1771
Epoch 3/100
25/25 [==============================] - 39s 2s/step - loss: 1.6761 - accuracy: 0.2350 - val_loss: 2.1936 - val_accuracy: 0.2292
Epoch 4/100
25/25 [==============================] - 37s 1s/step - loss: 1.6171 - accuracy: 0.2500 - val_loss: 2.1467 - val_accuracy: 0.1927
Epoch 5/100
25/25 [==============================] - 37s 1s/step - loss: 1.5317 - accuracy: 0.3175 - val_loss: 2.0777 - val_accuracy: 0.1927
Epoch 6/100
25/25 [==============================] - 37s 1s/step - loss: 1.4446 - accuracy: 0.3938 - val_loss: 2.0430 - val_accuracy: 0.1979
Epoch 7/100
25/25 [==============================] - 37s 1s/step - loss: 1.3851 - accuracy: 0.3787 - val_loss: 1.9749 - val_accuracy: 0.2188
Epoch 8/100
25/25 [==============================] - 36s 1s/step - loss: 1.3739 - accuracy: 0.4100 - val_loss: 1.9833 - val_accuracy: 0.2135
Epoch 9/100
25/25 [==============================] - 36s 1s/step - loss: 1.3105 - accuracy: 0.4212 - val_loss: 1.9121 - val_accuracy: 0.2448
Epoch 10/100
25/25 [==============================] - 37s 1s/step - loss: 1.2919 - accuracy: 0.4212 - val_loss: 1.9497 - val_accuracy: 0.2240
Epoch 11/100
25/25 [==============================] - 36s 1s/step - loss: 1.2476 - accuracy: 0.4750 - val_loss: 1.9766 - val_accuracy: 0.2083
Epoch 12/100
25/25 [==============================] - 36s 1s/step - loss: 1.2704 - accuracy: 0.4325 - val_loss: 2.0245 - val_accuracy: 0.1823
Epoch 13/100
25/25 [==============================] - 36s 1s/step - loss: 1.1780 - accuracy: 0.4725 - val_loss: 1.9085 - val_accuracy: 0.2240
Epoch 14/100
25/25 [==============================] - 36s 1s/step - loss: 1.1744 - accuracy: 0.4750 - val_loss: 1.8902 - val_accuracy: 0.2135
Epoch 15/100
25/25 [==============================] - 36s 1s/step - loss: 1.2046 - accuracy: 0.4638 - val_loss: 1.9528 - val_accuracy: 0.2031
Epoch 16/100
25/25 [==============================] - 36s 1s/step - loss: 1.2021 - accuracy: 0.5000 - val_loss: 1.9438 - val_accuracy: 0.2031
Epoch 17/100
25/25 [==============================] - 37s 1s/step - loss: 1.1076 - accuracy: 0.5113 - val_loss: 1.9135 - val_accuracy: 0.2031
Epoch 18/100
25/25 [==============================] - 40s 2s/step - loss: 1.0509 - accuracy: 0.5250 - val_loss: 1.8978 - val_accuracy: 0.2135
Epoch 19/100
25/25 [==============================] - 37s 1s/step - loss: 1.1375 - accuracy: 0.5163 - val_loss: 1.8838 - val_accuracy: 0.2135
Epoch 20/100
25/25 [==============================] - 36s 1s/step - loss: 1.0640 - accuracy: 0.5462 - val_loss: 1.9466 - val_accuracy: 0.2031
Epoch 21/100
25/25 [==============================] - 36s 1s/step - loss: 1.0863 - accuracy: 0.5163 - val_loss: 1.9305 - val_accuracy: 0.2083
Epoch 22/100
25/25 [==============================] - 36s 1s/step - loss: 1.0853 - accuracy: 0.5288 - val_loss: 1.9383 - val_accuracy: 0.2083
Epoch 23/100
25/25 [==============================] - 36s 1s/step - loss: 1.0640 - accuracy: 0.5288 - val_loss: 1.9474 - val_accuracy: 0.2031
Epoch 24/100
25/25 [==============================] - 36s 1s/step - loss: 1.0696 - accuracy: 0.5437 - val_loss: 1.8716 - val_accuracy: 0.2031
Epoch 25/100
25/25 [==============================] - 36s 1s/step - loss: 1.0901 - accuracy: 0.5387 - val_loss: 1.9141 - val_accuracy: 0.1979
Epoch 26/100
25/25 [==============================] - 36s 1s/step - loss: 1.0558 - accuracy: 0.5312 - val_loss: 1.8808 - val_accuracy: 0.1927
Epoch 27/100
25/25 [==============================] - 36s 1s/step - loss: 1.0350 - accuracy: 0.5562 - val_loss: 1.9078 - val_accuracy: 0.2083
Epoch 28/100
25/25 [==============================] - 36s 1s/step - loss: 1.0032 - accuracy: 0.5487 - val_loss: 1.9923 - val_accuracy: 0.1823
Epoch 29/100
25/25 [==============================] - 36s 1s/step - loss: 1.0444 - accuracy: 0.5525 - val_loss: 1.8429 - val_accuracy: 0.2135
Epoch 30/100
25/25 [==============================] - 36s 1s/step - loss: 1.0202 - accuracy: 0.5512 - val_loss: 1.8479 - val_accuracy: 0.2135
Epoch 31/100
25/25 [==============================] - 36s 1s/step - loss: 1.0019 - accuracy: 0.5537 - val_loss: 1.9275 - val_accuracy: 0.2135
Epoch 32/100
25/25 [==============================] - 36s 1s/step - loss: 1.0272 - accuracy: 0.5437 - val_loss: 1.9026 - val_accuracy: 0.2031
Epoch 33/100
25/25 [==============================] - 36s 1s/step - loss: 0.9633 - accuracy: 0.5663 - val_loss: 1.9349 - val_accuracy: 0.2031
Epoch 34/100
25/25 [==============================] - 36s 1s/step - loss: 1.0038 - accuracy: 0.5688 - val_loss: 1.9385 - val_accuracy: 0.1979
Epoch 35/100
25/25 [==============================] - 36s 1s/step - loss: 0.9373 - accuracy: 0.5900 - val_loss: 2.0208 - val_accuracy: 0.2031
Epoch 36/100
25/25 [==============================] - 36s 1s/step - loss: 0.9253 - accuracy: 0.5888 - val_loss: 1.9166 - val_accuracy: 0.2031
Epoch 37/100
25/25 [==============================] - 36s 1s/step - loss: 0.9618 - accuracy: 0.5788 - val_loss: 1.8177 - val_accuracy: 0.1979
Epoch 38/100
25/25 [==============================] - 36s 1s/step - loss: 0.9833 - accuracy: 0.5688 - val_loss: 1.9429 - val_accuracy: 0.1979
Epoch 39/100
25/25 [==============================] - 36s 1s/step - loss: 0.9389 - accuracy: 0.5888 - val_loss: 1.8995 - val_accuracy: 0.1979
Epoch 40/100
25/25 [==============================] - 36s 1s/step - loss: 0.9457 - accuracy: 0.5775 - val_loss: 1.9466 - val_accuracy: 0.2083
Epoch 41/100
25/25 [==============================] - 36s 1s/step - loss: 0.9740 - accuracy: 0.5738 - val_loss: 1.7971 - val_accuracy: 0.2240
Epoch 42/100
25/25 [==============================] - 36s 1s/step - loss: 0.9194 - accuracy: 0.5975 - val_loss: 2.0969 - val_accuracy: 0.1823
Epoch 43/100
25/25 [==============================] - 36s 1s/step - loss: 0.9476 - accuracy: 0.5900 - val_loss: 1.8180 - val_accuracy: 0.2083
Epoch 44/100
25/25 [==============================] - 36s 1s/step - loss: 0.9245 - accuracy: 0.6000 - val_loss: 1.8373 - val_accuracy: 0.2188
Epoch 45/100
25/25 [==============================] - 36s 1s/step - loss: 0.9001 - accuracy: 0.5925 - val_loss: 1.8846 - val_accuracy: 0.2083
Epoch 46/100
25/25 [==============================] - 36s 1s/step - loss: 0.8989 - accuracy: 0.5962 - val_loss: 2.0002 - val_accuracy: 0.1979
Epoch 47/100
25/25 [==============================] - 36s 1s/step - loss: 0.8539 - accuracy: 0.6288 - val_loss: 1.9201 - val_accuracy: 0.1927
Epoch 48/100
25/25 [==============================] - 36s 1s/step - loss: 0.9051 - accuracy: 0.6263 - val_loss: 1.9303 - val_accuracy: 0.2083
Epoch 49/100
25/25 [==============================] - 36s 1s/step - loss: 0.8572 - accuracy: 0.6363 - val_loss: 1.8043 - val_accuracy: 0.2135
Epoch 50/100
25/25 [==============================] - 36s 1s/step - loss: 0.8245 - accuracy: 0.6513 - val_loss: 1.9120 - val_accuracy: 0.2083
Epoch 51/100
25/25 [==============================] - 36s 1s/step - loss: 0.8384 - accuracy: 0.6463 - val_loss: 1.8960 - val_accuracy: 0.2031
Epoch 52/100
25/25 [==============================] - 36s 1s/step - loss: 0.8193 - accuracy: 0.6375 - val_loss: 1.6472 - val_accuracy: 0.2969
Epoch 53/100
25/25 [==============================] - 36s 1s/step - loss: 0.8076 - accuracy: 0.6712 - val_loss: 2.0521 - val_accuracy: 0.2031
Epoch 54/100
25/25 [==============================] - 38s 1s/step - loss: 0.8572 - accuracy: 0.6225 - val_loss: 2.0045 - val_accuracy: 0.2135
Epoch 55/100
25/25 [==============================] - 36s 1s/step - loss: 0.8142 - accuracy: 0.6600 - val_loss: 1.9518 - val_accuracy: 0.2083
Epoch 56/100
25/25 [==============================] - 36s 1s/step - loss: 0.8600 - accuracy: 0.6538 - val_loss: 1.7073 - val_accuracy: 0.2604
Epoch 57/100
25/25 [==============================] - 36s 1s/step - loss: 0.7840 - accuracy: 0.6850 - val_loss: 1.9704 - val_accuracy: 0.2031
Epoch 58/100
25/25 [==============================] - 36s 1s/step - loss: 0.7923 - accuracy: 0.6825 - val_loss: 1.8118 - val_accuracy: 0.2500
Epoch 59/100
25/25 [==============================] - 36s 1s/step - loss: 0.7204 - accuracy: 0.6938 - val_loss: 1.9559 - val_accuracy: 0.2292
Epoch 60/100
25/25 [==============================] - 37s 1s/step - loss: 0.7991 - accuracy: 0.6488 - val_loss: 1.9263 - val_accuracy: 0.2135
Epoch 61/100
25/25 [==============================] - 36s 1s/step - loss: 0.7813 - accuracy: 0.6725 - val_loss: 1.8279 - val_accuracy: 0.2448
Epoch 62/100
25/25 [==============================] - 36s 1s/step - loss: 0.7738 - accuracy: 0.6750 - val_loss: 2.1088 - val_accuracy: 0.2188
Epoch 63/100
25/25 [==============================] - 36s 1s/step - loss: 0.7300 - accuracy: 0.6938 - val_loss: 2.0727 - val_accuracy: 0.2135
Epoch 64/100
25/25 [==============================] - 36s 1s/step - loss: 0.7127 - accuracy: 0.7025 - val_loss: 1.9929 - val_accuracy: 0.2292
Epoch 65/100
25/25 [==============================] - 38s 1s/step - loss: 0.7034 - accuracy: 0.7200 - val_loss: 2.1949 - val_accuracy: 0.1979
Epoch 66/100
25/25 [==============================] - 38s 1s/step - loss: 0.7238 - accuracy: 0.6888 - val_loss: 2.1694 - val_accuracy: 0.2240
Epoch 67/100
25/25 [==============================] - 36s 1s/step - loss: 0.7244 - accuracy: 0.7000 - val_loss: 2.2779 - val_accuracy: 0.2031
Epoch 68/100
25/25 [==============================] - 36s 1s/step - loss: 0.6549 - accuracy: 0.7237 - val_loss: 2.1810 - val_accuracy: 0.2240
Epoch 69/100
25/25 [==============================] - 36s 1s/step - loss: 0.5940 - accuracy: 0.7487 - val_loss: 1.9802 - val_accuracy: 0.2552
Epoch 70/100
25/25 [==============================] - 36s 1s/step - loss: 0.6346 - accuracy: 0.7300 - val_loss: 2.4555 - val_accuracy: 0.2083
Epoch 71/100
25/25 [==============================] - 36s 1s/step - loss: 0.5913 - accuracy: 0.7437 - val_loss: 2.3821 - val_accuracy: 0.2240
Epoch 72/100
25/25 [==============================] - 36s 1s/step - loss: 0.5870 - accuracy: 0.7312 - val_loss: 2.0892 - val_accuracy: 0.2292
Epoch 73/100
25/25 [==============================] - 36s 1s/step - loss: 0.8009 - accuracy: 0.6600 - val_loss: 2.1879 - val_accuracy: 0.2292
Epoch 74/100
25/25 [==============================] - 36s 1s/step - loss: 0.6669 - accuracy: 0.7125 - val_loss: 2.1540 - val_accuracy: 0.2344
Epoch 75/100
25/25 [==============================] - 36s 1s/step - loss: 0.6351 - accuracy: 0.7325 - val_loss: 1.9588 - val_accuracy: 0.2344
Epoch 76/100
25/25 [==============================] - 38s 2s/step - loss: 0.6817 - accuracy: 0.7237 - val_loss: 2.0462 - val_accuracy: 0.2292
Epoch 77/100
25/25 [==============================] - 36s 1s/step - loss: 0.6122 - accuracy: 0.7538 - val_loss: 2.0432 - val_accuracy: 0.2344
Epoch 78/100
25/25 [==============================] - 37s 1s/step - loss: 0.5707 - accuracy: 0.7625 - val_loss: 2.4277 - val_accuracy: 0.2240
Epoch 79/100
25/25 [==============================] - 36s 1s/step - loss: 0.6518 - accuracy: 0.7300 - val_loss: 1.9735 - val_accuracy: 0.2448
Epoch 80/100
25/25 [==============================] - 36s 1s/step - loss: 0.5680 - accuracy: 0.7613 - val_loss: 1.8923 - val_accuracy: 0.2760
Epoch 81/100
25/25 [==============================] - 36s 1s/step - loss: 0.6130 - accuracy: 0.7412 - val_loss: 1.9575 - val_accuracy: 0.2812
Epoch 82/100
25/25 [==============================] - 36s 1s/step - loss: 0.5543 - accuracy: 0.7750 - val_loss: 1.9804 - val_accuracy: 0.2656
Epoch 83/100
25/25 [==============================] - 36s 1s/step - loss: 0.5484 - accuracy: 0.7588 - val_loss: 2.0896 - val_accuracy: 0.2552
Epoch 84/100
25/25 [==============================] - 36s 1s/step - loss: 0.5875 - accuracy: 0.7500 - val_loss: 2.1894 - val_accuracy: 0.2344
Epoch 85/100
25/25 [==============================] - 36s 1s/step - loss: 0.5803 - accuracy: 0.7588 - val_loss: 2.0186 - val_accuracy: 0.2240
Epoch 86/100
25/25 [==============================] - 36s 1s/step - loss: 0.5683 - accuracy: 0.7688 - val_loss: 2.3338 - val_accuracy: 0.2344
Epoch 87/100
25/25 [==============================] - 36s 1s/step - loss: 0.5192 - accuracy: 0.7613 - val_loss: 2.2686 - val_accuracy: 0.2240
Epoch 88/100
25/25 [==============================] - 36s 1s/step - loss: 0.4986 - accuracy: 0.7713 - val_loss: 2.2567 - val_accuracy: 0.2344
Epoch 89/100
25/25 [==============================] - 36s 1s/step - loss: 0.4916 - accuracy: 0.7925 - val_loss: 2.4030 - val_accuracy: 0.2344
Epoch 90/100
25/25 [==============================] - 36s 1s/step - loss: 0.5215 - accuracy: 0.7700 - val_loss: 2.1048 - val_accuracy: 0.2396
Epoch 91/100
25/25 [==============================] - 36s 1s/step - loss: 0.4871 - accuracy: 0.7850 - val_loss: 2.4577 - val_accuracy: 0.2292
Epoch 92/100
25/25 [==============================] - 36s 1s/step - loss: 0.5142 - accuracy: 0.7688 - val_loss: 2.3448 - val_accuracy: 0.2344
Epoch 93/100
25/25 [==============================] - 36s 1s/step - loss: 0.5245 - accuracy: 0.7837 - val_loss: 2.6430 - val_accuracy: 0.2083
Epoch 94/100
25/25 [==============================] - 37s 1s/step - loss: 0.4893 - accuracy: 0.7700 - val_loss: 2.2934 - val_accuracy: 0.2865
Epoch 95/100
25/25 [==============================] - 39s 2s/step - loss: 0.5475 - accuracy: 0.7675 - val_loss: 1.9955 - val_accuracy: 0.2656
Epoch 96/100
25/25 [==============================] - 37s 1s/step - loss: 0.4791 - accuracy: 0.7900 - val_loss: 2.2937 - val_accuracy: 0.2448
Epoch 97/100
25/25 [==============================] - 37s 1s/step - loss: 0.5287 - accuracy: 0.7750 - val_loss: 2.1882 - val_accuracy: 0.2344
Epoch 98/100
25/25 [==============================] - 36s 1s/step - loss: 0.4331 - accuracy: 0.8150 - val_loss: 2.3296 - val_accuracy: 0.2396
Epoch 99/100
25/25 [==============================] - 37s 1s/step - loss: 0.4675 - accuracy: 0.8000 - val_loss: 2.7121 - val_accuracy: 0.2240
Epoch 100/100
25/25 [==============================] - 36s 1s/step - loss: 0.5437 - accuracy: 0.7738 - val_loss: 2.6578 - val_accuracy: 0.2292
<keras.callbacks.History at 0x2b049b91670>
model_drop.evaluate(test_ds)
8/8 [==============================] - 3s 269ms/step - loss: 2.6610 - accuracy: 0.2227
[2.6609723567962646, 0.22265625]

Batch Regularization

Bez dropoutu

model_batch = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.BatchNormalization(),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])
model_batch.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_batch.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_7"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_35 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 batch_normalization (BatchN  (None, 55, 55, 96)       384       
 ormalization)                                                   
                                                                 
 max_pooling2d_21 (MaxPoolin  (None, 27, 27, 96)       0         
 g2D)                                                            
                                                                 
 conv2d_36 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 batch_normalization_1 (Batc  (None, 27, 27, 256)      1024      
 hNormalization)                                                 
                                                                 
 max_pooling2d_22 (MaxPoolin  (None, 13, 13, 256)      0         
 g2D)                                                            
                                                                 
 conv2d_37 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 batch_normalization_2 (Batc  (None, 13, 13, 384)      1536      
 hNormalization)                                                 
                                                                 
 conv2d_38 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 batch_normalization_3 (Batc  (None, 13, 13, 384)      1536      
 hNormalization)                                                 
                                                                 
 conv2d_39 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 batch_normalization_4 (Batc  (None, 13, 13, 256)      1024      
 hNormalization)                                                 
                                                                 
 max_pooling2d_23 (MaxPoolin  (None, 6, 6, 256)        0         
 g2D)                                                            
                                                                 
 flatten_7 (Flatten)         (None, 9216)              0         
                                                                 
 dense_21 (Dense)            (None, 4096)              37752832  
                                                                 
 dense_22 (Dense)            (None, 4096)              16781312  
                                                                 
 dense_23 (Dense)            (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,327,818
Trainable params: 58,325,066
Non-trainable params: 2,752
_________________________________________________________________
model_batch.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 40s 1s/step - loss: 3.1972 - accuracy: 0.5163 - val_loss: 2.0980 - val_accuracy: 0.1979
Epoch 2/100
25/25 [==============================] - 37s 1s/step - loss: 0.4927 - accuracy: 0.8238 - val_loss: 2.2667 - val_accuracy: 0.1823
Epoch 3/100
25/25 [==============================] - 37s 1s/step - loss: 0.2552 - accuracy: 0.9150 - val_loss: 2.7730 - val_accuracy: 0.1771
Epoch 4/100
25/25 [==============================] - 36s 1s/step - loss: 0.1681 - accuracy: 0.9475 - val_loss: 3.5623 - val_accuracy: 0.1719
Epoch 5/100
25/25 [==============================] - 36s 1s/step - loss: 0.0812 - accuracy: 0.9837 - val_loss: 4.0812 - val_accuracy: 0.1667
Epoch 6/100
25/25 [==============================] - 36s 1s/step - loss: 0.0845 - accuracy: 0.9825 - val_loss: 4.5273 - val_accuracy: 0.1771
Epoch 7/100
25/25 [==============================] - 36s 1s/step - loss: 0.0401 - accuracy: 0.9962 - val_loss: 5.9585 - val_accuracy: 0.1823
Epoch 8/100
25/25 [==============================] - 36s 1s/step - loss: 0.0248 - accuracy: 0.9987 - val_loss: 6.4777 - val_accuracy: 0.1875
Epoch 9/100
25/25 [==============================] - 37s 1s/step - loss: 0.0303 - accuracy: 0.9950 - val_loss: 6.8994 - val_accuracy: 0.1979
Epoch 10/100
25/25 [==============================] - 37s 1s/step - loss: 0.0212 - accuracy: 0.9987 - val_loss: 6.7732 - val_accuracy: 0.2708
Epoch 11/100
25/25 [==============================] - 39s 2s/step - loss: 0.0169 - accuracy: 0.9975 - val_loss: 8.2072 - val_accuracy: 0.2135
Epoch 12/100
25/25 [==============================] - 39s 2s/step - loss: 0.0134 - accuracy: 1.0000 - val_loss: 8.3724 - val_accuracy: 0.2396
Epoch 13/100
25/25 [==============================] - 36s 1s/step - loss: 0.0118 - accuracy: 0.9987 - val_loss: 8.3638 - val_accuracy: 0.2812
Epoch 14/100
25/25 [==============================] - 36s 1s/step - loss: 0.0092 - accuracy: 1.0000 - val_loss: 8.3157 - val_accuracy: 0.2812
Epoch 15/100
25/25 [==============================] - 36s 1s/step - loss: 0.0068 - accuracy: 1.0000 - val_loss: 8.0873 - val_accuracy: 0.3021
Epoch 16/100
25/25 [==============================] - 37s 1s/step - loss: 0.0070 - accuracy: 1.0000 - val_loss: 7.9629 - val_accuracy: 0.2969
Epoch 17/100
25/25 [==============================] - 36s 1s/step - loss: 0.0056 - accuracy: 1.0000 - val_loss: 6.8316 - val_accuracy: 0.3281
Epoch 18/100
25/25 [==============================] - 37s 1s/step - loss: 0.0048 - accuracy: 1.0000 - val_loss: 6.1176 - val_accuracy: 0.3385
Epoch 19/100
25/25 [==============================] - 37s 1s/step - loss: 0.0095 - accuracy: 0.9987 - val_loss: 4.9330 - val_accuracy: 0.3333
Epoch 20/100
25/25 [==============================] - 36s 1s/step - loss: 0.0088 - accuracy: 1.0000 - val_loss: 4.0413 - val_accuracy: 0.4271
Epoch 21/100
25/25 [==============================] - 36s 1s/step - loss: 0.0061 - accuracy: 1.0000 - val_loss: 3.4398 - val_accuracy: 0.4427
Epoch 22/100
25/25 [==============================] - 35s 1s/step - loss: 0.0046 - accuracy: 1.0000 - val_loss: 2.4394 - val_accuracy: 0.5208
Epoch 23/100
25/25 [==============================] - 35s 1s/step - loss: 0.0033 - accuracy: 1.0000 - val_loss: 1.8135 - val_accuracy: 0.5990
Epoch 24/100
25/25 [==============================] - 36s 1s/step - loss: 0.0042 - accuracy: 1.0000 - val_loss: 1.4458 - val_accuracy: 0.6823
Epoch 25/100
25/25 [==============================] - 36s 1s/step - loss: 0.0036 - accuracy: 1.0000 - val_loss: 1.0700 - val_accuracy: 0.7500
Epoch 26/100
25/25 [==============================] - 36s 1s/step - loss: 0.0031 - accuracy: 1.0000 - val_loss: 0.6903 - val_accuracy: 0.8385
Epoch 27/100
25/25 [==============================] - 36s 1s/step - loss: 0.0047 - accuracy: 1.0000 - val_loss: 0.2748 - val_accuracy: 0.9010
Epoch 28/100
25/25 [==============================] - 36s 1s/step - loss: 0.0060 - accuracy: 1.0000 - val_loss: 0.6901 - val_accuracy: 0.8229
Epoch 29/100
25/25 [==============================] - 36s 1s/step - loss: 0.0050 - accuracy: 1.0000 - val_loss: 0.3001 - val_accuracy: 0.9115
Epoch 30/100
25/25 [==============================] - 36s 1s/step - loss: 0.0039 - accuracy: 1.0000 - val_loss: 0.2927 - val_accuracy: 0.9167
Epoch 31/100
25/25 [==============================] - 36s 1s/step - loss: 0.0037 - accuracy: 1.0000 - val_loss: 0.2734 - val_accuracy: 0.9323
Epoch 32/100
25/25 [==============================] - 36s 1s/step - loss: 0.0028 - accuracy: 1.0000 - val_loss: 0.2591 - val_accuracy: 0.9271
Epoch 33/100
25/25 [==============================] - 36s 1s/step - loss: 0.0063 - accuracy: 0.9987 - val_loss: 0.2963 - val_accuracy: 0.9115
Epoch 34/100
25/25 [==============================] - 36s 1s/step - loss: 0.0033 - accuracy: 1.0000 - val_loss: 0.2725 - val_accuracy: 0.9219
Epoch 35/100
25/25 [==============================] - 36s 1s/step - loss: 0.0024 - accuracy: 1.0000 - val_loss: 0.2243 - val_accuracy: 0.9427
Epoch 36/100
25/25 [==============================] - 36s 1s/step - loss: 0.0031 - accuracy: 1.0000 - val_loss: 0.2625 - val_accuracy: 0.9375
Epoch 37/100
25/25 [==============================] - 36s 1s/step - loss: 0.0022 - accuracy: 1.0000 - val_loss: 0.2448 - val_accuracy: 0.9271
Epoch 38/100
25/25 [==============================] - 36s 1s/step - loss: 0.0028 - accuracy: 1.0000 - val_loss: 0.2700 - val_accuracy: 0.9010
Epoch 39/100
25/25 [==============================] - 36s 1s/step - loss: 0.0053 - accuracy: 1.0000 - val_loss: 0.2650 - val_accuracy: 0.9167
Epoch 40/100
25/25 [==============================] - 36s 1s/step - loss: 0.0030 - accuracy: 1.0000 - val_loss: 0.2695 - val_accuracy: 0.9167
Epoch 41/100
25/25 [==============================] - 36s 1s/step - loss: 0.0019 - accuracy: 1.0000 - val_loss: 0.2012 - val_accuracy: 0.9375
Epoch 42/100
25/25 [==============================] - 36s 1s/step - loss: 0.0020 - accuracy: 1.0000 - val_loss: 0.2457 - val_accuracy: 0.9271
Epoch 43/100
25/25 [==============================] - 36s 1s/step - loss: 0.0017 - accuracy: 1.0000 - val_loss: 0.2456 - val_accuracy: 0.9271
Epoch 44/100
25/25 [==============================] - 36s 1s/step - loss: 0.0020 - accuracy: 1.0000 - val_loss: 0.2094 - val_accuracy: 0.9323
Epoch 45/100
25/25 [==============================] - 36s 1s/step - loss: 0.0013 - accuracy: 1.0000 - val_loss: 0.2487 - val_accuracy: 0.9167
Epoch 46/100
25/25 [==============================] - 36s 1s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2507 - val_accuracy: 0.9167
Epoch 47/100
25/25 [==============================] - 36s 1s/step - loss: 0.0015 - accuracy: 1.0000 - val_loss: 0.2457 - val_accuracy: 0.9167
Epoch 48/100
25/25 [==============================] - 37s 1s/step - loss: 0.0019 - accuracy: 1.0000 - val_loss: 0.1729 - val_accuracy: 0.9375
Epoch 49/100
25/25 [==============================] - 36s 1s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2499 - val_accuracy: 0.9167
Epoch 50/100
25/25 [==============================] - 36s 1s/step - loss: 0.0013 - accuracy: 1.0000 - val_loss: 0.2496 - val_accuracy: 0.9271
Epoch 51/100
25/25 [==============================] - 36s 1s/step - loss: 9.5720e-04 - accuracy: 1.0000 - val_loss: 0.2233 - val_accuracy: 0.9375
Epoch 52/100
25/25 [==============================] - 36s 1s/step - loss: 0.0015 - accuracy: 1.0000 - val_loss: 0.2813 - val_accuracy: 0.9219
Epoch 53/100
25/25 [==============================] - 36s 1s/step - loss: 9.6567e-04 - accuracy: 1.0000 - val_loss: 0.2644 - val_accuracy: 0.9219
Epoch 54/100
25/25 [==============================] - 36s 1s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2469 - val_accuracy: 0.9271
Epoch 55/100
25/25 [==============================] - 36s 1s/step - loss: 0.0010 - accuracy: 1.0000 - val_loss: 0.2527 - val_accuracy: 0.9219
Epoch 56/100
25/25 [==============================] - 36s 1s/step - loss: 8.3443e-04 - accuracy: 1.0000 - val_loss: 0.2546 - val_accuracy: 0.9167
Epoch 57/100
25/25 [==============================] - 36s 1s/step - loss: 0.0145 - accuracy: 0.9950 - val_loss: 0.2987 - val_accuracy: 0.9115
Epoch 58/100
25/25 [==============================] - 36s 1s/step - loss: 0.0025 - accuracy: 1.0000 - val_loss: 0.2696 - val_accuracy: 0.9115
Epoch 59/100
25/25 [==============================] - 37s 1s/step - loss: 0.0016 - accuracy: 1.0000 - val_loss: 0.2572 - val_accuracy: 0.9271
Epoch 60/100
25/25 [==============================] - 37s 1s/step - loss: 0.0014 - accuracy: 1.0000 - val_loss: 0.2536 - val_accuracy: 0.9167
Epoch 61/100
25/25 [==============================] - 36s 1s/step - loss: 0.0024 - accuracy: 1.0000 - val_loss: 0.2361 - val_accuracy: 0.9271
Epoch 62/100
25/25 [==============================] - 36s 1s/step - loss: 0.0016 - accuracy: 1.0000 - val_loss: 0.2345 - val_accuracy: 0.9271
Epoch 63/100
25/25 [==============================] - 36s 1s/step - loss: 0.0011 - accuracy: 1.0000 - val_loss: 0.2381 - val_accuracy: 0.9219
Epoch 64/100
25/25 [==============================] - 36s 1s/step - loss: 0.0015 - accuracy: 1.0000 - val_loss: 0.1838 - val_accuracy: 0.9427
Epoch 65/100
25/25 [==============================] - 38s 2s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2077 - val_accuracy: 0.9271
Epoch 66/100
25/25 [==============================] - 36s 1s/step - loss: 9.0273e-04 - accuracy: 1.0000 - val_loss: 0.2517 - val_accuracy: 0.9219
Epoch 67/100
25/25 [==============================] - 36s 1s/step - loss: 9.5187e-04 - accuracy: 1.0000 - val_loss: 0.2012 - val_accuracy: 0.9219
Epoch 68/100
25/25 [==============================] - 36s 1s/step - loss: 9.6461e-04 - accuracy: 1.0000 - val_loss: 0.2327 - val_accuracy: 0.9323
Epoch 69/100
25/25 [==============================] - 37s 1s/step - loss: 9.4358e-04 - accuracy: 1.0000 - val_loss: 0.2500 - val_accuracy: 0.9271
Epoch 70/100
25/25 [==============================] - 37s 1s/step - loss: 0.0013 - accuracy: 1.0000 - val_loss: 0.3345 - val_accuracy: 0.8698
Epoch 71/100
25/25 [==============================] - 36s 1s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2188 - val_accuracy: 0.9271
Epoch 72/100
25/25 [==============================] - 36s 1s/step - loss: 6.7185e-04 - accuracy: 1.0000 - val_loss: 0.2477 - val_accuracy: 0.9271
Epoch 73/100
25/25 [==============================] - 36s 1s/step - loss: 0.0019 - accuracy: 1.0000 - val_loss: 0.2466 - val_accuracy: 0.9167
Epoch 74/100
25/25 [==============================] - 36s 1s/step - loss: 8.7229e-04 - accuracy: 1.0000 - val_loss: 0.2320 - val_accuracy: 0.9115
Epoch 75/100
25/25 [==============================] - 36s 1s/step - loss: 6.4097e-04 - accuracy: 1.0000 - val_loss: 0.2350 - val_accuracy: 0.9115
Epoch 76/100
25/25 [==============================] - 36s 1s/step - loss: 6.8064e-04 - accuracy: 1.0000 - val_loss: 0.2128 - val_accuracy: 0.9323
Epoch 77/100
25/25 [==============================] - 36s 1s/step - loss: 0.0013 - accuracy: 1.0000 - val_loss: 0.2293 - val_accuracy: 0.9323
Epoch 78/100
25/25 [==============================] - 36s 1s/step - loss: 6.8025e-04 - accuracy: 1.0000 - val_loss: 0.2027 - val_accuracy: 0.9271
Epoch 79/100
25/25 [==============================] - 36s 1s/step - loss: 7.1451e-04 - accuracy: 1.0000 - val_loss: 0.2372 - val_accuracy: 0.9219
Epoch 80/100
25/25 [==============================] - 36s 1s/step - loss: 8.0297e-04 - accuracy: 1.0000 - val_loss: 0.2419 - val_accuracy: 0.9219
Epoch 81/100
25/25 [==============================] - 36s 1s/step - loss: 5.7819e-04 - accuracy: 1.0000 - val_loss: 0.2482 - val_accuracy: 0.9115
Epoch 82/100
25/25 [==============================] - 36s 1s/step - loss: 5.6841e-04 - accuracy: 1.0000 - val_loss: 0.2458 - val_accuracy: 0.9219
Epoch 83/100
25/25 [==============================] - 36s 1s/step - loss: 6.9683e-04 - accuracy: 1.0000 - val_loss: 0.2376 - val_accuracy: 0.9219
Epoch 84/100
25/25 [==============================] - 37s 1s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2349 - val_accuracy: 0.9167
Epoch 85/100
25/25 [==============================] - 36s 1s/step - loss: 8.7577e-04 - accuracy: 1.0000 - val_loss: 0.2515 - val_accuracy: 0.9219
Epoch 86/100
25/25 [==============================] - 36s 1s/step - loss: 0.0011 - accuracy: 1.0000 - val_loss: 0.2352 - val_accuracy: 0.9271
Epoch 87/100
25/25 [==============================] - 36s 1s/step - loss: 8.1894e-04 - accuracy: 1.0000 - val_loss: 0.2092 - val_accuracy: 0.9271
Epoch 88/100
25/25 [==============================] - 36s 1s/step - loss: 6.5846e-04 - accuracy: 1.0000 - val_loss: 0.2377 - val_accuracy: 0.9271
Epoch 89/100
25/25 [==============================] - 36s 1s/step - loss: 4.9351e-04 - accuracy: 1.0000 - val_loss: 0.2482 - val_accuracy: 0.9219
Epoch 90/100
25/25 [==============================] - 36s 1s/step - loss: 5.2903e-04 - accuracy: 1.0000 - val_loss: 0.2308 - val_accuracy: 0.9323
Epoch 91/100
25/25 [==============================] - 36s 1s/step - loss: 6.2774e-04 - accuracy: 1.0000 - val_loss: 0.2199 - val_accuracy: 0.9323
Epoch 92/100
25/25 [==============================] - 36s 1s/step - loss: 0.0012 - accuracy: 1.0000 - val_loss: 0.2666 - val_accuracy: 0.9219
Epoch 93/100
25/25 [==============================] - 36s 1s/step - loss: 7.7254e-04 - accuracy: 1.0000 - val_loss: 0.2651 - val_accuracy: 0.9219
Epoch 94/100
25/25 [==============================] - 36s 1s/step - loss: 7.5749e-04 - accuracy: 1.0000 - val_loss: 0.2622 - val_accuracy: 0.9219
Epoch 95/100
25/25 [==============================] - 36s 1s/step - loss: 5.5629e-04 - accuracy: 1.0000 - val_loss: 0.2442 - val_accuracy: 0.9219
Epoch 96/100
25/25 [==============================] - 36s 1s/step - loss: 6.3401e-04 - accuracy: 1.0000 - val_loss: 0.2543 - val_accuracy: 0.9167
Epoch 97/100
25/25 [==============================] - 36s 1s/step - loss: 6.4368e-04 - accuracy: 1.0000 - val_loss: 0.2596 - val_accuracy: 0.9271
Epoch 98/100
25/25 [==============================] - 36s 1s/step - loss: 4.0174e-04 - accuracy: 1.0000 - val_loss: 0.2583 - val_accuracy: 0.9271
Epoch 99/100
25/25 [==============================] - 36s 1s/step - loss: 7.2224e-04 - accuracy: 1.0000 - val_loss: 0.2414 - val_accuracy: 0.9323
Epoch 100/100
25/25 [==============================] - 36s 1s/step - loss: 4.4288e-04 - accuracy: 1.0000 - val_loss: 0.2390 - val_accuracy: 0.9271
<keras.callbacks.History at 0x2b04e37a190>
model_batch.evaluate(test_ds)
8/8 [==============================] - 5s 294ms/step - loss: 0.2599 - accuracy: 0.9180
[0.25985682010650635, 0.91796875]

Z dropoutem

model_batch_drop = keras.models.Sequential([
    keras.layers.Conv2D(filters=96, kernel_size=(11,11), strides=(4,4), activation='relu', input_shape=(227,227,3)),
    keras.layers.BatchNormalization(),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(5,5), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=384, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.Dropout(.5),
    keras.layers.Conv2D(filters=256, kernel_size=(3,3), strides=(1,1), activation='relu', padding="same"),
    keras.layers.BatchNormalization(),
    keras.layers.Dropout(.5),
    keras.layers.MaxPool2D(pool_size=(3,3), strides=(2,2)),
    keras.layers.Dropout(.5),
    keras.layers.Flatten(),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(4096, activation='relu'),
    keras.layers.Dropout(.5),
    keras.layers.Dense(10, activation='softmax')
])
model_batch_drop.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(lr=.001), metrics=['accuracy'])
model_batch_drop.summary()
WARNING:absl:`lr` is deprecated, please use `learning_rate` instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.SGD.
Model: "sequential_8"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv2d_40 (Conv2D)          (None, 55, 55, 96)        34944     
                                                                 
 batch_normalization_5 (Batc  (None, 55, 55, 96)       384       
 hNormalization)                                                 
                                                                 
 dropout_40 (Dropout)        (None, 55, 55, 96)        0         
                                                                 
 max_pooling2d_24 (MaxPoolin  (None, 27, 27, 96)       0         
 g2D)                                                            
                                                                 
 dropout_41 (Dropout)        (None, 27, 27, 96)        0         
                                                                 
 conv2d_41 (Conv2D)          (None, 27, 27, 256)       614656    
                                                                 
 batch_normalization_6 (Batc  (None, 27, 27, 256)      1024      
 hNormalization)                                                 
                                                                 
 dropout_42 (Dropout)        (None, 27, 27, 256)       0         
                                                                 
 max_pooling2d_25 (MaxPoolin  (None, 13, 13, 256)      0         
 g2D)                                                            
                                                                 
 dropout_43 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 conv2d_42 (Conv2D)          (None, 13, 13, 384)       885120    
                                                                 
 batch_normalization_7 (Batc  (None, 13, 13, 384)      1536      
 hNormalization)                                                 
                                                                 
 dropout_44 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_43 (Conv2D)          (None, 13, 13, 384)       1327488   
                                                                 
 batch_normalization_8 (Batc  (None, 13, 13, 384)      1536      
 hNormalization)                                                 
                                                                 
 dropout_45 (Dropout)        (None, 13, 13, 384)       0         
                                                                 
 conv2d_44 (Conv2D)          (None, 13, 13, 256)       884992    
                                                                 
 batch_normalization_9 (Batc  (None, 13, 13, 256)      1024      
 hNormalization)                                                 
                                                                 
 dropout_46 (Dropout)        (None, 13, 13, 256)       0         
                                                                 
 max_pooling2d_26 (MaxPoolin  (None, 6, 6, 256)        0         
 g2D)                                                            
                                                                 
 dropout_47 (Dropout)        (None, 6, 6, 256)         0         
                                                                 
 flatten_8 (Flatten)         (None, 9216)              0         
                                                                 
 dense_24 (Dense)            (None, 4096)              37752832  
                                                                 
 dropout_48 (Dropout)        (None, 4096)              0         
                                                                 
 dense_25 (Dense)            (None, 4096)              16781312  
                                                                 
 dropout_49 (Dropout)        (None, 4096)              0         
                                                                 
 dense_26 (Dense)            (None, 10)                40970     
                                                                 
=================================================================
Total params: 58,327,818
Trainable params: 58,325,066
Non-trainable params: 2,752
_________________________________________________________________
model_batch_drop.fit(train_ds,
          epochs=100,
          validation_data=validation_ds,
          validation_freq=1,
          callbacks=[tensorboard_cb])
Epoch 1/100
25/25 [==============================] - 42s 2s/step - loss: 18.7754 - accuracy: 0.2300 - val_loss: 3.0447 - val_accuracy: 0.2500
Epoch 2/100
25/25 [==============================] - 40s 2s/step - loss: 5.7450 - accuracy: 0.2862 - val_loss: 2.0106 - val_accuracy: 0.2031
Epoch 3/100
25/25 [==============================] - 40s 2s/step - loss: 5.0484 - accuracy: 0.2800 - val_loss: 1.8900 - val_accuracy: 0.1927
Epoch 4/100
25/25 [==============================] - 40s 2s/step - loss: 3.9955 - accuracy: 0.2988 - val_loss: 1.8577 - val_accuracy: 0.1979
Epoch 5/100
25/25 [==============================] - 40s 2s/step - loss: 4.0152 - accuracy: 0.3063 - val_loss: 1.8857 - val_accuracy: 0.1979
Epoch 6/100
25/25 [==============================] - 40s 2s/step - loss: 3.2712 - accuracy: 0.3063 - val_loss: 1.8446 - val_accuracy: 0.1250
Epoch 7/100
25/25 [==============================] - 41s 2s/step - loss: 2.5423 - accuracy: 0.3587 - val_loss: 1.8951 - val_accuracy: 0.1875
Epoch 8/100
25/25 [==============================] - 44s 2s/step - loss: 2.3186 - accuracy: 0.3625 - val_loss: 1.8989 - val_accuracy: 0.1615
Epoch 9/100
25/25 [==============================] - 42s 2s/step - loss: 2.1973 - accuracy: 0.3663 - val_loss: 2.0297 - val_accuracy: 0.2031
Epoch 10/100
25/25 [==============================] - 40s 2s/step - loss: 1.8098 - accuracy: 0.4275 - val_loss: 2.0467 - val_accuracy: 0.2083
Epoch 11/100
25/25 [==============================] - 40s 2s/step - loss: 1.6218 - accuracy: 0.4888 - val_loss: 2.1542 - val_accuracy: 0.1615
Epoch 12/100
25/25 [==============================] - 40s 2s/step - loss: 1.7138 - accuracy: 0.4762 - val_loss: 2.4840 - val_accuracy: 0.2292
Epoch 13/100
25/25 [==============================] - 40s 2s/step - loss: 1.5391 - accuracy: 0.5238 - val_loss: 2.5269 - val_accuracy: 0.1667
Epoch 14/100
25/25 [==============================] - 41s 2s/step - loss: 1.3664 - accuracy: 0.5763 - val_loss: 2.6138 - val_accuracy: 0.2188
Epoch 15/100
25/25 [==============================] - 40s 2s/step - loss: 1.3573 - accuracy: 0.5537 - val_loss: 3.0465 - val_accuracy: 0.2083
Epoch 16/100
25/25 [==============================] - 40s 2s/step - loss: 1.3332 - accuracy: 0.5638 - val_loss: 2.8962 - val_accuracy: 0.2240
Epoch 17/100
25/25 [==============================] - 40s 2s/step - loss: 1.2500 - accuracy: 0.5863 - val_loss: 2.7711 - val_accuracy: 0.2188
Epoch 18/100
25/25 [==============================] - 40s 2s/step - loss: 1.1243 - accuracy: 0.6100 - val_loss: 2.8280 - val_accuracy: 0.2240
Epoch 19/100
25/25 [==============================] - 40s 2s/step - loss: 1.0187 - accuracy: 0.6150 - val_loss: 2.7781 - val_accuracy: 0.2240
Epoch 20/100
25/25 [==============================] - 40s 2s/step - loss: 1.0591 - accuracy: 0.6263 - val_loss: 2.7976 - val_accuracy: 0.2240
Epoch 21/100
25/25 [==============================] - 40s 2s/step - loss: 0.9730 - accuracy: 0.6513 - val_loss: 2.6593 - val_accuracy: 0.2500
Epoch 22/100
25/25 [==============================] - 40s 2s/step - loss: 1.0428 - accuracy: 0.6538 - val_loss: 2.9169 - val_accuracy: 0.2396
Epoch 23/100
25/25 [==============================] - 41s 2s/step - loss: 0.9658 - accuracy: 0.6587 - val_loss: 2.9805 - val_accuracy: 0.2396
Epoch 24/100
25/25 [==============================] - 40s 2s/step - loss: 0.8756 - accuracy: 0.6625 - val_loss: 2.9590 - val_accuracy: 0.2604
Epoch 25/100
25/25 [==============================] - 40s 2s/step - loss: 0.9395 - accuracy: 0.6737 - val_loss: 2.7804 - val_accuracy: 0.2188
Epoch 26/100
25/25 [==============================] - 40s 2s/step - loss: 0.8502 - accuracy: 0.6938 - val_loss: 2.9480 - val_accuracy: 0.2448
Epoch 27/100
25/25 [==============================] - 40s 2s/step - loss: 0.8092 - accuracy: 0.7350 - val_loss: 3.3202 - val_accuracy: 0.2188
Epoch 28/100
25/25 [==============================] - 40s 2s/step - loss: 0.7796 - accuracy: 0.7150 - val_loss: 2.8618 - val_accuracy: 0.1823
Epoch 29/100
25/25 [==============================] - 40s 2s/step - loss: 0.7650 - accuracy: 0.7175 - val_loss: 3.1987 - val_accuracy: 0.1719
Epoch 30/100
25/25 [==============================] - 40s 2s/step - loss: 0.6968 - accuracy: 0.7437 - val_loss: 3.0807 - val_accuracy: 0.1562
Epoch 31/100
25/25 [==============================] - 40s 2s/step - loss: 0.7408 - accuracy: 0.7387 - val_loss: 4.7095 - val_accuracy: 0.1771
Epoch 32/100
25/25 [==============================] - 40s 2s/step - loss: 0.7883 - accuracy: 0.7138 - val_loss: 3.5988 - val_accuracy: 0.1250
Epoch 33/100
25/25 [==============================] - 40s 2s/step - loss: 0.6965 - accuracy: 0.7237 - val_loss: 3.8168 - val_accuracy: 0.1771
Epoch 34/100
25/25 [==============================] - 42s 2s/step - loss: 0.6220 - accuracy: 0.7725 - val_loss: 3.1421 - val_accuracy: 0.1615
Epoch 35/100
25/25 [==============================] - 40s 2s/step - loss: 0.6952 - accuracy: 0.7563 - val_loss: 3.3574 - val_accuracy: 0.1771
Epoch 36/100
25/25 [==============================] - 40s 2s/step - loss: 0.6311 - accuracy: 0.7638 - val_loss: 3.9404 - val_accuracy: 0.1250
Epoch 37/100
25/25 [==============================] - 40s 2s/step - loss: 0.6131 - accuracy: 0.7713 - val_loss: 4.1547 - val_accuracy: 0.1094
Epoch 38/100
25/25 [==============================] - 40s 2s/step - loss: 0.6917 - accuracy: 0.7575 - val_loss: 3.6349 - val_accuracy: 0.1562
Epoch 39/100
25/25 [==============================] - 40s 2s/step - loss: 0.6401 - accuracy: 0.7825 - val_loss: 3.6254 - val_accuracy: 0.1458
Epoch 40/100
25/25 [==============================] - 40s 2s/step - loss: 0.6787 - accuracy: 0.7437 - val_loss: 3.9394 - val_accuracy: 0.1562
Epoch 41/100
25/25 [==============================] - 40s 2s/step - loss: 0.5985 - accuracy: 0.7825 - val_loss: 3.8814 - val_accuracy: 0.1562
Epoch 42/100
25/25 [==============================] - 40s 2s/step - loss: 0.5920 - accuracy: 0.7850 - val_loss: 4.7182 - val_accuracy: 0.1302
Epoch 43/100
25/25 [==============================] - 40s 2s/step - loss: 0.6628 - accuracy: 0.7563 - val_loss: 3.4734 - val_accuracy: 0.1719
Epoch 44/100
25/25 [==============================] - 40s 2s/step - loss: 0.5662 - accuracy: 0.7912 - val_loss: 3.6088 - val_accuracy: 0.1667
Epoch 45/100
25/25 [==============================] - 42s 2s/step - loss: 0.5879 - accuracy: 0.7763 - val_loss: 3.9871 - val_accuracy: 0.1302
Epoch 46/100
25/25 [==============================] - 40s 2s/step - loss: 0.4717 - accuracy: 0.8062 - val_loss: 3.6940 - val_accuracy: 0.1719
Epoch 47/100
25/25 [==============================] - 41s 2s/step - loss: 0.5342 - accuracy: 0.8037 - val_loss: 4.1004 - val_accuracy: 0.1615
Epoch 48/100
25/25 [==============================] - 41s 2s/step - loss: 0.5903 - accuracy: 0.7800 - val_loss: 4.2024 - val_accuracy: 0.1667
Epoch 49/100
25/25 [==============================] - 41s 2s/step - loss: 0.6181 - accuracy: 0.7887 - val_loss: 4.1097 - val_accuracy: 0.1458
Epoch 50/100
25/25 [==============================] - 41s 2s/step - loss: 0.5110 - accuracy: 0.8112 - val_loss: 4.3863 - val_accuracy: 0.1979
Epoch 51/100
25/25 [==============================] - 42s 2s/step - loss: 0.5459 - accuracy: 0.8037 - val_loss: 4.2418 - val_accuracy: 0.1354
Epoch 52/100
25/25 [==============================] - 42s 2s/step - loss: 0.5215 - accuracy: 0.8062 - val_loss: 4.4408 - val_accuracy: 0.2135
Epoch 53/100
25/25 [==============================] - 42s 2s/step - loss: 0.5577 - accuracy: 0.8213 - val_loss: 5.2647 - val_accuracy: 0.1510
Epoch 54/100
25/25 [==============================] - 40s 2s/step - loss: 0.5364 - accuracy: 0.7887 - val_loss: 4.3820 - val_accuracy: 0.1615
Epoch 55/100
25/25 [==============================] - 41s 2s/step - loss: 0.5056 - accuracy: 0.8163 - val_loss: 3.0960 - val_accuracy: 0.2292
Epoch 56/100
25/25 [==============================] - 44s 2s/step - loss: 0.5088 - accuracy: 0.8275 - val_loss: 4.1318 - val_accuracy: 0.1667
Epoch 57/100
25/25 [==============================] - 42s 2s/step - loss: 0.5356 - accuracy: 0.7987 - val_loss: 3.8712 - val_accuracy: 0.1562
Epoch 58/100
25/25 [==============================] - 42s 2s/step - loss: 0.4303 - accuracy: 0.8388 - val_loss: 3.7644 - val_accuracy: 0.1771
Epoch 59/100
25/25 [==============================] - 42s 2s/step - loss: 0.3881 - accuracy: 0.8350 - val_loss: 4.0027 - val_accuracy: 0.1719
Epoch 60/100
25/25 [==============================] - 41s 2s/step - loss: 0.5084 - accuracy: 0.8338 - val_loss: 4.0352 - val_accuracy: 0.1458
Epoch 61/100
25/25 [==============================] - 41s 2s/step - loss: 0.4368 - accuracy: 0.8238 - val_loss: 3.6374 - val_accuracy: 0.1615
Epoch 62/100
25/25 [==============================] - 42s 2s/step - loss: 0.4437 - accuracy: 0.8300 - val_loss: 3.5370 - val_accuracy: 0.1979
Epoch 63/100
25/25 [==============================] - 41s 2s/step - loss: 0.4130 - accuracy: 0.8425 - val_loss: 3.9090 - val_accuracy: 0.1458
Epoch 64/100
25/25 [==============================] - 41s 2s/step - loss: 0.3847 - accuracy: 0.8500 - val_loss: 3.9670 - val_accuracy: 0.1510
Epoch 65/100
25/25 [==============================] - 41s 2s/step - loss: 0.4029 - accuracy: 0.8425 - val_loss: 4.5627 - val_accuracy: 0.1302
Epoch 66/100
25/25 [==============================] - 41s 2s/step - loss: 0.3499 - accuracy: 0.8550 - val_loss: 3.7520 - val_accuracy: 0.1667
Epoch 67/100
25/25 [==============================] - 41s 2s/step - loss: 0.3891 - accuracy: 0.8600 - val_loss: 4.5331 - val_accuracy: 0.1771
Epoch 68/100
25/25 [==============================] - 41s 2s/step - loss: 0.4390 - accuracy: 0.8363 - val_loss: 4.4191 - val_accuracy: 0.1823
Epoch 69/100
25/25 [==============================] - 41s 2s/step - loss: 0.3524 - accuracy: 0.8600 - val_loss: 5.4688 - val_accuracy: 0.1406
Epoch 70/100
25/25 [==============================] - 41s 2s/step - loss: 0.4448 - accuracy: 0.8550 - val_loss: 4.3226 - val_accuracy: 0.1927
Epoch 71/100
25/25 [==============================] - 41s 2s/step - loss: 0.3959 - accuracy: 0.8525 - val_loss: 4.6061 - val_accuracy: 0.2031
Epoch 72/100
25/25 [==============================] - 41s 2s/step - loss: 0.3506 - accuracy: 0.8775 - val_loss: 3.8307 - val_accuracy: 0.1615
Epoch 73/100
25/25 [==============================] - 42s 2s/step - loss: 0.3496 - accuracy: 0.8750 - val_loss: 4.3153 - val_accuracy: 0.1823
Epoch 74/100
25/25 [==============================] - 42s 2s/step - loss: 0.4924 - accuracy: 0.8263 - val_loss: 3.8766 - val_accuracy: 0.1875
Epoch 75/100
25/25 [==============================] - 41s 2s/step - loss: 0.4854 - accuracy: 0.8487 - val_loss: 5.7284 - val_accuracy: 0.1562
Epoch 76/100
25/25 [==============================] - 41s 2s/step - loss: 0.4044 - accuracy: 0.8625 - val_loss: 5.3349 - val_accuracy: 0.0938
Epoch 77/100
25/25 [==============================] - 42s 2s/step - loss: 0.4885 - accuracy: 0.8375 - val_loss: 3.9680 - val_accuracy: 0.1719
Epoch 78/100
25/25 [==============================] - 41s 2s/step - loss: 0.3635 - accuracy: 0.8500 - val_loss: 4.1063 - val_accuracy: 0.1719
Epoch 79/100
25/25 [==============================] - 41s 2s/step - loss: 0.3271 - accuracy: 0.8675 - val_loss: 4.6011 - val_accuracy: 0.1615
Epoch 80/100
25/25 [==============================] - 42s 2s/step - loss: 0.3255 - accuracy: 0.8712 - val_loss: 4.8067 - val_accuracy: 0.1771
Epoch 81/100
25/25 [==============================] - 42s 2s/step - loss: 0.3612 - accuracy: 0.8600 - val_loss: 4.4704 - val_accuracy: 0.1562
Epoch 82/100
25/25 [==============================] - 42s 2s/step - loss: 0.3358 - accuracy: 0.8775 - val_loss: 4.3849 - val_accuracy: 0.1562
Epoch 83/100
25/25 [==============================] - 41s 2s/step - loss: 0.3253 - accuracy: 0.8850 - val_loss: 4.4543 - val_accuracy: 0.1927
Epoch 84/100
25/25 [==============================] - 41s 2s/step - loss: 0.2932 - accuracy: 0.8800 - val_loss: 4.2358 - val_accuracy: 0.2188
Epoch 85/100
25/25 [==============================] - 41s 2s/step - loss: 0.2768 - accuracy: 0.8938 - val_loss: 4.6282 - val_accuracy: 0.2500
Epoch 86/100
25/25 [==============================] - 42s 2s/step - loss: 0.3475 - accuracy: 0.8800 - val_loss: 4.8860 - val_accuracy: 0.1979
Epoch 87/100
25/25 [==============================] - 41s 2s/step - loss: 0.4666 - accuracy: 0.8575 - val_loss: 6.6145 - val_accuracy: 0.1719
Epoch 88/100
25/25 [==============================] - 41s 2s/step - loss: 0.3518 - accuracy: 0.8712 - val_loss: 6.0062 - val_accuracy: 0.1615
Epoch 89/100
25/25 [==============================] - 42s 2s/step - loss: 0.3243 - accuracy: 0.8725 - val_loss: 5.5636 - val_accuracy: 0.1979
Epoch 90/100
25/25 [==============================] - 42s 2s/step - loss: 0.3085 - accuracy: 0.8950 - val_loss: 4.9411 - val_accuracy: 0.1562
Epoch 91/100
25/25 [==============================] - 41s 2s/step - loss: 0.3635 - accuracy: 0.8838 - val_loss: 8.3831 - val_accuracy: 0.1510
Epoch 92/100
25/25 [==============================] - 41s 2s/step - loss: 0.3729 - accuracy: 0.8675 - val_loss: 5.3772 - val_accuracy: 0.1458
Epoch 93/100
25/25 [==============================] - 41s 2s/step - loss: 0.4809 - accuracy: 0.8462 - val_loss: 3.2538 - val_accuracy: 0.2031
Epoch 94/100
25/25 [==============================] - 41s 2s/step - loss: 0.3623 - accuracy: 0.8675 - val_loss: 4.4434 - val_accuracy: 0.1875
Epoch 95/100
25/25 [==============================] - 41s 2s/step - loss: 0.3453 - accuracy: 0.8675 - val_loss: 7.2843 - val_accuracy: 0.1771
Epoch 96/100
25/25 [==============================] - 41s 2s/step - loss: 0.4527 - accuracy: 0.8700 - val_loss: 3.5670 - val_accuracy: 0.2240
Epoch 97/100
25/25 [==============================] - 41s 2s/step - loss: 0.3839 - accuracy: 0.8662 - val_loss: 4.9288 - val_accuracy: 0.1458
Epoch 98/100
25/25 [==============================] - 41s 2s/step - loss: 0.2978 - accuracy: 0.8863 - val_loss: 5.4240 - val_accuracy: 0.2292
Epoch 99/100
25/25 [==============================] - 41s 2s/step - loss: 0.3522 - accuracy: 0.8750 - val_loss: 5.5607 - val_accuracy: 0.1771
Epoch 100/100
25/25 [==============================] - 42s 2s/step - loss: 0.3677 - accuracy: 0.8775 - val_loss: 7.4051 - val_accuracy: 0.1146
<keras.callbacks.History at 0x2b05112a220>
model_batch_drop.evaluate(test_ds)
8/8 [==============================] - 5s 283ms/step - loss: 9.0089 - accuracy: 0.1758
[9.008861541748047, 0.17578125]