AlexNet_Data_Loader.ipynb
AlexNet_Prototype_Model.ipynb
Enough HDD/SSD space is required for the following:
An SSD is recommended and a Mechanical HDD should be avoided since it will slow down the data loader significantly.
ImageNet Download Link: Download ImageNet Dataset
ILSVRC2012_img_train.tar
- Size 137.7 GBILSVRC2012_img_val.tar
- Size 6.3 GBILSVRC2012_img_test.tar
- Size 12.7 GBDownload the dataset from the above link and put it in the folder like shown:
imagenet2012/
├── ILSVRC2012_img_test.tar
├── ILSVRC2012_img_train.tar
└── ILSVRC2012_img_val.tar
Create another folder and create the folders data
, download
& extracted
like shown:
imagenet/
├── data/
├── downloaded/
└── extracted/
import os
os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "true"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "1"
import tensorflow as tf
import tensorflow_addons as tfa
import tensorflow_datasets as tfds
import matplotlib.pyplot as plt
import numpy as np
from pprint import pprint
plt.rcParams["figure.figsize"] = 30, 30
class ImageNetDataLoader:
def __init__(
self,
source_data_dir: str,
dest_data_dir: str,
split: str = "train",
image_dims: tuple = (224, 224),
num_classes=1000
) -> None:
"""
__init__
- Instance Variable Initialization
- Download and Set Up Dataset (One Time Operation)
- Use TFDS to Load and convert the ImageNet Dataset
Args:
source_data_dir (str): Path to Downloaded tar files
dest_data_dir (str): Path to the location where the dataset will be unpacked
spliit (str): Split to load as. Eg. train, test, train[:80%]. Defaults to "train"
image_dims (tuple, optional): Image Dimensions (width & height). Defaults to (224, 224).
num_classes (int): Number of Classes contained in this dataset. Defaults to 1000
"""
# Constants
self.NUM_CLASSES=num_classes
self.BATCH_SIZE = None
self.NUM_CHANNELS = 3
self.LABELS = []
self.LABELMAP = {}
self.AUTOTUNE = tf.data.experimental.AUTOTUNE
self.WIDTH, self.HEIGHT = image_dims
# Download Config
download_config = tfds.download.DownloadConfig(
extract_dir=os.path.join(dest_data_dir, 'extracted'),
manual_dir=source_data_dir
)
download_and_prepare_kwargs = {
'download_dir': os.path.join(dest_data_dir, 'downloaded'),
'download_config': download_config,
}
# TFDS Data Loader (This step also performs dataset conversion to TFRecord)
self.dataset, self.info = tfds.load(
'imagenet2012',
data_dir=os.path.join(dest_data_dir, 'data'),
split=split,
shuffle_files=True,
download=True,
as_supervised=True,
with_info=True,
download_and_prepare_kwargs=download_and_prepare_kwargs
)
def preprocess_image(self, image, label):
"""
preprocess_image
Process the image and label to perform the following operations:
- Min Max Scale the Image (Divide by 255)
- Convert the numerical values of the lables to One Hot Encoded Format
- Resize the image to 224, 224
Args:
image (Image Tensor): Raw Image
label (Tensor): Numeric Labels 1, 2, 3, ...
Returns:
tuple: Scaled Image, One-Hot Encoded Label
"""
image = tf.cast(image, tf.uint8)
image = tf.image.resize(image, [self.HEIGHT, self.WIDTH])
image = image / tf.math.reduce_max(image)
label = tf.one_hot(indices=label, depth=self.NUM_CLASSES)
return image, label
@tf.function
def augment_batch(self, image, label) -> tuple:
"""
augment_batch
Image Augmentation for Training:
- Random Contrast
- Random Brightness
- Random Hue (Color)
- Random Saturation
- Random Horizontal Flip
- Random Reduction in Image Quality
- Random Crop
Args:
image (Tensor Image): Raw Image
label (Tensor): Numeric Labels 1, 2, 3, ...
Returns:
tuple: Augmented Image, Numeric Labels 1, 2, 3, ...
"""
if tf.random.normal([1]) < 0:
image = tf.image.random_contrast(image, 0.2, 0.9)
if tf.random.normal([1]) < 0:
image = tf.image.random_brightness(image, 0.2)
if self.NUM_CHANNELS == 3 and tf.random.normal([1]) < 0:
image = tf.image.random_hue(image, 0.3)
if self.NUM_CHANNELS == 3 and tf.random.normal([1]) < 0:
image = tf.image.random_saturation(image, 0, 15)
image = tf.image.random_flip_left_right(image)
image = tf.image.random_jpeg_quality(image, 10, 100)
return image, label
def get_dataset_size(self) -> int:
"""
get_dataset_size
Get the Dataset Size (Number of Images)
Returns:
int: Total Number of images in Dataset
"""
return len(self.dataset)
def get_num_steps(self) -> int:
"""
get_num_steps
Get the Number of Steps Required per Batch for Training
Raises:
AssertionError: Dataset Generator needs to be Initialized First
Returns:
int: Number of Steps Required for Training Per Batch
"""
if self.BATCH_SIZE is None:
raise AssertionError(
f"Batch Size is not Initialized. Call this method only after calling: {self.dataset_generator}"
)
num_steps = self.get_dataset_size() // self.BATCH_SIZE + 1
return num_steps
def dataset_generator(self, batch_size=32, augment=False):
"""
dataset_generator
Create the Data Loader Pipeline and Return a Generator to Generate Datsets
Args:
batch_size (int, optional): Batch Size. Defaults to 32.
augment (bool, optional): Enable/Disable Augmentation. Defaults to False.
Returns:
Tf.Data Generator: Dataset Generator
"""
self.BATCH_SIZE = batch_size
dataset = self.dataset.apply(tf.data.experimental.ignore_errors())
dataset = dataset.shuffle(batch_size * 10)
dataset = dataset.repeat()
if augment:
dataset = dataset.map(self.augment_batch, num_parallel_calls=self.AUTOTUNE)
dataset = dataset.map(self.preprocess_image, num_parallel_calls=self.AUTOTUNE)
dataset = dataset.batch(batch_size)
dataset = dataset.prefetch(buffer_size=self.AUTOTUNE)
return dataset
def visualize_batch(self, augment=True) -> None:
"""
visualize_batch
Dataset Sample Visualization
- Supports Augmentation
- Automatically Adjusts for Grayscale Images
Args:
augment (bool, optional): Enable/Disable Augmentation. Defaults to True.
"""
if self.NUM_CHANNELS == 1:
cmap = "gray"
else:
cmap = "viridis"
dataset = self.dataset_generator(batch_size=36, augment=augment)
image_batch, label_batch = next(iter(dataset))
image_batch, label_batch = (
image_batch.numpy(),
label_batch.numpy(),
)
for n in range(len(image_batch)):
ax = plt.subplot(6, 6, n + 1)
plt.imshow(image_batch[n], cmap=cmap)
plt.title(np.argmax(label_batch[n]))
plt.axis("off")
plt.show()
# Create AlexNet Model (Fused)
# Input Layer
inputs = tf.keras.Input(shape=(224, 224, 3), name="alexnet_input")
# Layer 1 - Convolutions
l1 = tf.keras.layers.Conv2D(filters=96, kernel_size=11, strides=4, padding="same")(inputs)
l1 = tf.keras.layers.BatchNormalization()(l1)
l1 = tf.keras.layers.ReLU()(l1)
l1 = tf.keras.layers.MaxPooling2D(pool_size=3, strides=2)(l1)
# Layer 2 - Convolutions
l2 = tf.keras.layers.Conv2D(filters=256, kernel_size=5, strides=1, padding="same")(l1)
l2 = tf.keras.layers.BatchNormalization()(l2)
l2 = tf.keras.layers.ReLU()(l2)
l2 = tf.keras.layers.MaxPooling2D(pool_size=3, strides=2)(l2)
# Layer 3 - Convolutions
l3 = tf.keras.layers.Conv2D(filters=384, kernel_size=3, strides=1, padding="same")(l2)
l3 = tf.keras.layers.ReLU()(l3)
# Layer 4 - Convolutions
l4 = tf.keras.layers.Conv2D(filters=384, kernel_size=3, strides=1, padding="same")(l3)
l4 = tf.keras.layers.ReLU()(l4)
# Layer 5 - Convolutions
l5 = tf.keras.layers.Conv2D(filters=256, kernel_size=3, strides=1, padding="same")(l4)
l5 = tf.keras.layers.ReLU()(l5)
l5 = tf.keras.layers.MaxPooling2D(pool_size=3, strides=2)(l5)
# Layer 6 - Dense
l6_pre = tf.keras.layers.Flatten()(l5)
l6 = tf.keras.layers.Dense(units=4096)(l6_pre)
l6 = tf.keras.layers.ReLU()(l6)
l6 = tf.keras.layers.Dropout(rate=0.5)(l6)
# Layer 7 - Dense
l7 = tf.keras.layers.Dense(units=4096)(l6)
l7 = tf.keras.layers.ReLU()(l7)
l7 = tf.keras.layers.Dropout(rate=0.5)(l7)
# Layer 8 - Dense
l8 = tf.keras.layers.Dense(units=1000)(l7)
l8 = tf.keras.layers.Softmax(dtype=tf.float32, name="alexnet_output")(l8)
alexnet = tf.keras.models.Model(inputs=inputs, outputs=l8)
# Callbacks
early_stop_cb = tf.keras.callbacks.EarlyStopping(
monitor="val_categorical_accuracy",
min_delta=0,
patience=10,
verbose=1,
mode="auto",
baseline=None,
restore_best_weights=True,
)
model_ckpt_cb = tf.keras.callbacks.ModelCheckpoint(
"weights/alexnet.{epoch:02d}-{val_categorical_accuracy:.2f}-{val_loss:.2f}.h5",
monitor="val_categorical_accuracy",
verbose=0,
save_best_only=True,
save_weights_only=False,
mode="auto",
save_freq="epoch",
)
reduce_lr_cb = tf.keras.callbacks.ReduceLROnPlateau(
monitor="val_categorical_accuracy",
factor=0.1,
patience=2,
verbose=0,
mode="auto",
min_delta=0.0001,
cooldown=0,
min_lr=10e-8,
)
tensorboard_cb = tf.keras.callbacks.TensorBoard(
log_dir="tb_logs/",
histogram_freq=2,
write_graph=True,
write_images=False,
update_freq="epoch",
profile_batch=2,
embeddings_freq=2,
embeddings_metadata=None,
)
callbacks = [early_stop_cb, model_ckpt_cb, reduce_lr_cb, tensorboard_cb]
# Metrics
metrics = [
tf.keras.metrics.CategoricalAccuracy(),
tf.keras.metrics.FalseNegatives(),
tf.keras.metrics.FalsePositives(),
tf.keras.metrics.Precision(),
tf.keras.metrics.Recall(),
tfa.metrics.F1Score(num_classes=1000)
]
Enable Mixed Precision Training for Supported GPUs to utilize the optimized Tensor Cores for Matrix Operations.
Read About Tensor Cores Here: Tensor Cores - Nvidia Developer
# Mixed Precision
tf.keras.mixed_precision.set_global_policy("mixed_float16")
INFO:tensorflow:Mixed precision compatibility check (mixed_float16): OK Your GPU will likely run quickly with dtype policy mixed_float16 as it has compute capability of at least 7.0. Your GPU: GeForce RTX 2080 Ti, compute capability 7.5
# Constants
BATCH_SIZE = 512
# Init Data Loaders
train_data_loader = ImageNetDataLoader(
source_data_dir = "/mnt/data/pycodes/Dataset/imagenet2012",
dest_data_dir = "/home/ani/Documents/datasets/imagenet",
split = "train",
image_dims = (224, 224),
)
val_data_loader = ImageNetDataLoader(
source_data_dir = "/mnt/data/pycodes/Dataset/imagenet2012",
dest_data_dir = "/home/ani/Documents/datasets/imagenet",
split = "validation",
image_dims = (224, 224),
)
train_generator = train_data_loader.dataset_generator(batch_size=BATCH_SIZE, augment=False)
val_generator = val_data_loader.dataset_generator(batch_size=BATCH_SIZE, augment=False)
train_steps = train_data_loader.get_num_steps()
val_steps = val_data_loader.get_num_steps()
# Constants
EPOCHS = 200
# Compile & Train
alexnet.compile(
loss=tf.keras.losses.CategoricalCrossentropy(),
optimizer=tf.keras.optimizers.SGD(
learning_rate=0.01, momentum=0.9, nesterov=False, name='SGD'
),
metrics=metrics,
)
history = alexnet.fit(
epochs=EPOCHS,
x=train_generator,
steps_per_epoch=train_steps,
validation_data=val_generator,
validation_steps=val_steps,
callbacks=callbacks
)
Epoch 1/200 2503/2503 [==============================] - 641s 252ms/step - loss: 6.5866 - categorical_accuracy: 0.0102 - false_negatives: 641048.4065 - false_positives: 201.6713 - precision: 0.3615 - recall: 2.1400e-04 - f1_score: 0.0074 - val_loss: 5.7266 - val_categorical_accuracy: 0.0548 - val_false_negatives: 49992.0000 - val_false_positives: 83.0000 - val_precision: 0.6891 - val_recall: 0.0037 - val_f1_score: 0.0374 Epoch 2/200 2503/2503 [==============================] - 613s 245ms/step - loss: 4.8416 - categorical_accuracy: 0.1058 - false_negatives: 631017.4593 - false_positives: 6716.9633 - precision: 0.5944 - recall: 0.0134 - f1_score: 0.0900 - val_loss: 4.5955 - val_categorical_accuracy: 0.1381 - val_false_negatives: 48687.0000 - val_false_positives: 811.0000 - val_precision: 0.6474 - val_recall: 0.0297 - val_f1_score: 0.1221 Epoch 3/200 2503/2503 [==============================] - 610s 244ms/step - loss: 4.0719 - categorical_accuracy: 0.1934 - false_negatives: 604644.7684 - false_positives: 18442.4980 - precision: 0.6614 - recall: 0.0540 - f1_score: 0.1773 - val_loss: 3.9852 - val_categorical_accuracy: 0.2100 - val_false_negatives: 46984.0000 - val_false_positives: 1226.0000 - val_precision: 0.7225 - val_recall: 0.0636 - val_f1_score: 0.1969 Epoch 4/200 2503/2503 [==============================] - 613s 245ms/step - loss: 3.6099 - categorical_accuracy: 0.2562 - false_negatives: 576617.0128 - false_positives: 28701.1953 - precision: 0.6909 - recall: 0.0984 - f1_score: 0.2418 - val_loss: 3.7200 - val_categorical_accuracy: 0.2506 - val_false_negatives: 44738.0000 - val_false_positives: 2470.0000 - val_precision: 0.6877 - val_recall: 0.1084 - val_f1_score: 0.2340 Epoch 5/200 2503/2503 [==============================] - 614s 245ms/step - loss: 3.3020 - categorical_accuracy: 0.3022 - false_negatives: 551932.0687 - false_positives: 36392.9081 - precision: 0.7104 - recall: 0.1371 - f1_score: 0.2898 - val_loss: 3.3409 - val_categorical_accuracy: 0.3072 - val_false_negatives: 44571.0000 - val_false_positives: 1591.0000 - val_precision: 0.7789 - val_recall: 0.1117 - val_f1_score: 0.2957 Epoch 6/200 2503/2503 [==============================] - 615s 246ms/step - loss: 3.0570 - categorical_accuracy: 0.3401 - false_negatives: 529347.8031 - false_positives: 42059.7097 - precision: 0.7270 - recall: 0.1730 - f1_score: 0.3288 - val_loss: 3.1575 - val_categorical_accuracy: 0.3340 - val_false_negatives: 43019.0000 - val_false_positives: 2005.0000 - val_precision: 0.7812 - val_recall: 0.1426 - val_f1_score: 0.3212 Epoch 7/200 2503/2503 [==============================] - 617s 247ms/step - loss: 2.8639 - categorical_accuracy: 0.3720 - false_negatives: 509607.6573 - false_positives: 46695.5982 - precision: 0.7388 - recall: 0.2050 - f1_score: 0.3615 - val_loss: 3.0793 - val_categorical_accuracy: 0.3485 - val_false_negatives: 42125.0000 - val_false_positives: 2360.0000 - val_precision: 0.7733 - val_recall: 0.1605 - val_f1_score: 0.3389 Epoch 8/200 2503/2503 [==============================] - 618s 247ms/step - loss: 2.7018 - categorical_accuracy: 0.3990 - false_negatives: 492222.5623 - false_positives: 50834.9457 - precision: 0.7468 - recall: 0.2324 - f1_score: 0.3896 - val_loss: 2.9106 - val_categorical_accuracy: 0.3753 - val_false_negatives: 40479.0000 - val_false_positives: 2874.0000 - val_precision: 0.7714 - val_recall: 0.1933 - val_f1_score: 0.3649 Epoch 9/200 2503/2503 [==============================] - 616s 246ms/step - loss: 2.5613 - categorical_accuracy: 0.4224 - false_negatives: 475838.5531 - false_positives: 53982.2468 - precision: 0.7550 - recall: 0.2589 - f1_score: 0.4137 - val_loss: 2.8105 - val_categorical_accuracy: 0.3901 - val_false_negatives: 38596.0000 - val_false_positives: 3852.0000 - val_precision: 0.7504 - val_recall: 0.2308 - val_f1_score: 0.3773 Epoch 10/200 2503/2503 [==============================] - 617s 247ms/step - loss: 2.4381 - categorical_accuracy: 0.4438 - false_negatives: 461085.4026 - false_positives: 56517.5571 - precision: 0.7626 - recall: 0.2824 - f1_score: 0.4352 - val_loss: 2.7099 - val_categorical_accuracy: 0.4068 - val_false_negatives: 38121.0000 - val_false_positives: 3696.0000 - val_precision: 0.7653 - val_recall: 0.2403 - val_f1_score: 0.3951 Epoch 11/200 2503/2503 [==============================] - 614s 245ms/step - loss: 2.3311 - categorical_accuracy: 0.4626 - false_negatives: 447609.5463 - false_positives: 58637.2125 - precision: 0.7690 - recall: 0.3029 - f1_score: 0.4548 - val_loss: 2.8438 - val_categorical_accuracy: 0.3873 - val_false_negatives: 38488.0000 - val_false_positives: 4199.0000 - val_precision: 0.7357 - val_recall: 0.2329 - val_f1_score: 0.3761 Epoch 12/200 2503/2503 [==============================] - 610s 244ms/step - loss: 2.2313 - categorical_accuracy: 0.4795 - false_negatives: 434406.6218 - false_positives: 60883.6673 - precision: 0.7738 - recall: 0.3238 - f1_score: 0.4724 - val_loss: 2.6838 - val_categorical_accuracy: 0.4117 - val_false_negatives: 37346.0000 - val_false_positives: 4178.0000 - val_precision: 0.7544 - val_recall: 0.2557 - val_f1_score: 0.4019 Epoch 13/200 2503/2503 [==============================] - 612s 245ms/step - loss: 2.1444 - categorical_accuracy: 0.4951 - false_negatives: 422376.3754 - false_positives: 62631.8091 - precision: 0.7782 - recall: 0.3425 - f1_score: 0.4885 - val_loss: 2.6539 - val_categorical_accuracy: 0.4174 - val_false_negatives: 36958.0000 - val_false_positives: 4422.0000 - val_precision: 0.7493 - val_recall: 0.2634 - val_f1_score: 0.4080 Epoch 14/200 2503/2503 [==============================] - 615s 246ms/step - loss: 2.0555 - categorical_accuracy: 0.5112 - false_negatives: 410333.1973 - false_positives: 64465.0403 - precision: 0.7824 - recall: 0.3616 - f1_score: 0.5050 - val_loss: 2.6105 - val_categorical_accuracy: 0.4278 - val_false_negatives: 36101.0000 - val_false_positives: 4883.0000 - val_precision: 0.7424 - val_recall: 0.2805 - val_f1_score: 0.4167 Epoch 15/200 2503/2503 [==============================] - 610s 244ms/step - loss: 1.9656 - categorical_accuracy: 0.5270 - false_negatives: 398852.4553 - false_positives: 66025.4581 - precision: 0.7871 - recall: 0.3802 - f1_score: 0.5213 - val_loss: 2.6651 - val_categorical_accuracy: 0.4217 - val_false_negatives: 35403.0000 - val_false_positives: 6034.0000 - val_precision: 0.7100 - val_recall: 0.2944 - val_f1_score: 0.4120 Epoch 16/200 2503/2503 [==============================] - 614s 245ms/step - loss: 1.8926 - categorical_accuracy: 0.5403 - false_negatives: 387221.9417 - false_positives: 67380.5643 - precision: 0.7917 - recall: 0.3981 - f1_score: 0.5345 - val_loss: 2.5518 - val_categorical_accuracy: 0.4369 - val_false_negatives: 35303.0000 - val_false_positives: 5253.0000 - val_precision: 0.7390 - val_recall: 0.2964 - val_f1_score: 0.4300 Epoch 17/200 2503/2503 [==============================] - 611s 244ms/step - loss: 1.8174 - categorical_accuracy: 0.5541 - false_negatives: 377029.5292 - false_positives: 69400.5707 - precision: 0.7932 - recall: 0.4143 - f1_score: 0.5487 - val_loss: 2.5038 - val_categorical_accuracy: 0.4460 - val_false_negatives: 34616.0000 - val_false_positives: 5408.0000 - val_precision: 0.7421 - val_recall: 0.3101 - val_f1_score: 0.4361 Epoch 18/200 2503/2503 [==============================] - 612s 245ms/step - loss: 1.7485 - categorical_accuracy: 0.5662 - false_negatives: 366559.4856 - false_positives: 70479.0383 - precision: 0.7972 - recall: 0.4308 - f1_score: 0.5611 - val_loss: 2.6187 - val_categorical_accuracy: 0.4330 - val_false_negatives: 34769.0000 - val_false_positives: 6230.0000 - val_precision: 0.7121 - val_recall: 0.3071 - val_f1_score: 0.4245 Epoch 19/200 2503/2503 [==============================] - 615s 246ms/step - loss: 1.6737 - categorical_accuracy: 0.5808 - false_negatives: 355681.6673 - false_positives: 71728.1709 - precision: 0.8008 - recall: 0.4485 - f1_score: 0.5759 - val_loss: 2.5517 - val_categorical_accuracy: 0.4430 - val_false_negatives: 34164.0000 - val_false_positives: 6174.0000 - val_precision: 0.7217 - val_recall: 0.3191 - val_f1_score: 0.4324 Epoch 20/200 2503/2503 [==============================] - 605s 242ms/step - loss: 1.4350 - categorical_accuracy: 0.6317 - false_negatives: 312078.5152 - false_positives: 68917.2005 - precision: 0.8247 - recall: 0.5077 - f1_score: 0.6272 - val_loss: 2.4046 - val_categorical_accuracy: 0.4728 - val_false_negatives: 32364.0000 - val_false_positives: 6651.0000 - val_precision: 0.7281 - val_recall: 0.3550 - val_f1_score: 0.4637 Epoch 21/200 2503/2503 [==============================] - 604s 241ms/step - loss: 1.3363 - categorical_accuracy: 0.6529 - false_negatives: 296463.8355 - false_positives: 68141.9708 - precision: 0.8347 - recall: 0.5369 - f1_score: 0.6489 - val_loss: 2.4125 - val_categorical_accuracy: 0.4732 - val_false_negatives: 32114.0000 - val_false_positives: 6939.0000 - val_precision: 0.7225 - val_recall: 0.3600 - val_f1_score: 0.4641 Epoch 22/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2943 - categorical_accuracy: 0.6620 - false_negatives: 289854.4760 - false_positives: 68270.2468 - precision: 0.8378 - recall: 0.5483 - f1_score: 0.6582 - val_loss: 2.4212 - val_categorical_accuracy: 0.4719 - val_false_negatives: 31958.0000 - val_false_positives: 7200.0000 - val_precision: 0.7167 - val_recall: 0.3631 - val_f1_score: 0.4629 Epoch 23/200 2503/2503 [==============================] - 607s 242ms/step - loss: 1.2653 - categorical_accuracy: 0.6674 - false_negatives: 284486.9457 - false_positives: 68262.7516 - precision: 0.8394 - recall: 0.5569 - f1_score: 0.6636 - val_loss: 2.4224 - val_categorical_accuracy: 0.4718 - val_false_negatives: 31995.0000 - val_false_positives: 7140.0000 - val_precision: 0.7180 - val_recall: 0.3623 - val_f1_score: 0.4633 Epoch 24/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2281 - categorical_accuracy: 0.6759 - false_negatives: 278755.2568 - false_positives: 67063.5040 - precision: 0.8441 - recall: 0.5645 - f1_score: 0.6727 - val_loss: 2.4130 - val_categorical_accuracy: 0.4752 - val_false_negatives: 31658.0000 - val_false_positives: 7318.0000 - val_precision: 0.7168 - val_recall: 0.3691 - val_f1_score: 0.4664 Epoch 25/200 2503/2503 [==============================] - 605s 242ms/step - loss: 1.2197 - categorical_accuracy: 0.6785 - false_negatives: 276785.8690 - false_positives: 67003.3870 - precision: 0.8446 - recall: 0.5682 - f1_score: 0.6749 - val_loss: 2.4146 - val_categorical_accuracy: 0.4753 - val_false_negatives: 31636.0000 - val_false_positives: 7378.0000 - val_precision: 0.7153 - val_recall: 0.3695 - val_f1_score: 0.4664 Epoch 26/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2180 - categorical_accuracy: 0.6783 - false_negatives: 276206.4329 - false_positives: 67388.4537 - precision: 0.8441 - recall: 0.5688 - f1_score: 0.6747 - val_loss: 2.4160 - val_categorical_accuracy: 0.4747 - val_false_negatives: 31555.0000 - val_false_positives: 7475.0000 - val_precision: 0.7136 - val_recall: 0.3711 - val_f1_score: 0.4660 Epoch 27/200 2503/2503 [==============================] - 610s 244ms/step - loss: 1.2103 - categorical_accuracy: 0.6804 - false_negatives: 274694.0367 - false_positives: 66737.4681 - precision: 0.8463 - recall: 0.5719 - f1_score: 0.6769 - val_loss: 2.4152 - val_categorical_accuracy: 0.4759 - val_false_negatives: 31568.0000 - val_false_positives: 7457.0000 - val_precision: 0.7139 - val_recall: 0.3709 - val_f1_score: 0.4672 Epoch 28/200 2503/2503 [==============================] - 607s 243ms/step - loss: 1.2106 - categorical_accuracy: 0.6802 - false_negatives: 274988.5523 - false_positives: 66800.8618 - precision: 0.8457 - recall: 0.5714 - f1_score: 0.6769 - val_loss: 2.4151 - val_categorical_accuracy: 0.4756 - val_false_negatives: 31556.0000 - val_false_positives: 7462.0000 - val_precision: 0.7139 - val_recall: 0.3711 - val_f1_score: 0.4668 Epoch 29/200 2503/2503 [==============================] - 610s 244ms/step - loss: 1.2104 - categorical_accuracy: 0.6800 - false_negatives: 274888.0783 - false_positives: 67439.5863 - precision: 0.8443 - recall: 0.5708 - f1_score: 0.6765 - val_loss: 2.4152 - val_categorical_accuracy: 0.4756 - val_false_negatives: 31570.0000 - val_false_positives: 7475.0000 - val_precision: 0.7134 - val_recall: 0.3708 - val_f1_score: 0.4668 Epoch 30/200 2503/2503 [==============================] - 609s 243ms/step - loss: 1.2097 - categorical_accuracy: 0.6807 - false_negatives: 274569.8486 - false_positives: 67046.4173 - precision: 0.8456 - recall: 0.5721 - f1_score: 0.6771 - val_loss: 2.4160 - val_categorical_accuracy: 0.4758 - val_false_negatives: 31571.0000 - val_false_positives: 7465.0000 - val_precision: 0.7137 - val_recall: 0.3708 - val_f1_score: 0.4669 Epoch 31/200 2503/2503 [==============================] - 609s 243ms/step - loss: 1.2088 - categorical_accuracy: 0.6802 - false_negatives: 274735.0323 - false_positives: 67052.0092 - precision: 0.8456 - recall: 0.5714 - f1_score: 0.6767 - val_loss: 2.4154 - val_categorical_accuracy: 0.4754 - val_false_negatives: 31574.0000 - val_false_positives: 7487.0000 - val_precision: 0.7130 - val_recall: 0.3707 - val_f1_score: 0.4665 Epoch 32/200 2503/2503 [==============================] - 609s 243ms/step - loss: 1.2093 - categorical_accuracy: 0.6795 - false_negatives: 274966.7780 - false_positives: 67184.7744 - precision: 0.8451 - recall: 0.5711 - f1_score: 0.6759 - val_loss: 2.4155 - val_categorical_accuracy: 0.4753 - val_false_negatives: 31569.0000 - val_false_positives: 7468.0000 - val_precision: 0.7136 - val_recall: 0.3708 - val_f1_score: 0.4664 Epoch 33/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2107 - categorical_accuracy: 0.6806 - false_negatives: 274937.5016 - false_positives: 67086.2504 - precision: 0.8455 - recall: 0.5716 - f1_score: 0.6770 - val_loss: 2.4153 - val_categorical_accuracy: 0.4755 - val_false_negatives: 31562.0000 - val_false_positives: 7465.0000 - val_precision: 0.7138 - val_recall: 0.3710 - val_f1_score: 0.4666 Epoch 34/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2086 - categorical_accuracy: 0.6803 - false_negatives: 274783.3754 - false_positives: 67355.9309 - precision: 0.8446 - recall: 0.5715 - f1_score: 0.6767 - val_loss: 2.4160 - val_categorical_accuracy: 0.4754 - val_false_negatives: 31567.0000 - val_false_positives: 7478.0000 - val_precision: 0.7133 - val_recall: 0.3709 - val_f1_score: 0.4666 Epoch 35/200 2503/2503 [==============================] - 609s 243ms/step - loss: 1.2062 - categorical_accuracy: 0.6805 - false_negatives: 274261.1913 - false_positives: 66908.2959 - precision: 0.8456 - recall: 0.5719 - f1_score: 0.6772 - val_loss: 2.4154 - val_categorical_accuracy: 0.4760 - val_false_negatives: 31556.0000 - val_false_positives: 7452.0000 - val_precision: 0.7142 - val_recall: 0.3711 - val_f1_score: 0.4672 Epoch 36/200 2503/2503 [==============================] - 609s 243ms/step - loss: 1.2082 - categorical_accuracy: 0.6802 - false_negatives: 274581.0016 - false_positives: 67120.5411 - precision: 0.8451 - recall: 0.5718 - f1_score: 0.6767 - val_loss: 2.4156 - val_categorical_accuracy: 0.4757 - val_false_negatives: 31546.0000 - val_false_positives: 7463.0000 - val_precision: 0.7140 - val_recall: 0.3713 - val_f1_score: 0.4668 Epoch 37/200 2503/2503 [==============================] - 616s 246ms/step - loss: 1.2102 - categorical_accuracy: 0.6802 - false_negatives: 274593.7252 - false_positives: 66828.6050 - precision: 0.8459 - recall: 0.5716 - f1_score: 0.6767 - val_loss: 2.4164 - val_categorical_accuracy: 0.4756 - val_false_negatives: 31560.0000 - val_false_positives: 7484.0000 - val_precision: 0.7133 - val_recall: 0.3710 - val_f1_score: 0.4666 Epoch 38/200 2503/2503 [==============================] - 607s 242ms/step - loss: 1.2104 - categorical_accuracy: 0.6804 - false_negatives: 274740.6030 - false_positives: 66942.3814 - precision: 0.8456 - recall: 0.5715 - f1_score: 0.6771 - val_loss: 2.4153 - val_categorical_accuracy: 0.4759 - val_false_negatives: 31547.0000 - val_false_positives: 7482.0000 - val_precision: 0.7135 - val_recall: 0.3713 - val_f1_score: 0.4671 Epoch 39/200 2503/2503 [==============================] - 607s 242ms/step - loss: 1.2070 - categorical_accuracy: 0.6807 - false_negatives: 274460.3019 - false_positives: 67352.2556 - precision: 0.8450 - recall: 0.5721 - f1_score: 0.6770 - val_loss: 2.4152 - val_categorical_accuracy: 0.4754 - val_false_negatives: 31551.0000 - val_false_positives: 7475.0000 - val_precision: 0.7136 - val_recall: 0.3712 - val_f1_score: 0.4665 Epoch 40/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2093 - categorical_accuracy: 0.6802 - false_negatives: 274564.4389 - false_positives: 67083.0851 - precision: 0.8451 - recall: 0.5719 - f1_score: 0.6767 - val_loss: 2.4150 - val_categorical_accuracy: 0.4754 - val_false_negatives: 31572.0000 - val_false_positives: 7467.0000 - val_precision: 0.7136 - val_recall: 0.3708 - val_f1_score: 0.4665 Epoch 41/200 2503/2503 [==============================] - 606s 242ms/step - loss: 1.2128 - categorical_accuracy: 0.6790 - false_negatives: 274925.0296 - false_positives: 67521.3415 - precision: 0.8441 - recall: 0.5711 - f1_score: 0.6754 - val_loss: 2.4155 - val_categorical_accuracy: 0.4760 - val_false_negatives: 31551.0000 - val_false_positives: 7459.0000 - val_precision: 0.7140 - val_recall: 0.3712 - val_f1_score: 0.4672 Epoch 42/200 2503/2503 [==============================] - 606s 242ms/step - loss: 1.2087 - categorical_accuracy: 0.6805 - false_negatives: 274473.9908 - false_positives: 67332.9397 - precision: 0.8449 - recall: 0.5718 - f1_score: 0.6770 - val_loss: 2.4158 - val_categorical_accuracy: 0.4760 - val_false_negatives: 31559.0000 - val_false_positives: 7467.0000 - val_precision: 0.7137 - val_recall: 0.3710 - val_f1_score: 0.4671 Epoch 43/200 2503/2503 [==============================] - 610s 244ms/step - loss: 1.2100 - categorical_accuracy: 0.6806 - false_negatives: 274519.1310 - false_positives: 67079.9213 - precision: 0.8457 - recall: 0.5723 - f1_score: 0.6770 - val_loss: 2.4161 - val_categorical_accuracy: 0.4757 - val_false_negatives: 31558.0000 - val_false_positives: 7463.0000 - val_precision: 0.7139 - val_recall: 0.3711 - val_f1_score: 0.4669 Epoch 44/200 2503/2503 [==============================] - 608s 243ms/step - loss: 1.2102 - categorical_accuracy: 0.6805 - false_negatives: 274677.8990 - false_positives: 67072.1418 - precision: 0.8453 - recall: 0.5719 - f1_score: 0.6769 - val_loss: 2.4156 - val_categorical_accuracy: 0.4759 - val_false_negatives: 31559.0000 - val_false_positives: 7459.0000 - val_precision: 0.7140 - val_recall: 0.3710 - val_f1_score: 0.4671 Epoch 45/200 2503/2503 [==============================] - 609s 243ms/step - loss: 1.2098 - categorical_accuracy: 0.6795 - false_negatives: 274783.9365 - false_positives: 67246.6941 - precision: 0.8449 - recall: 0.5718 - f1_score: 0.6760 - val_loss: 2.4164 - val_categorical_accuracy: 0.4756 - val_false_negatives: 31548.0000 - val_false_positives: 7450.0000 - val_precision: 0.7143 - val_recall: 0.3713 - val_f1_score: 0.4667 Restoring model weights from the end of the best epoch. Epoch 00045: early stopping