Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ar-noc/keras-smoke-detection
  • i3perez/keras-smoke-detection
  • hpwren-dev/keras-smoke-detection
3 results
Show changes
Commits on Source (219)
Showing with 27935 additions and 20 deletions
image: docker:git
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.nautilus.optiputer.net
image: gcr.io/kaniko-project/executor:debug-v0.16.0
stages:
- build-and-push
build-and-push-job:
stage: build-and-push
tags:
- build-as-docker
except:
changes:
- "**/*.yaml"
- "README.md"
- "screenshots/*.PNG"
script:
- docker build -t gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} .
- docker tag gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:latest
- docker push gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8} --destination $CI_REGISTRY_IMAGE:latest
\ No newline at end of file
%% Cell type:code id: tags:
``` python
import tensorflow as tf; print(tf.__version__)
```
%% Output
2.0.0
%% Cell type:code id: tags:
``` python
import keras
```
%% Output
Using TensorFlow backend.
%% Cell type:code id: tags:
``` python
tf.test.gpu_device_name()
```
%% Output
'/device:GPU:0'
%% Cell type:code id: tags:
``` python
tf.test.is_built_with_cuda()
tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None)
```
%% Output
True
%% Cell type:markdown id: tags:
#### GPU Hickups
%% Cell type:code id: tags:
``` python
physical_devices = tf.config.experimental.list_physical_devices('GPU')
# physical_devices = tf.config.experimental.list_physical_device
tf.config.experimental.set_memory_growth(physical_devices[0], True)
assert tf.config.experimental.get_memory_growth(physical_devices[0])
```
%% Cell type:markdown id: tags:
#### GPU-Tests
%% Cell type:code id: tags:
``` python
from keras import backend as K
K.tensorflow_backend._get_available_gpus()
```
%% Output
['/job:localhost/replica:0/task:0/device:GPU:0']
%% Cell type:code id: tags:
``` python
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
```
%% Output
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 1235784618601914649
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 15452097616079958181
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 12893943707023111449
physical_device_desc: "device: XLA_GPU device"
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 29032448
locality {
bus_id: 1
links {
}
}
incarnation: 4085920435716643793
physical_device_desc: "device: 0, name: GeForce GTX 1080, pci bus id: 0000:09:00.0, compute capability: 6.1"
]
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
### Detection CNN
%% Cell type:code id: tags:
``` python
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.layers import SeparableConv2D
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Dropout
from tensorflow.keras.layers import Dense
```
%% Cell type:code id: tags:
``` python
class FireDetectionNet:
@staticmethod
def build(width, height, depth, classes):
# initialize the model along with the input shape to be
# "channels last" and the channels dimension itself
model = Sequential()
inputShape = (height, width, depth)
chanDim = -1
model.add(SeparableConv2D(16, (7, 7), padding="same",
input_shape=inputShape))
model.add(Activation("relu"))
model.add(BatchNormalization(axis=chanDim))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(SeparableConv2D(32, (3, 3), padding="same"))
model.add(Activation("relu"))
model.add(BatchNormalization(axis=chanDim))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(SeparableConv2D(64, (3, 3), padding="same"))
model.add(Activation("relu"))
model.add(BatchNormalization(axis=chanDim))
model.add(SeparableConv2D(64, (3, 3), padding="same"))
model.add(Activation("relu"))
model.add(BatchNormalization(axis=chanDim))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(128))
model.add(Activation("relu"))
model.add(BatchNormalization())
model.add(Dropout(0.5))
# second set of FC => RELU layers
model.add(Dense(128))
model.add(Activation("relu"))
model.add(BatchNormalization())
model.add(Dropout(0.5))
# softmax classifier
model.add(Dense(classes))
model.add(Activation("softmax"))
# return the constructed network architecture
return model
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
### Learning Rate Finder
%% Cell type:code id: tags:
``` python
from tensorflow.keras.callbacks import LambdaCallback
from tensorflow.keras import backend as K
import matplotlib.pyplot as plt
import numpy as np
import tempfile
import cv2
```
%% Cell type:code id: tags:
``` python
class LearningRateFinder:
def __init__(self, model, stopFactor=4, beta=0.98):
# store the model, stop factor, and beta value (for computing
# a smoothed, average loss)
self.model = model
self.stopFactor = stopFactor
self.beta = beta
# initialize our list of learning rates and losses,
# respectively
self.lrs = []
self.losses = []
# initialize our learning rate multiplier, average loss, best
# loss found thus far, current batch number, and weights file
self.lrMult = 1
self.avgLoss = 0
self.bestLoss = 1e9
self.batchNum = 0
self.weightsFile = None
def reset(self):
# re-initialize all variables from our constructor
self.lrs = []
self.losses = []
self.lrMult = 1
self.avgLoss = 0
self.bestLoss = 1e9
self.batchNum = 0
self.weightsFile = None
def is_data_iter(self, data):
# define the set of class types we will check for
iterClasses = ["NumpyArrayIterator", "DirectoryIterator",
"DataFrameIterator", "Iterator", "Sequence"]
# return whether our data is an iterator
return data.__class__.__name__ in iterClasses
def on_batch_end(self, batch, logs):
# grab the current learning rate and add log it to the list of
# learning rates that we've tried
lr = K.get_value(self.model.optimizer.lr)
self.lrs.append(lr)
# grab the loss at the end of this batch, increment the total
# number of batches processed, compute the average average
# loss, smooth it, and update the losses list with the
# smoothed value
l = logs["loss"]
self.batchNum += 1
self.avgLoss = (self.beta * self.avgLoss) + ((1 - self.beta) * l)
smooth = self.avgLoss / (1 - (self.beta ** self.batchNum))
self.losses.append(smooth)
# compute the maximum loss stopping factor value
stopLoss = self.stopFactor * self.bestLoss
# check to see whether the loss has grown too large
if self.batchNum > 1 and smooth > stopLoss:
# stop returning and return from the method
self.model.stop_training = True
return
# check to see if the best loss should be updated
if self.batchNum == 1 or smooth < self.bestLoss:
self.bestLoss = smooth
# increase the learning rate
lr *= self.lrMult
K.set_value(self.model.optimizer.lr, lr)
def find(self, trainData, startLR, endLR, epochs=None,
stepsPerEpoch=None, batchSize=32, sampleSize=2048,
classWeight=None, verbose=1):
# reset our class-specific variables
self.reset()
# determine if we are using a data generator or not
useGen = self.is_data_iter(trainData)
# if we're using a generator and the steps per epoch is not
# supplied, raise an error
if useGen and stepsPerEpoch is None:
msg = "Using generator without supplying stepsPerEpoch"
raise Exception(msg)
# if we're not using a generator then our entire dataset must
# already be in memory
elif not useGen:
# grab the number of samples in the training data and
# then derive the number of steps per epoch
numSamples = len(trainData[0])
stepsPerEpoch = np.ceil(numSamples / float(batchSize))
# if no number of training epochs are supplied, compute the
# training epochs based on a default sample size
if epochs is None:
epochs = int(np.ceil(sampleSize / float(stepsPerEpoch)))
# compute the total number of batch updates that will take
# place while we are attempting to find a good starting
# learning rate
numBatchUpdates = epochs * stepsPerEpoch
# derive the learning rate multiplier based on the ending
# learning rate, starting learning rate, and total number of
# batch updates
self.lrMult = (endLR / startLR) ** (1.0 / numBatchUpdates)
# create a temporary file path for the model weights and
# then save the weights (so we can reset the weights when we
# are done)
self.weightsFile = tempfile.mkstemp()[1]
self.model.save_weights(self.weightsFile)
# grab the *original* learning rate (so we can reset it
# later), and then set the *starting* learning rate
origLR = K.get_value(self.model.optimizer.lr)
K.set_value(self.model.optimizer.lr, startLR)
# construct a callback that will be called at the end of each
# batch, enabling us to increase our learning rate as training
# progresses
callback = LambdaCallback(on_batch_end=lambda batch, logs:
self.on_batch_end(batch, logs))
# check to see if we are using a data iterator
if useGen:
self.model.fit_generator(
trainData,
steps_per_epoch=stepsPerEpoch,
epochs=epochs,
class_weight=classWeight,
verbose=verbose,
callbacks=[callback])
# otherwise, our entire training data is already in memory
else:
# train our model using Keras' fit method
self.model.fit(
trainData[0], trainData[1],
batch_size=batchSize,
epochs=epochs,
class_weight=classWeight,
callbacks=[callback],
verbose=verbose)
# restore the original model weights and learning rate
self.model.load_weights(self.weightsFile)
K.set_value(self.model.optimizer.lr, origLR)
def plot_loss(self, skipBegin=10, skipEnd=1, title=""):
# grab the learning rate and losses values to plot
lrs = self.lrs[skipBegin:-skipEnd]
losses = self.losses[skipBegin:-skipEnd]
# plot the learning rate vs. loss
plt.plot(lrs, losses)
plt.xscale("log")
plt.xlabel("Learning Rate (Log Scale)")
plt.ylabel("Loss")
# if the title is not empty, add it to the plot
if title != "":
plt.title(title)
```
%% Cell type:markdown id: tags:
### Traning/Test image base and graph outputs
%% Cell type:code id: tags:
``` python
# import the necessary packages
import os
# initialize the path to the fire and non-fire dataset directories
Image_Path = "/userdata/kerasData/images/hpwren.ucsd.edu/HWB/HPWREN-FIgLib"
# NON_FIRE_PATH = "/userdata/kerasData/HPWREN-data/BEFORE/images"
# initialize the class labels in the dataset
CLASSES = ["Non-Fire", "Fire"]
# define the size of the training and testing split
TRAIN_SPLIT = 0.85
TEST_SPLIT = 0.15
```
%% Cell type:code id: tags:
``` python
# define the initial learning rate, batch size, and number of epochs
INIT_LR = 1e-4
BATCH_SIZE = 64
NUM_EPOCHS = 1000
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
# set the path to the serialized model after training
MODEL_PATH = os.path.sep.join(["output", "fire_detection.model"])
# define the path to the output learning rate finder plot and
# training history plot
LRFIND_PLOT_PATH = os.path.sep.join(["/userdata/kerasData",
"output", "lrfindd_plot.png"])
TRAINING_PLOT_PATH = os.path.sep.join(["/userdata/kerasData",
"output", "training_plot.png"])
# define the path to the output directory that will store our final
# output with labels/annotations along with the number of iamges to
# sample
OUTPUT_IMAGE_PATH = os.path.sep.join(["output", "examples"])
SAMPLE_SIZE = 500
```
%% Cell type:code id: tags:
``` python
LRFIND_PLOT_PATH
```
%% Output
'/userdata/kerasData/output/lrfindd_plot.png'
%% Cell type:markdown id: tags:
### Loading Data
%% Cell type:code id: tags:
``` python
import matplotlib
matplotlib.use("Agg")
# import the necessary packages
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.utils import to_categorical
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
# from imutils import paths
import matplotlib.pyplot as plt
import numpy as np
import argparse
import cv2
import os
import sys
import re
from PIL import Image
```
%% Cell type:code id: tags:
``` python
def loadData(pathToFiles):
Xtrain = np.load(f"{pathToFiles}trainX.npy")
Xtest = np.load(f"{pathToFiles}testX.npy")
XValidation = np.load(f"{pathToFiles}validationX.npy")
Ytrain = np.load(f"{pathToFiles}trainY.npy")
Ytest = np.load(f"{pathToFiles}testY.npy")
YValidation = np.load(f"{pathToFiles}validationY.npy")
classWeight = np.load(f"{pathToFiles}classWeight.npy")
return Xtrain, Xtest, XValidation, Ytrain, Ytest, YValidation, classWeight
mypath = "/userdata/kerasData/"
Xtrain, Xtest, Xvalidation, Ytrain, Ytest, Yvalidation, classWeight = loadData(mypath)
```
%% Cell type:code id: tags:
``` python
# (trainX, testX, trainY, testY) = train_test_split(data, labels,
# test_size=0.1, random_state=42)
# trainY[1]
```
%% Cell type:markdown id: tags:
#### Image Load Tester
%% Cell type:markdown id: tags:
## Start of Model
%% Cell type:code id: tags:
``` python
model = FireDetectionNet.build(width=128, height=128, depth=3,
classes=2)
```
%% Cell type:code id: tags:
``` python
# serialize model to JSON
model_json = model.to_json()
with open("model.json", "w") as json_file:
json_file.write(model_json)
# serialize weights to HDF5
# model.save_weights("model.h5")
# print("Saved model to disk")
```
%% Cell type:code id: tags:
``` python
!pwd
```
%% Cell type:code id: tags:
``` python
opt = SGD(lr=INIT_LR, momentum=0.9,
decay=INIT_LR / NUM_EPOCHS)
model.compile(loss="binary_crossentropy", optimizer=opt,
metrics=["accuracy"])
aug = ImageDataGenerator(
rotation_range=30,
zoom_range=0.15,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.15,
horizontal_flip=True,
fill_mode="nearest")
```
%% Cell type:code id: tags:
``` python
BATCH_SIZE = 64
```
%% Cell type:code id: tags:
``` python
classWeight
```
%% Cell type:markdown id: tags:
#### Learning Rate Finder
%% Cell type:code id: tags:
``` python
lrf = LearningRateFinder(model)
```
%% Cell type:code id: tags:
``` python
classWeight
```
%% Output
array([1.0218488, 1. ], dtype=float32)
%% Cell type:code id: tags:
``` python
classWeight
```
%% Output
array([1.0218488, 1. ], dtype=float32)
%% Cell type:code id: tags:
``` python
lrf.find(
aug.flow(Xtrain, Ytrain, batch_size=BATCH_SIZE),
1e-10, 1e+1,
stepsPerEpoch=np.ceil((Xtrain.shape[0] / float(BATCH_SIZE))),
epochs=100,
batchSize=BATCH_SIZE, classWeight=classWeight)
```
%% Output
Epoch 1/100
72/72 [==============================] - 20s 281ms/step - loss: 1.4097 - accuracy: 0.5026
Epoch 2/100
72/72 [==============================] - 20s 276ms/step - loss: 1.4250 - accuracy: 0.4943
Epoch 3/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3768 - accuracy: 0.5013
Epoch 4/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3722 - accuracy: 0.5105
Epoch 5/100
72/72 [==============================] - 20s 274ms/step - loss: 1.4293 - accuracy: 0.4871
Epoch 6/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3842 - accuracy: 0.5048
Epoch 7/100
72/72 [==============================] - 20s 276ms/step - loss: 1.3648 - accuracy: 0.5002
Epoch 8/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3873 - accuracy: 0.5072
Epoch 9/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3943 - accuracy: 0.5072
Epoch 10/100
72/72 [==============================] - 20s 271ms/step - loss: 1.4238 - accuracy: 0.4989
Epoch 11/100
72/72 [==============================] - 20s 276ms/step - loss: 1.4098 - accuracy: 0.4943
Epoch 12/100
72/72 [==============================] - 20s 274ms/step - loss: 1.4326 - accuracy: 0.4899
Epoch 13/100
72/72 [==============================] - 20s 275ms/step - loss: 1.4246 - accuracy: 0.4867
Epoch 14/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3950 - accuracy: 0.5035
Epoch 15/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3861 - accuracy: 0.5028
Epoch 16/100
72/72 [==============================] - 20s 273ms/step - loss: 1.4210 - accuracy: 0.5007
Epoch 17/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3840 - accuracy: 0.5022
Epoch 18/100
72/72 [==============================] - 20s 272ms/step - loss: 1.4085 - accuracy: 0.4985
Epoch 19/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3753 - accuracy: 0.4952
Epoch 20/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3995 - accuracy: 0.5098
Epoch 21/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3685 - accuracy: 0.4985
Epoch 22/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3683 - accuracy: 0.5026
Epoch 23/100
72/72 [==============================] - 20s 272ms/step - loss: 1.4103 - accuracy: 0.4891
Epoch 24/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3732 - accuracy: 0.5114
Epoch 25/100
72/72 [==============================] - 20s 273ms/step - loss: 1.4197 - accuracy: 0.4910
Epoch 26/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3837 - accuracy: 0.5103
Epoch 27/100
72/72 [==============================] - 20s 271ms/step - loss: 1.3695 - accuracy: 0.5011
Epoch 28/100
72/72 [==============================] - 20s 275ms/step - loss: 1.3478 - accuracy: 0.5105
Epoch 29/100
72/72 [==============================] - 20s 271ms/step - loss: 1.3546 - accuracy: 0.5118
Epoch 30/100
72/72 [==============================] - 19s 271ms/step - loss: 1.3953 - accuracy: 0.4961
Epoch 31/100
72/72 [==============================] - 20s 273ms/step - loss: 1.4179 - accuracy: 0.5050
Epoch 32/100
72/72 [==============================] - 20s 274ms/step - loss: 1.4327 - accuracy: 0.4873
Epoch 33/100
72/72 [==============================] - 20s 273ms/step - loss: 1.4244 - accuracy: 0.4974
Epoch 34/100
72/72 [==============================] - 20s 276ms/step - loss: 1.3839 - accuracy: 0.4937
Epoch 35/100
72/72 [==============================] - 20s 273ms/step - loss: 1.4101 - accuracy: 0.4923
Epoch 36/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3957 - accuracy: 0.5017
Epoch 37/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3864 - accuracy: 0.4961
Epoch 38/100
72/72 [==============================] - 20s 271ms/step - loss: 1.4591 - accuracy: 0.4799
Epoch 39/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3961 - accuracy: 0.5004
Epoch 40/100
72/72 [==============================] - 20s 272ms/step - loss: 1.3980 - accuracy: 0.5044
Epoch 41/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3543 - accuracy: 0.5033
Epoch 42/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3675 - accuracy: 0.4958
Epoch 43/100
72/72 [==============================] - 20s 276ms/step - loss: 1.3606 - accuracy: 0.4967
Epoch 44/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3665 - accuracy: 0.4998
Epoch 45/100
72/72 [==============================] - 20s 276ms/step - loss: 1.3334 - accuracy: 0.5050
Epoch 46/100
72/72 [==============================] - 20s 273ms/step - loss: 1.3550 - accuracy: 0.5004
Epoch 47/100
72/72 [==============================] - 20s 271ms/step - loss: 1.3514 - accuracy: 0.4910
Epoch 48/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3047 - accuracy: 0.5171
Epoch 49/100
72/72 [==============================] - 20s 274ms/step - loss: 1.3082 - accuracy: 0.5009
Epoch 50/100
72/72 [==============================] - 20s 272ms/step - loss: 1.2869 - accuracy: 0.4965
Epoch 51/100
72/72 [==============================] - 20s 272ms/step - loss: 1.2972 - accuracy: 0.5011
Epoch 52/100
72/72 [==============================] - 20s 274ms/step - loss: 1.2294 - accuracy: 0.5048
Epoch 53/100
72/72 [==============================] - 20s 273ms/step - loss: 1.2256 - accuracy: 0.5052
Epoch 54/100
72/72 [==============================] - 20s 271ms/step - loss: 1.1805 - accuracy: 0.5009
Epoch 55/100
72/72 [==============================] - 20s 275ms/step - loss: 1.1205 - accuracy: 0.5146
Epoch 56/100
72/72 [==============================] - 20s 271ms/step - loss: 1.1258 - accuracy: 0.5059
Epoch 57/100
72/72 [==============================] - 19s 271ms/step - loss: 1.0955 - accuracy: 0.5140
Epoch 58/100
72/72 [==============================] - 20s 274ms/step - loss: 1.0621 - accuracy: 0.4972
Epoch 59/100
72/72 [==============================] - 20s 272ms/step - loss: 1.0330 - accuracy: 0.5050
Epoch 60/100
72/72 [==============================] - 20s 273ms/step - loss: 0.9453 - accuracy: 0.5059
Epoch 61/100
72/72 [==============================] - 20s 274ms/step - loss: 0.8832 - accuracy: 0.5079
Epoch 62/100
72/72 [==============================] - 20s 273ms/step - loss: 0.8503 - accuracy: 0.5015
Epoch 63/100
72/72 [==============================] - 19s 270ms/step - loss: 0.7816 - accuracy: 0.5085
Epoch 64/100
72/72 [==============================] - 20s 274ms/step - loss: 0.7358 - accuracy: 0.5127
Epoch 65/100
72/72 [==============================] - 20s 274ms/step - loss: 0.7171 - accuracy: 0.5072
Epoch 66/100
72/72 [==============================] - 20s 274ms/step - loss: 0.7035 - accuracy: 0.5017
Epoch 67/100
72/72 [==============================] - 20s 273ms/step - loss: 0.7017 - accuracy: 0.5179
Epoch 68/100
72/72 [==============================] - 20s 272ms/step - loss: 0.7039 - accuracy: 0.5077
Epoch 69/100
72/72 [==============================] - 20s 273ms/step - loss: 0.7050 - accuracy: 0.5153
Epoch 70/100
72/72 [==============================] - 20s 272ms/step - loss: 0.7104 - accuracy: 0.5136
Epoch 71/100
72/72 [==============================] - 20s 272ms/step - loss: 0.7179 - accuracy: 0.5079
Epoch 72/100
72/72 [==============================] - 20s 273ms/step - loss: 0.7276 - accuracy: 0.5144
Epoch 73/100
72/72 [==============================] - 20s 271ms/step - loss: 0.7355 - accuracy: 0.5131
Epoch 74/100
72/72 [==============================] - 20s 271ms/step - loss: 0.7578 - accuracy: 0.5061
Epoch 75/100
72/72 [==============================] - 20s 275ms/step - loss: 0.7719 - accuracy: 0.5168
Epoch 76/100
72/72 [==============================] - 20s 273ms/step - loss: 0.8077 - accuracy: 0.5028
Epoch 77/100
72/72 [==============================] - 20s 271ms/step - loss: 0.8474 - accuracy: 0.4932
Epoch 78/100
72/72 [==============================] - 20s 272ms/step - loss: 0.8713 - accuracy: 0.4967
Epoch 79/100
72/72 [==============================] - 20s 272ms/step - loss: 0.9173 - accuracy: 0.4967
Epoch 80/100
72/72 [==============================] - 20s 272ms/step - loss: 0.8814 - accuracy: 0.5013
Epoch 81/100
72/72 [==============================] - 20s 272ms/step - loss: 0.8125 - accuracy: 0.5024
Epoch 82/100
72/72 [==============================] - 20s 272ms/step - loss: 0.7698 - accuracy: 0.5009
Epoch 83/100
72/72 [==============================] - 20s 273ms/step - loss: 0.7215 - accuracy: 0.5074
Epoch 84/100
72/72 [==============================] - 20s 272ms/step - loss: 0.7084 - accuracy: 0.4985
Epoch 85/100
72/72 [==============================] - 20s 274ms/step - loss: 0.7034 - accuracy: 0.4937
Epoch 86/100
72/72 [==============================] - 20s 274ms/step - loss: 0.7030 - accuracy: 0.5079
Epoch 87/100
72/72 [==============================] - 20s 273ms/step - loss: 0.7125 - accuracy: 0.5098
Epoch 88/100
72/72 [==============================] - 20s 272ms/step - loss: 0.7313 - accuracy: 0.5074
Epoch 89/100
72/72 [==============================] - 19s 271ms/step - loss: 0.8058 - accuracy: 0.4919
Epoch 90/100
72/72 [==============================] - 20s 274ms/step - loss: 1.6105 - accuracy: 0.5125
Epoch 91/100
16/72 [=====>........................] - ETA: 15s - loss: 5.8092 - accuracy: 0.5146
%% Cell type:code id: tags:
``` python
len(trainY[0])
```
%% Output
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-81-db40db286bba> in <module>
----> 1 len(trainY[0])
NameError: name 'trainY' is not defined
%% Cell type:code id: tags:
``` python
lrf.plot_loss()
plt.savefig(LRFIND_PLOT_PATH)
print("Loss Rate finder complete")
```
%% Output
Loss Rate finder complete
%% Cell type:code id: tags:
``` python
from IPython.display import Image
learningRateGraph = Image(filename=LRFIND_PLOT_PATH)
learningRateGraph
```
%% Output
<IPython.core.display.Image object>
%% Cell type:code id: tags:
``` python
bestIters=[]
```
%% Cell type:code id: tags:
``` python
# define the initial learning rate, batch size, and number of epochs
INIT_LR = 1e-5
BATCH_SIZE = 64
NUM_EPOCHS = 800
```
%% Cell type:code id: tags:
``` python
!pwd
```
%% Output
/userdata/kerasData
%% Cell type:markdown id: tags:
### Start of Training
%% Cell type:code id: tags:
``` python
test = tf.keras.models.load_model("/userdata/kerasData/fire_detection.model")
```
%% Cell type:code id: tags:
``` python
aug = ImageDataGenerator(
rotation_range=30,
zoom_range=0.15,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.15,
horizontal_flip=True,
fill_mode="nearest")
```
%% Cell type:code id: tags:
``` python
# callback = tf.keras.callbacks.EarlyStopping(monitor='val_loss', patience=3)
mc = tf.keras.callbacks.ModelCheckpoint('best_model.h5', monitor='val_loss', mode='auto', save_freq='epoch', verbose=1)
early_stopping_callback = tf.keras.callbacks.EarlyStopping(monitor='val_loss', patience=200)
```
%% Cell type:code id: tags:
``` python
type(test)
```
%% Output
tensorflow.python.keras.saving.saved_model.load.Sequential
%% Cell type:code id: tags:
``` python
H = test.fit_generator(
aug.flow(Xtrain, Ytrain, batch_size=BATCH_SIZE),
validation_data=(Xvalidation, Yvalidation),
steps_per_epoch=Xtrain.shape[0] // BATCH_SIZE,
epochs=500,
class_weight=classWeight,
callbacks=[mc, early_stopping_callback],
verbose=1)
```
%% Output
Epoch 1/500
70/71 [============================>.] - ETA: 0s - loss: 0.9049 - accuracy: 0.4964
Epoch 00001: saving model to best_model.h5
71/71 [==============================] - 22s 307ms/step - loss: 0.9018 - accuracy: 0.4976 - val_loss: 0.7018 - val_accuracy: 0.5528
Epoch 2/500
70/71 [============================>.] - ETA: 0s - loss: 0.7397 - accuracy: 0.5002
Epoch 00002: saving model to best_model.h5
71/71 [==============================] - 20s 286ms/step - loss: 0.7390 - accuracy: 0.5011 - val_loss: 0.6877 - val_accuracy: 0.5330
Epoch 3/500
70/71 [============================>.] - ETA: 0s - loss: 0.7463 - accuracy: 0.5083
Epoch 00003: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.7472 - accuracy: 0.5075 - val_loss: 0.7107 - val_accuracy: 0.4867
Epoch 4/500
70/71 [============================>.] - ETA: 0s - loss: 0.7436 - accuracy: 0.5067
Epoch 00004: saving model to best_model.h5
71/71 [==============================] - 20s 285ms/step - loss: 0.7434 - accuracy: 0.5067 - val_loss: 0.7039 - val_accuracy: 0.5056
Epoch 5/500
70/71 [============================>.] - ETA: 0s - loss: 0.7471 - accuracy: 0.4856
Epoch 00005: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.7485 - accuracy: 0.4849 - val_loss: 0.7203 - val_accuracy: 0.4524
Epoch 6/500
70/71 [============================>.] - ETA: 0s - loss: 0.7458 - accuracy: 0.5047
Epoch 00006: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7470 - accuracy: 0.5035 - val_loss: 0.6981 - val_accuracy: 0.5270
Epoch 7/500
70/71 [============================>.] - ETA: 0s - loss: 0.7366 - accuracy: 0.4942
Epoch 00007: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.7377 - accuracy: 0.4933 - val_loss: 0.6966 - val_accuracy: 0.5124
Epoch 8/500
70/71 [============================>.] - ETA: 0s - loss: 0.7343 - accuracy: 0.5081
Epoch 00008: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7341 - accuracy: 0.5084 - val_loss: 0.6990 - val_accuracy: 0.5099
Epoch 9/500
70/71 [============================>.] - ETA: 0s - loss: 0.7317 - accuracy: 0.5148
Epoch 00009: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7315 - accuracy: 0.5153 - val_loss: 0.7031 - val_accuracy: 0.5107
Epoch 10/500
70/71 [============================>.] - ETA: 0s - loss: 0.7402 - accuracy: 0.4993
Epoch 00010: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7399 - accuracy: 0.5000 - val_loss: 0.7199 - val_accuracy: 0.4927
Epoch 11/500
70/71 [============================>.] - ETA: 0s - loss: 0.7326 - accuracy: 0.4917
Epoch 00011: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.7332 - accuracy: 0.4907 - val_loss: 0.7054 - val_accuracy: 0.5039
Epoch 12/500
70/71 [============================>.] - ETA: 0s - loss: 0.7267 - accuracy: 0.5045
Epoch 00012: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.7273 - accuracy: 0.5033 - val_loss: 0.6907 - val_accuracy: 0.5356
Epoch 13/500
70/71 [============================>.] - ETA: 0s - loss: 0.7269 - accuracy: 0.5067
Epoch 00013: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.7269 - accuracy: 0.5062 - val_loss: 0.6981 - val_accuracy: 0.5030
Epoch 14/500
70/71 [============================>.] - ETA: 0s - loss: 0.7247 - accuracy: 0.5145
Epoch 00014: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.7251 - accuracy: 0.5139 - val_loss: 0.6959 - val_accuracy: 0.5116
Epoch 15/500
70/71 [============================>.] - ETA: 0s - loss: 0.7291 - accuracy: 0.4964
Epoch 00015: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7292 - accuracy: 0.4971 - val_loss: 0.7001 - val_accuracy: 0.5210
Epoch 16/500
70/71 [============================>.] - ETA: 0s - loss: 0.7299 - accuracy: 0.5144
Epoch 00016: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7300 - accuracy: 0.5137 - val_loss: 0.7094 - val_accuracy: 0.4712
Epoch 17/500
70/71 [============================>.] - ETA: 0s - loss: 0.7293 - accuracy: 0.4964
Epoch 00017: saving model to best_model.h5
71/71 [==============================] - 20s 284ms/step - loss: 0.7296 - accuracy: 0.4967 - val_loss: 0.6890 - val_accuracy: 0.5494
Epoch 18/500
70/71 [============================>.] - ETA: 0s - loss: 0.7291 - accuracy: 0.5073
Epoch 00018: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7286 - accuracy: 0.5074 - val_loss: 0.7020 - val_accuracy: 0.4807
Epoch 19/500
70/71 [============================>.] - ETA: 0s - loss: 0.7190 - accuracy: 0.5193
Epoch 00019: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.7186 - accuracy: 0.5197 - val_loss: 0.7086 - val_accuracy: 0.5056
Epoch 20/500
70/71 [============================>.] - ETA: 0s - loss: 0.7276 - accuracy: 0.5098
Epoch 00020: saving model to best_model.h5
71/71 [==============================] - 20s 286ms/step - loss: 0.7269 - accuracy: 0.5103 - val_loss: 0.6913 - val_accuracy: 0.5056
Epoch 21/500
70/71 [============================>.] - ETA: 0s - loss: 0.7284 - accuracy: 0.4932
Epoch 00021: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.7279 - accuracy: 0.4940 - val_loss: 0.6827 - val_accuracy: 0.5708
Epoch 22/500
70/71 [============================>.] - ETA: 0s - loss: 0.7210 - accuracy: 0.5060
Epoch 00022: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.7212 - accuracy: 0.5055 - val_loss: 0.7139 - val_accuracy: 0.5296
Epoch 23/500
70/71 [============================>.] - ETA: 0s - loss: 0.7271 - accuracy: 0.5056
Epoch 00023: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.7268 - accuracy: 0.5060 - val_loss: 0.7046 - val_accuracy: 0.4635
Epoch 24/500
70/71 [============================>.] - ETA: 0s - loss: 0.7233 - accuracy: 0.5036
Epoch 00024: saving model to best_model.h5
71/71 [==============================] - 20s 275ms/step - loss: 0.7228 - accuracy: 0.5036 - val_loss: 0.6964 - val_accuracy: 0.5519
Epoch 25/500
70/71 [============================>.] - ETA: 0s - loss: 0.7148 - accuracy: 0.5200
Epoch 00025: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7145 - accuracy: 0.5200 - val_loss: 0.6938 - val_accuracy: 0.5605
Epoch 26/500
70/71 [============================>.] - ETA: 0s - loss: 0.7154 - accuracy: 0.5205
Epoch 00026: saving model to best_model.h5
71/71 [==============================] - 20s 286ms/step - loss: 0.7149 - accuracy: 0.5224 - val_loss: 0.6897 - val_accuracy: 0.5468
Epoch 27/500
70/71 [============================>.] - ETA: 0s - loss: 0.7211 - accuracy: 0.5079
Epoch 00027: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7212 - accuracy: 0.5082 - val_loss: 0.6863 - val_accuracy: 0.5373
Epoch 28/500
70/71 [============================>.] - ETA: 0s - loss: 0.7172 - accuracy: 0.5067
Epoch 00028: saving model to best_model.h5
71/71 [==============================] - 20s 284ms/step - loss: 0.7171 - accuracy: 0.5066 - val_loss: 0.6926 - val_accuracy: 0.5073
Epoch 29/500
70/71 [============================>.] - ETA: 0s - loss: 0.7193 - accuracy: 0.5025
Epoch 00029: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7194 - accuracy: 0.5022 - val_loss: 0.7015 - val_accuracy: 0.4798
Epoch 30/500
70/71 [============================>.] - ETA: 0s - loss: 0.7152 - accuracy: 0.5211
Epoch 00030: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7153 - accuracy: 0.5217 - val_loss: 0.7053 - val_accuracy: 0.4773
Epoch 31/500
70/71 [============================>.] - ETA: 0s - loss: 0.7154 - accuracy: 0.5171
Epoch 00031: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.7151 - accuracy: 0.5177 - val_loss: 0.6944 - val_accuracy: 0.4927
Epoch 32/500
70/71 [============================>.] - ETA: 0s - loss: 0.7130 - accuracy: 0.5163
Epoch 00032: saving model to best_model.h5
71/71 [==============================] - 20s 284ms/step - loss: 0.7135 - accuracy: 0.5152 - val_loss: 0.6944 - val_accuracy: 0.5554
Epoch 33/500
70/71 [============================>.] - ETA: 0s - loss: 0.7181 - accuracy: 0.4917
Epoch 00033: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.7184 - accuracy: 0.4916 - val_loss: 0.6850 - val_accuracy: 0.5408
Epoch 34/500
70/71 [============================>.] - ETA: 0s - loss: 0.7151 - accuracy: 0.5040
Epoch 00034: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.7145 - accuracy: 0.5058 - val_loss: 0.7050 - val_accuracy: 0.4755
Epoch 35/500
70/71 [============================>.] - ETA: 0s - loss: 0.7131 - accuracy: 0.5086
Epoch 00035: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.7128 - accuracy: 0.5092 - val_loss: 0.6922 - val_accuracy: 0.5030
Epoch 36/500
70/71 [============================>.] - ETA: 0s - loss: 0.7140 - accuracy: 0.5107
Epoch 00036: saving model to best_model.h5
71/71 [==============================] - 21s 298ms/step - loss: 0.7137 - accuracy: 0.5108 - val_loss: 0.6946 - val_accuracy: 0.5245
Epoch 37/500
70/71 [============================>.] - ETA: 0s - loss: 0.7140 - accuracy: 0.5259
Epoch 00037: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7137 - accuracy: 0.5264 - val_loss: 0.6917 - val_accuracy: 0.5262
Epoch 38/500
70/71 [============================>.] - ETA: 0s - loss: 0.7075 - accuracy: 0.5202
Epoch 00038: saving model to best_model.h5
71/71 [==============================] - 19s 274ms/step - loss: 0.7080 - accuracy: 0.5192 - val_loss: 0.7040 - val_accuracy: 0.4661
Epoch 39/500
70/71 [============================>.] - ETA: 0s - loss: 0.7138 - accuracy: 0.5085
Epoch 00039: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.7142 - accuracy: 0.5090 - val_loss: 0.6962 - val_accuracy: 0.4970
Epoch 40/500
70/71 [============================>.] - ETA: 0s - loss: 0.7138 - accuracy: 0.5128
Epoch 00040: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.7138 - accuracy: 0.5126 - val_loss: 0.6979 - val_accuracy: 0.5107
Epoch 41/500
70/71 [============================>.] - ETA: 0s - loss: 0.7044 - accuracy: 0.5308
Epoch 00041: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.7050 - accuracy: 0.5310 - val_loss: 0.6855 - val_accuracy: 0.5339
Epoch 42/500
70/71 [============================>.] - ETA: 0s - loss: 0.7152 - accuracy: 0.5014
Epoch 00042: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.7151 - accuracy: 0.5022 - val_loss: 0.7080 - val_accuracy: 0.4172
Epoch 43/500
70/71 [============================>.] - ETA: 0s - loss: 0.7088 - accuracy: 0.5187
Epoch 00043: saving model to best_model.h5
71/71 [==============================] - 20s 284ms/step - loss: 0.7094 - accuracy: 0.5191 - val_loss: 0.7010 - val_accuracy: 0.5348
Epoch 44/500
70/71 [============================>.] - ETA: 0s - loss: 0.7049 - accuracy: 0.5219
Epoch 00044: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7050 - accuracy: 0.5222 - val_loss: 0.7347 - val_accuracy: 0.5030
Epoch 45/500
70/71 [============================>.] - ETA: 0s - loss: 0.7079 - accuracy: 0.5259
Epoch 00045: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.7080 - accuracy: 0.5259 - val_loss: 0.7011 - val_accuracy: 0.5004
Epoch 46/500
70/71 [============================>.] - ETA: 0s - loss: 0.7090 - accuracy: 0.5274
Epoch 00046: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.7089 - accuracy: 0.5264 - val_loss: 0.6948 - val_accuracy: 0.5064
Epoch 47/500
70/71 [============================>.] - ETA: 0s - loss: 0.6983 - accuracy: 0.5382
Epoch 00047: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6990 - accuracy: 0.5373 - val_loss: 0.7067 - val_accuracy: 0.5210
Epoch 48/500
70/71 [============================>.] - ETA: 0s - loss: 0.6936 - accuracy: 0.5423
Epoch 00048: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6935 - accuracy: 0.5421 - val_loss: 0.7464 - val_accuracy: 0.5305
Epoch 49/500
70/71 [============================>.] - ETA: 0s - loss: 0.7017 - accuracy: 0.5353
Epoch 00049: saving model to best_model.h5
71/71 [==============================] - 20s 286ms/step - loss: 0.7014 - accuracy: 0.5350 - val_loss: 0.7303 - val_accuracy: 0.5416
Epoch 50/500
70/71 [============================>.] - ETA: 0s - loss: 0.6965 - accuracy: 0.5331
Epoch 00050: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6968 - accuracy: 0.5333 - val_loss: 0.7006 - val_accuracy: 0.5545
Epoch 51/500
70/71 [============================>.] - ETA: 0s - loss: 0.6933 - accuracy: 0.5583
Epoch 00051: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6942 - accuracy: 0.5572 - val_loss: 0.7248 - val_accuracy: 0.4515
Epoch 52/500
70/71 [============================>.] - ETA: 0s - loss: 0.6979 - accuracy: 0.5339
Epoch 00052: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6980 - accuracy: 0.5337 - val_loss: 0.6918 - val_accuracy: 0.5176
Epoch 53/500
70/71 [============================>.] - ETA: 0s - loss: 0.6912 - accuracy: 0.5475
Epoch 00053: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6913 - accuracy: 0.5481 - val_loss: 0.7392 - val_accuracy: 0.5082
Epoch 54/500
70/71 [============================>.] - ETA: 0s - loss: 0.6928 - accuracy: 0.5495
Epoch 00054: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6933 - accuracy: 0.5490 - val_loss: 0.6895 - val_accuracy: 0.6052
Epoch 55/500
70/71 [============================>.] - ETA: 0s - loss: 0.6930 - accuracy: 0.5449
Epoch 00055: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6929 - accuracy: 0.5454 - val_loss: 0.6841 - val_accuracy: 0.5717
Epoch 56/500
70/71 [============================>.] - ETA: 0s - loss: 0.6883 - accuracy: 0.5629
Epoch 00056: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6877 - accuracy: 0.5638 - val_loss: 0.7488 - val_accuracy: 0.5356
Epoch 57/500
70/71 [============================>.] - ETA: 0s - loss: 0.6849 - accuracy: 0.5549
Epoch 00057: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6850 - accuracy: 0.5541 - val_loss: 0.7146 - val_accuracy: 0.5210
Epoch 58/500
70/71 [============================>.] - ETA: 0s - loss: 0.6855 - accuracy: 0.5616
Epoch 00058: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6866 - accuracy: 0.5610 - val_loss: 0.7558 - val_accuracy: 0.5236
Epoch 59/500
70/71 [============================>.] - ETA: 0s - loss: 0.6891 - accuracy: 0.5504
Epoch 00059: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6894 - accuracy: 0.5497 - val_loss: 0.7100 - val_accuracy: 0.4979
Epoch 60/500
70/71 [============================>.] - ETA: 0s - loss: 0.6830 - accuracy: 0.5616
Epoch 00060: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6832 - accuracy: 0.5619 - val_loss: 0.7235 - val_accuracy: 0.5288
Epoch 61/500
70/71 [============================>.] - ETA: 0s - loss: 0.6820 - accuracy: 0.5556
Epoch 00061: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6822 - accuracy: 0.5565 - val_loss: 0.7268 - val_accuracy: 0.5511
Epoch 62/500
70/71 [============================>.] - ETA: 0s - loss: 0.6820 - accuracy: 0.5646
Epoch 00062: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6812 - accuracy: 0.5661 - val_loss: 0.7622 - val_accuracy: 0.5536
Epoch 63/500
70/71 [============================>.] - ETA: 0s - loss: 0.6800 - accuracy: 0.5711
Epoch 00063: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6798 - accuracy: 0.5714 - val_loss: 0.7287 - val_accuracy: 0.5408
Epoch 64/500
70/71 [============================>.] - ETA: 0s - loss: 0.6743 - accuracy: 0.5753
Epoch 00064: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6733 - accuracy: 0.5763 - val_loss: 0.8551 - val_accuracy: 0.5030
Epoch 65/500
70/71 [============================>.] - ETA: 0s - loss: 0.6777 - accuracy: 0.5758
Epoch 00065: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6771 - accuracy: 0.5765 - val_loss: 0.7220 - val_accuracy: 0.5519
Epoch 66/500
70/71 [============================>.] - ETA: 0s - loss: 0.6682 - accuracy: 0.5834
Epoch 00066: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6679 - accuracy: 0.5838 - val_loss: 0.7122 - val_accuracy: 0.5356
Epoch 67/500
70/71 [============================>.] - ETA: 0s - loss: 0.6766 - accuracy: 0.5711
Epoch 00067: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6761 - accuracy: 0.5721 - val_loss: 0.7637 - val_accuracy: 0.5056
Epoch 68/500
70/71 [============================>.] - ETA: 0s - loss: 0.6715 - accuracy: 0.5756
Epoch 00068: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6712 - accuracy: 0.5754 - val_loss: 0.7585 - val_accuracy: 0.5399
Epoch 69/500
70/71 [============================>.] - ETA: 0s - loss: 0.6758 - accuracy: 0.5657
Epoch 00069: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6763 - accuracy: 0.5645 - val_loss: 0.7701 - val_accuracy: 0.4652
Epoch 70/500
70/71 [============================>.] - ETA: 0s - loss: 0.6768 - accuracy: 0.5688
Epoch 00070: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6761 - accuracy: 0.5694 - val_loss: 0.7385 - val_accuracy: 0.5236
Epoch 71/500
70/71 [============================>.] - ETA: 0s - loss: 0.6720 - accuracy: 0.5902
Epoch 00071: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6724 - accuracy: 0.5885 - val_loss: 0.7473 - val_accuracy: 0.5468
Epoch 72/500
70/71 [============================>.] - ETA: 0s - loss: 0.6691 - accuracy: 0.5697
Epoch 00072: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6681 - accuracy: 0.5707 - val_loss: 0.7721 - val_accuracy: 0.5468
Epoch 73/500
70/71 [============================>.] - ETA: 0s - loss: 0.6676 - accuracy: 0.5922
Epoch 00073: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6662 - accuracy: 0.5929 - val_loss: 0.7905 - val_accuracy: 0.5691
Epoch 74/500
70/71 [============================>.] - ETA: 0s - loss: 0.6662 - accuracy: 0.5882
Epoch 00074: saving model to best_model.h5
71/71 [==============================] - 20s 285ms/step - loss: 0.6653 - accuracy: 0.5891 - val_loss: 0.7583 - val_accuracy: 0.5210
Epoch 75/500
70/71 [============================>.] - ETA: 0s - loss: 0.6681 - accuracy: 0.5804
Epoch 00075: saving model to best_model.h5
71/71 [==============================] - 21s 294ms/step - loss: 0.6679 - accuracy: 0.5807 - val_loss: 0.7354 - val_accuracy: 0.5614
Epoch 76/500
70/71 [============================>.] - ETA: 0s - loss: 0.6611 - accuracy: 0.5825
Epoch 00076: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6611 - accuracy: 0.5834 - val_loss: 0.7537 - val_accuracy: 0.4635
Epoch 77/500
70/71 [============================>.] - ETA: 0s - loss: 0.6629 - accuracy: 0.5922
Epoch 00077: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6626 - accuracy: 0.5918 - val_loss: 0.7933 - val_accuracy: 0.5133
Epoch 78/500
70/71 [============================>.] - ETA: 0s - loss: 0.6547 - accuracy: 0.5994
Epoch 00078: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6545 - accuracy: 0.5998 - val_loss: 0.8105 - val_accuracy: 0.5167
Epoch 79/500
70/71 [============================>.] - ETA: 0s - loss: 0.6564 - accuracy: 0.5951
Epoch 00079: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.6563 - accuracy: 0.5958 - val_loss: 0.8270 - val_accuracy: 0.5502
Epoch 80/500
70/71 [============================>.] - ETA: 0s - loss: 0.6549 - accuracy: 0.6017
Epoch 00080: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6550 - accuracy: 0.6018 - val_loss: 0.7971 - val_accuracy: 0.5210
Epoch 81/500
70/71 [============================>.] - ETA: 0s - loss: 0.6582 - accuracy: 0.5906
Epoch 00081: saving model to best_model.h5
71/71 [==============================] - 20s 285ms/step - loss: 0.6590 - accuracy: 0.5889 - val_loss: 0.7583 - val_accuracy: 0.4953
Epoch 82/500
70/71 [============================>.] - ETA: 0s - loss: 0.6612 - accuracy: 0.5877
Epoch 00082: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6619 - accuracy: 0.5871 - val_loss: 0.7608 - val_accuracy: 0.5210
Epoch 83/500
70/71 [============================>.] - ETA: 0s - loss: 0.6522 - accuracy: 0.6010
Epoch 00083: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6517 - accuracy: 0.6007 - val_loss: 0.7941 - val_accuracy: 0.5227
Epoch 84/500
70/71 [============================>.] - ETA: 0s - loss: 0.6515 - accuracy: 0.6032
Epoch 00084: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6510 - accuracy: 0.6033 - val_loss: 0.7679 - val_accuracy: 0.5107
Epoch 85/500
70/71 [============================>.] - ETA: 0s - loss: 0.6527 - accuracy: 0.6001
Epoch 00085: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6531 - accuracy: 0.6000 - val_loss: 0.9893 - val_accuracy: 0.5588
Epoch 86/500
70/71 [============================>.] - ETA: 0s - loss: 0.6622 - accuracy: 0.5911
Epoch 00086: saving model to best_model.h5
71/71 [==============================] - 21s 289ms/step - loss: 0.6620 - accuracy: 0.5913 - val_loss: 0.7662 - val_accuracy: 0.5039
Epoch 87/500
70/71 [============================>.] - ETA: 0s - loss: 0.6543 - accuracy: 0.6034
Epoch 00087: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.6540 - accuracy: 0.6039 - val_loss: 0.8634 - val_accuracy: 0.5193
Epoch 88/500
70/71 [============================>.] - ETA: 0s - loss: 0.6541 - accuracy: 0.5994
Epoch 00088: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6544 - accuracy: 0.5996 - val_loss: 0.8192 - val_accuracy: 0.4987
Epoch 89/500
70/71 [============================>.] - ETA: 0s - loss: 0.6486 - accuracy: 0.6059
Epoch 00089: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6482 - accuracy: 0.6062 - val_loss: 0.7929 - val_accuracy: 0.5528
Epoch 90/500
70/71 [============================>.] - ETA: 0s - loss: 0.6480 - accuracy: 0.6073
Epoch 00090: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6492 - accuracy: 0.6069 - val_loss: 0.7754 - val_accuracy: 0.5657
Epoch 91/500
70/71 [============================>.] - ETA: 0s - loss: 0.6444 - accuracy: 0.6131
Epoch 00091: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6448 - accuracy: 0.6122 - val_loss: 0.9606 - val_accuracy: 0.5064
Epoch 92/500
70/71 [============================>.] - ETA: 0s - loss: 0.6452 - accuracy: 0.6091
Epoch 00092: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6453 - accuracy: 0.6091 - val_loss: 0.7290 - val_accuracy: 0.4910
Epoch 93/500
70/71 [============================>.] - ETA: 0s - loss: 0.6487 - accuracy: 0.6104
Epoch 00093: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6484 - accuracy: 0.6098 - val_loss: 0.7395 - val_accuracy: 0.5399
Epoch 94/500
70/71 [============================>.] - ETA: 0s - loss: 0.6467 - accuracy: 0.6000
Epoch 00094: saving model to best_model.h5
71/71 [==============================] - 21s 291ms/step - loss: 0.6455 - accuracy: 0.6012 - val_loss: 0.7960 - val_accuracy: 0.4635
Epoch 95/500
70/71 [============================>.] - ETA: 0s - loss: 0.6395 - accuracy: 0.6143
Epoch 00095: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6399 - accuracy: 0.6133 - val_loss: 0.7302 - val_accuracy: 0.5451
Epoch 96/500
70/71 [============================>.] - ETA: 0s - loss: 0.6450 - accuracy: 0.6091
Epoch 00096: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6454 - accuracy: 0.6091 - val_loss: 0.8491 - val_accuracy: 0.5519
Epoch 97/500
70/71 [============================>.] - ETA: 0s - loss: 0.6340 - accuracy: 0.6142
Epoch 00097: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6349 - accuracy: 0.6137 - val_loss: 1.0346 - val_accuracy: 0.5030
Epoch 98/500
70/71 [============================>.] - ETA: 0s - loss: 0.6436 - accuracy: 0.6102
Epoch 00098: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6431 - accuracy: 0.6113 - val_loss: 1.1868 - val_accuracy: 0.4979
Epoch 99/500
70/71 [============================>.] - ETA: 0s - loss: 0.6326 - accuracy: 0.6215
Epoch 00099: saving model to best_model.h5
71/71 [==============================] - 20s 285ms/step - loss: 0.6322 - accuracy: 0.6220 - val_loss: 1.0831 - val_accuracy: 0.5124
Epoch 100/500
70/71 [============================>.] - ETA: 0s - loss: 0.6449 - accuracy: 0.6038
Epoch 00100: saving model to best_model.h5
71/71 [==============================] - 20s 288ms/step - loss: 0.6444 - accuracy: 0.6041 - val_loss: 0.7710 - val_accuracy: 0.5845
Epoch 101/500
70/71 [============================>.] - ETA: 0s - loss: 0.6339 - accuracy: 0.6188
Epoch 00101: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6341 - accuracy: 0.6180 - val_loss: 0.8587 - val_accuracy: 0.5004
Epoch 102/500
70/71 [============================>.] - ETA: 0s - loss: 0.6318 - accuracy: 0.6247
Epoch 00102: saving model to best_model.h5
71/71 [==============================] - 22s 311ms/step - loss: 0.6306 - accuracy: 0.6249 - val_loss: 1.1032 - val_accuracy: 0.4824
Epoch 103/500
70/71 [============================>.] - ETA: 0s - loss: 0.6425 - accuracy: 0.6138
Epoch 00103: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6422 - accuracy: 0.6138 - val_loss: 0.9473 - val_accuracy: 0.4918
Epoch 104/500
70/71 [============================>.] - ETA: 0s - loss: 0.6285 - accuracy: 0.6308
Epoch 00104: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.6278 - accuracy: 0.6320 - val_loss: 0.9692 - val_accuracy: 0.5339
Epoch 105/500
70/71 [============================>.] - ETA: 0s - loss: 0.6139 - accuracy: 0.6440
Epoch 00105: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6143 - accuracy: 0.6437 - val_loss: 0.9732 - val_accuracy: 0.4893
Epoch 106/500
70/71 [============================>.] - ETA: 0s - loss: 0.6280 - accuracy: 0.6240
Epoch 00106: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6284 - accuracy: 0.6235 - val_loss: 1.0815 - val_accuracy: 0.5116
Epoch 107/500
70/71 [============================>.] - ETA: 0s - loss: 0.6303 - accuracy: 0.6300
Epoch 00107: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6297 - accuracy: 0.6310 - val_loss: 0.9040 - val_accuracy: 0.4781
Epoch 108/500
70/71 [============================>.] - ETA: 0s - loss: 0.6253 - accuracy: 0.6262
Epoch 00108: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6252 - accuracy: 0.6268 - val_loss: 0.9259 - val_accuracy: 0.4953
Epoch 109/500
70/71 [============================>.] - ETA: 0s - loss: 0.6202 - accuracy: 0.6413
Epoch 00109: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6206 - accuracy: 0.6412 - val_loss: 1.0740 - val_accuracy: 0.4824
Epoch 110/500
70/71 [============================>.] - ETA: 0s - loss: 0.6207 - accuracy: 0.6328
Epoch 00110: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6209 - accuracy: 0.6323 - val_loss: 0.8322 - val_accuracy: 0.4961
Epoch 111/500
70/71 [============================>.] - ETA: 0s - loss: 0.6135 - accuracy: 0.6426
Epoch 00111: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6139 - accuracy: 0.6421 - val_loss: 0.9185 - val_accuracy: 0.5245
Epoch 112/500
70/71 [============================>.] - ETA: 0s - loss: 0.6242 - accuracy: 0.6365
Epoch 00112: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.6237 - accuracy: 0.6373 - val_loss: 0.7987 - val_accuracy: 0.4378
Epoch 113/500
70/71 [============================>.] - ETA: 0s - loss: 0.6270 - accuracy: 0.6291
Epoch 00113: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.6283 - accuracy: 0.6268 - val_loss: 0.9852 - val_accuracy: 0.4996
Epoch 114/500
70/71 [============================>.] - ETA: 0s - loss: 0.6302 - accuracy: 0.6281
Epoch 00114: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.6300 - accuracy: 0.6294 - val_loss: 1.0164 - val_accuracy: 0.4987
Epoch 115/500
70/71 [============================>.] - ETA: 0s - loss: 0.6154 - accuracy: 0.6339
Epoch 00115: saving model to best_model.h5
71/71 [==============================] - 20s 284ms/step - loss: 0.6151 - accuracy: 0.6331 - val_loss: 1.0716 - val_accuracy: 0.4258
Epoch 116/500
70/71 [============================>.] - ETA: 0s - loss: 0.6219 - accuracy: 0.6386
Epoch 00116: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6217 - accuracy: 0.6384 - val_loss: 1.0561 - val_accuracy: 0.4558
Epoch 117/500
70/71 [============================>.] - ETA: 0s - loss: 0.6141 - accuracy: 0.6453
Epoch 00117: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.6138 - accuracy: 0.6454 - val_loss: 0.7311 - val_accuracy: 0.5485
Epoch 118/500
70/71 [============================>.] - ETA: 0s - loss: 0.6155 - accuracy: 0.6328
Epoch 00118: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.6168 - accuracy: 0.6327 - val_loss: 1.0044 - val_accuracy: 0.4961
Epoch 119/500
70/71 [============================>.] - ETA: 0s - loss: 0.6166 - accuracy: 0.6394
Epoch 00119: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.6151 - accuracy: 0.6405 - val_loss: 0.9369 - val_accuracy: 0.5090
Epoch 120/500
70/71 [============================>.] - ETA: 0s - loss: 0.6082 - accuracy: 0.6511
Epoch 00120: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6088 - accuracy: 0.6503 - val_loss: 0.8189 - val_accuracy: 0.5725
Epoch 121/500
70/71 [============================>.] - ETA: 0s - loss: 0.5980 - accuracy: 0.6613
Epoch 00121: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5979 - accuracy: 0.6619 - val_loss: 0.9468 - val_accuracy: 0.4309
Epoch 122/500
70/71 [============================>.] - ETA: 0s - loss: 0.6124 - accuracy: 0.6433
Epoch 00122: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.6123 - accuracy: 0.6426 - val_loss: 0.7896 - val_accuracy: 0.4815
Epoch 123/500
70/71 [============================>.] - ETA: 0s - loss: 0.6122 - accuracy: 0.6453
Epoch 00123: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.6118 - accuracy: 0.6461 - val_loss: 1.0108 - val_accuracy: 0.4575
Epoch 124/500
70/71 [============================>.] - ETA: 0s - loss: 0.5984 - accuracy: 0.6507
Epoch 00124: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5983 - accuracy: 0.6510 - val_loss: 0.9160 - val_accuracy: 0.5545
Epoch 125/500
70/71 [============================>.] - ETA: 0s - loss: 0.5972 - accuracy: 0.6562
Epoch 00125: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5974 - accuracy: 0.6564 - val_loss: 0.9534 - val_accuracy: 0.4197
Epoch 126/500
70/71 [============================>.] - ETA: 0s - loss: 0.6018 - accuracy: 0.6437
Epoch 00126: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.6021 - accuracy: 0.6443 - val_loss: 1.0389 - val_accuracy: 0.4730
Epoch 127/500
70/71 [============================>.] - ETA: 0s - loss: 0.5956 - accuracy: 0.6585
Epoch 00127: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5947 - accuracy: 0.6589 - val_loss: 1.0275 - val_accuracy: 0.4979
Epoch 128/500
70/71 [============================>.] - ETA: 0s - loss: 0.5915 - accuracy: 0.6615
Epoch 00128: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5922 - accuracy: 0.6610 - val_loss: 1.0177 - val_accuracy: 0.5004
Epoch 129/500
70/71 [============================>.] - ETA: 0s - loss: 0.5872 - accuracy: 0.6653
Epoch 00129: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5874 - accuracy: 0.6656 - val_loss: 1.3468 - val_accuracy: 0.5167
Epoch 130/500
70/71 [============================>.] - ETA: 0s - loss: 0.5998 - accuracy: 0.6673
Epoch 00130: saving model to best_model.h5
71/71 [==============================] - 21s 293ms/step - loss: 0.5986 - accuracy: 0.6681 - val_loss: 1.0924 - val_accuracy: 0.5167
Epoch 131/500
70/71 [============================>.] - ETA: 0s - loss: 0.5924 - accuracy: 0.6660
Epoch 00131: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5921 - accuracy: 0.6654 - val_loss: 1.0798 - val_accuracy: 0.5107
Epoch 132/500
70/71 [============================>.] - ETA: 0s - loss: 0.6046 - accuracy: 0.6597
Epoch 00132: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.6046 - accuracy: 0.6599 - val_loss: 0.9677 - val_accuracy: 0.5124
Epoch 133/500
70/71 [============================>.] - ETA: 0s - loss: 0.5986 - accuracy: 0.6599
Epoch 00133: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5980 - accuracy: 0.6608 - val_loss: 1.1492 - val_accuracy: 0.4094
Epoch 134/500
70/71 [============================>.] - ETA: 0s - loss: 0.5925 - accuracy: 0.6777
Epoch 00134: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5920 - accuracy: 0.6780 - val_loss: 0.8172 - val_accuracy: 0.5837
Epoch 135/500
70/71 [============================>.] - ETA: 0s - loss: 0.5833 - accuracy: 0.6698
Epoch 00135: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5837 - accuracy: 0.6687 - val_loss: 1.1924 - val_accuracy: 0.4918
Epoch 136/500
70/71 [============================>.] - ETA: 0s - loss: 0.5902 - accuracy: 0.6763
Epoch 00136: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5890 - accuracy: 0.6778 - val_loss: 1.0252 - val_accuracy: 0.4609
Epoch 137/500
70/71 [============================>.] - ETA: 0s - loss: 0.5714 - accuracy: 0.6766
Epoch 00137: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5711 - accuracy: 0.6767 - val_loss: 1.1408 - val_accuracy: 0.4918
Epoch 138/500
70/71 [============================>.] - ETA: 0s - loss: 0.5903 - accuracy: 0.6676
Epoch 00138: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.5895 - accuracy: 0.6672 - val_loss: 1.4424 - val_accuracy: 0.5090
Epoch 139/500
70/71 [============================>.] - ETA: 0s - loss: 0.5844 - accuracy: 0.6671
Epoch 00139: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5838 - accuracy: 0.6676 - val_loss: 0.9815 - val_accuracy: 0.5631
Epoch 140/500
70/71 [============================>.] - ETA: 0s - loss: 0.5835 - accuracy: 0.6732
Epoch 00140: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5838 - accuracy: 0.6732 - val_loss: 1.1517 - val_accuracy: 0.5262
Epoch 141/500
70/71 [============================>.] - ETA: 0s - loss: 0.5945 - accuracy: 0.6536
Epoch 00141: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5941 - accuracy: 0.6541 - val_loss: 1.1712 - val_accuracy: 0.5245
Epoch 142/500
70/71 [============================>.] - ETA: 0s - loss: 0.5812 - accuracy: 0.6682
Epoch 00142: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5813 - accuracy: 0.6672 - val_loss: 0.9647 - val_accuracy: 0.5288
Epoch 143/500
70/71 [============================>.] - ETA: 0s - loss: 0.5824 - accuracy: 0.6730
Epoch 00143: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5812 - accuracy: 0.6747 - val_loss: 0.8276 - val_accuracy: 0.5854
Epoch 144/500
70/71 [============================>.] - ETA: 0s - loss: 0.5799 - accuracy: 0.6678
Epoch 00144: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5789 - accuracy: 0.6690 - val_loss: 1.2173 - val_accuracy: 0.4687
Epoch 145/500
70/71 [============================>.] - ETA: 0s - loss: 0.5884 - accuracy: 0.6660
Epoch 00145: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5869 - accuracy: 0.6676 - val_loss: 0.9850 - val_accuracy: 0.4815
Epoch 146/500
70/71 [============================>.] - ETA: 0s - loss: 0.5881 - accuracy: 0.6734
Epoch 00146: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5887 - accuracy: 0.6725 - val_loss: 1.1846 - val_accuracy: 0.4953
Epoch 147/500
70/71 [============================>.] - ETA: 0s - loss: 0.5866 - accuracy: 0.6689
Epoch 00147: saving model to best_model.h5
71/71 [==============================] - 20s 285ms/step - loss: 0.5864 - accuracy: 0.6690 - val_loss: 1.0037 - val_accuracy: 0.4567
Epoch 148/500
70/71 [============================>.] - ETA: 0s - loss: 0.5710 - accuracy: 0.6892
Epoch 00148: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5704 - accuracy: 0.6898 - val_loss: 1.2442 - val_accuracy: 0.4893
Epoch 149/500
70/71 [============================>.] - ETA: 0s - loss: 0.5665 - accuracy: 0.6905
Epoch 00149: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5667 - accuracy: 0.6911 - val_loss: 1.1866 - val_accuracy: 0.4197
Epoch 150/500
70/71 [============================>.] - ETA: 0s - loss: 0.5773 - accuracy: 0.6813
Epoch 00150: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5779 - accuracy: 0.6805 - val_loss: 1.0186 - val_accuracy: 0.5090
Epoch 151/500
70/71 [============================>.] - ETA: 0s - loss: 0.5667 - accuracy: 0.6867
Epoch 00151: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5673 - accuracy: 0.6860 - val_loss: 0.9821 - val_accuracy: 0.5416
Epoch 152/500
70/71 [============================>.] - ETA: 0s - loss: 0.5738 - accuracy: 0.6851
Epoch 00152: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5729 - accuracy: 0.6856 - val_loss: 0.8874 - val_accuracy: 0.4961
Epoch 153/500
70/71 [============================>.] - ETA: 0s - loss: 0.5631 - accuracy: 0.6858
Epoch 00153: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5641 - accuracy: 0.6847 - val_loss: 1.0875 - val_accuracy: 0.4970
Epoch 154/500
70/71 [============================>.] - ETA: 0s - loss: 0.5665 - accuracy: 0.6934
Epoch 00154: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5661 - accuracy: 0.6929 - val_loss: 1.1861 - val_accuracy: 0.5013
Epoch 155/500
70/71 [============================>.] - ETA: 0s - loss: 0.5670 - accuracy: 0.6815
Epoch 00155: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5669 - accuracy: 0.6814 - val_loss: 0.9750 - val_accuracy: 0.5330
Epoch 156/500
70/71 [============================>.] - ETA: 0s - loss: 0.5751 - accuracy: 0.6877
Epoch 00156: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5751 - accuracy: 0.6875 - val_loss: 0.8207 - val_accuracy: 0.5433
Epoch 157/500
70/71 [============================>.] - ETA: 0s - loss: 0.5643 - accuracy: 0.6886
Epoch 00157: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5633 - accuracy: 0.6895 - val_loss: 1.1411 - val_accuracy: 0.4781
Epoch 158/500
70/71 [============================>.] - ETA: 0s - loss: 0.5704 - accuracy: 0.6846
Epoch 00158: saving model to best_model.h5
71/71 [==============================] - 20s 284ms/step - loss: 0.5709 - accuracy: 0.6840 - val_loss: 1.1208 - val_accuracy: 0.5039
Epoch 159/500
70/71 [============================>.] - ETA: 0s - loss: 0.5447 - accuracy: 0.7031
Epoch 00159: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5455 - accuracy: 0.7029 - val_loss: 1.3517 - val_accuracy: 0.4730
Epoch 160/500
70/71 [============================>.] - ETA: 0s - loss: 0.5505 - accuracy: 0.6986
Epoch 00160: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5498 - accuracy: 0.7002 - val_loss: 1.0454 - val_accuracy: 0.4867
Epoch 161/500
70/71 [============================>.] - ETA: 0s - loss: 0.5597 - accuracy: 0.6965
Epoch 00161: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5598 - accuracy: 0.6964 - val_loss: 1.3123 - val_accuracy: 0.4738
Epoch 162/500
70/71 [============================>.] - ETA: 0s - loss: 0.5626 - accuracy: 0.6810
Epoch 00162: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5625 - accuracy: 0.6807 - val_loss: 1.0149 - val_accuracy: 0.5245
Epoch 163/500
70/71 [============================>.] - ETA: 0s - loss: 0.5485 - accuracy: 0.7031
Epoch 00163: saving model to best_model.h5
71/71 [==============================] - 19s 273ms/step - loss: 0.5493 - accuracy: 0.7022 - val_loss: 1.6219 - val_accuracy: 0.4755
Epoch 164/500
70/71 [============================>.] - ETA: 0s - loss: 0.5527 - accuracy: 0.6907
Epoch 00164: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5518 - accuracy: 0.6922 - val_loss: 1.1331 - val_accuracy: 0.5330
Epoch 165/500
70/71 [============================>.] - ETA: 0s - loss: 0.5589 - accuracy: 0.6991
Epoch 00165: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5586 - accuracy: 0.6985 - val_loss: 1.1504 - val_accuracy: 0.5039
Epoch 166/500
70/71 [============================>.] - ETA: 0s - loss: 0.5458 - accuracy: 0.6984
Epoch 00166: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5452 - accuracy: 0.6987 - val_loss: 1.1868 - val_accuracy: 0.4790
Epoch 167/500
70/71 [============================>.] - ETA: 0s - loss: 0.5585 - accuracy: 0.6936
Epoch 00167: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5582 - accuracy: 0.6935 - val_loss: 0.8705 - val_accuracy: 0.5828
Epoch 168/500
70/71 [============================>.] - ETA: 0s - loss: 0.5492 - accuracy: 0.6907
Epoch 00168: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5489 - accuracy: 0.6907 - val_loss: 1.2555 - val_accuracy: 0.4841
Epoch 169/500
70/71 [============================>.] - ETA: 0s - loss: 0.5588 - accuracy: 0.7002
Epoch 00169: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5587 - accuracy: 0.6996 - val_loss: 1.0974 - val_accuracy: 0.5193
Epoch 170/500
70/71 [============================>.] - ETA: 0s - loss: 0.5423 - accuracy: 0.7049
Epoch 00170: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5420 - accuracy: 0.7051 - val_loss: 1.4447 - val_accuracy: 0.4996
Epoch 171/500
70/71 [============================>.] - ETA: 0s - loss: 0.5398 - accuracy: 0.7076
Epoch 00171: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5398 - accuracy: 0.7075 - val_loss: 0.9666 - val_accuracy: 0.4661
Epoch 172/500
70/71 [============================>.] - ETA: 0s - loss: 0.5570 - accuracy: 0.6923
Epoch 00172: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5573 - accuracy: 0.6916 - val_loss: 1.0178 - val_accuracy: 0.5614
Epoch 173/500
70/71 [============================>.] - ETA: 0s - loss: 0.5485 - accuracy: 0.7004
Epoch 00173: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5484 - accuracy: 0.7011 - val_loss: 1.1527 - val_accuracy: 0.5348
Epoch 174/500
70/71 [============================>.] - ETA: 0s - loss: 0.5370 - accuracy: 0.7081
Epoch 00174: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5364 - accuracy: 0.7084 - val_loss: 1.1526 - val_accuracy: 0.4979
Epoch 175/500
70/71 [============================>.] - ETA: 0s - loss: 0.5472 - accuracy: 0.7025
Epoch 00175: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5467 - accuracy: 0.7040 - val_loss: 1.5305 - val_accuracy: 0.5107
Epoch 176/500
70/71 [============================>.] - ETA: 0s - loss: 0.5412 - accuracy: 0.7081
Epoch 00176: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5415 - accuracy: 0.7069 - val_loss: 1.1317 - val_accuracy: 0.5313
Epoch 177/500
70/71 [============================>.] - ETA: 0s - loss: 0.5277 - accuracy: 0.7087
Epoch 00177: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5288 - accuracy: 0.7075 - val_loss: 1.2547 - val_accuracy: 0.5262
Epoch 178/500
70/71 [============================>.] - ETA: 0s - loss: 0.5490 - accuracy: 0.7006
Epoch 00178: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5500 - accuracy: 0.7000 - val_loss: 1.0554 - val_accuracy: 0.5828
Epoch 179/500
70/71 [============================>.] - ETA: 0s - loss: 0.5325 - accuracy: 0.7189
Epoch 00179: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5324 - accuracy: 0.7187 - val_loss: 1.2799 - val_accuracy: 0.4644
Epoch 180/500
70/71 [============================>.] - ETA: 0s - loss: 0.5378 - accuracy: 0.7203
Epoch 00180: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5373 - accuracy: 0.7203 - val_loss: 1.2015 - val_accuracy: 0.4524
Epoch 181/500
70/71 [============================>.] - ETA: 0s - loss: 0.5431 - accuracy: 0.7090
Epoch 00181: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5422 - accuracy: 0.7098 - val_loss: 2.2196 - val_accuracy: 0.5270
Epoch 182/500
70/71 [============================>.] - ETA: 0s - loss: 0.5328 - accuracy: 0.7204
Epoch 00182: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5337 - accuracy: 0.7191 - val_loss: 1.0959 - val_accuracy: 0.4498
Epoch 183/500
70/71 [============================>.] - ETA: 0s - loss: 0.5460 - accuracy: 0.7031
Epoch 00183: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5451 - accuracy: 0.7031 - val_loss: 1.3565 - val_accuracy: 0.5270
Epoch 184/500
70/71 [============================>.] - ETA: 0s - loss: 0.5320 - accuracy: 0.7150
Epoch 00184: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5310 - accuracy: 0.7160 - val_loss: 1.0530 - val_accuracy: 0.4438
Epoch 185/500
70/71 [============================>.] - ETA: 0s - loss: 0.5361 - accuracy: 0.7069
Epoch 00185: saving model to best_model.h5
71/71 [==============================] - 20s 276ms/step - loss: 0.5357 - accuracy: 0.7076 - val_loss: 1.0496 - val_accuracy: 0.4927
Epoch 186/500
70/71 [============================>.] - ETA: 0s - loss: 0.5250 - accuracy: 0.7136
Epoch 00186: saving model to best_model.h5
71/71 [==============================] - 21s 298ms/step - loss: 0.5247 - accuracy: 0.7137 - val_loss: 1.4406 - val_accuracy: 0.5279
Epoch 187/500
70/71 [============================>.] - ETA: 0s - loss: 0.5171 - accuracy: 0.7233
Epoch 00187: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5165 - accuracy: 0.7246 - val_loss: 1.0706 - val_accuracy: 0.5648
Epoch 188/500
70/71 [============================>.] - ETA: 0s - loss: 0.5380 - accuracy: 0.7038
Epoch 00188: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5374 - accuracy: 0.7055 - val_loss: 1.1809 - val_accuracy: 0.4678
Epoch 189/500
70/71 [============================>.] - ETA: 0s - loss: 0.5305 - accuracy: 0.7166
Epoch 00189: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5302 - accuracy: 0.7169 - val_loss: 1.5912 - val_accuracy: 0.4687
Epoch 190/500
70/71 [============================>.] - ETA: 0s - loss: 0.5301 - accuracy: 0.7242
Epoch 00190: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.5295 - accuracy: 0.7253 - val_loss: 1.1200 - val_accuracy: 0.5073
Epoch 191/500
70/71 [============================>.] - ETA: 0s - loss: 0.5410 - accuracy: 0.7074
Epoch 00191: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5402 - accuracy: 0.7075 - val_loss: 1.2133 - val_accuracy: 0.4549
Epoch 192/500
70/71 [============================>.] - ETA: 0s - loss: 0.5197 - accuracy: 0.7274
Epoch 00192: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5200 - accuracy: 0.7268 - val_loss: 1.2712 - val_accuracy: 0.4910
Epoch 193/500
70/71 [============================>.] - ETA: 0s - loss: 0.5430 - accuracy: 0.7045
Epoch 00193: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.5434 - accuracy: 0.7029 - val_loss: 1.1931 - val_accuracy: 0.4824
Epoch 194/500
70/71 [============================>.] - ETA: 0s - loss: 0.5336 - accuracy: 0.7076
Epoch 00194: saving model to best_model.h5
71/71 [==============================] - 20s 275ms/step - loss: 0.5337 - accuracy: 0.7067 - val_loss: 1.3550 - val_accuracy: 0.4953
Epoch 195/500
70/71 [============================>.] - ETA: 0s - loss: 0.5271 - accuracy: 0.7145
Epoch 00195: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5263 - accuracy: 0.7148 - val_loss: 1.2209 - val_accuracy: 0.4944
Epoch 196/500
70/71 [============================>.] - ETA: 0s - loss: 0.5397 - accuracy: 0.7087
Epoch 00196: saving model to best_model.h5
71/71 [==============================] - 20s 275ms/step - loss: 0.5386 - accuracy: 0.7098 - val_loss: 1.2160 - val_accuracy: 0.5373
Epoch 197/500
70/71 [============================>.] - ETA: 0s - loss: 0.5293 - accuracy: 0.7176
Epoch 00197: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5297 - accuracy: 0.7170 - val_loss: 1.5736 - val_accuracy: 0.5021
Epoch 198/500
70/71 [============================>.] - ETA: 0s - loss: 0.5399 - accuracy: 0.7141
Epoch 00198: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5389 - accuracy: 0.7151 - val_loss: 1.0983 - val_accuracy: 0.4858
Epoch 199/500
70/71 [============================>.] - ETA: 0s - loss: 0.5223 - accuracy: 0.7272
Epoch 00199: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.5236 - accuracy: 0.7257 - val_loss: 1.5026 - val_accuracy: 0.4893
Epoch 200/500
70/71 [============================>.] - ETA: 0s - loss: 0.5386 - accuracy: 0.7063
Epoch 00200: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5384 - accuracy: 0.7058 - val_loss: 1.5826 - val_accuracy: 0.5090
Epoch 201/500
70/71 [============================>.] - ETA: 0s - loss: 0.5059 - accuracy: 0.7456
Epoch 00201: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5077 - accuracy: 0.7448 - val_loss: 1.3451 - val_accuracy: 0.4944
Epoch 202/500
70/71 [============================>.] - ETA: 0s - loss: 0.5134 - accuracy: 0.7269
Epoch 00202: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5133 - accuracy: 0.7279 - val_loss: 0.9784 - val_accuracy: 0.5845
Epoch 203/500
70/71 [============================>.] - ETA: 0s - loss: 0.5141 - accuracy: 0.7206
Epoch 00203: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5139 - accuracy: 0.7213 - val_loss: 1.1485 - val_accuracy: 0.4773
Epoch 204/500
70/71 [============================>.] - ETA: 0s - loss: 0.5191 - accuracy: 0.7238
Epoch 00204: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5190 - accuracy: 0.7244 - val_loss: 1.0170 - val_accuracy: 0.4455
Epoch 205/500
70/71 [============================>.] - ETA: 0s - loss: 0.5142 - accuracy: 0.7346
Epoch 00205: saving model to best_model.h5
71/71 [==============================] - 20s 279ms/step - loss: 0.5129 - accuracy: 0.7364 - val_loss: 1.1912 - val_accuracy: 0.4446
Epoch 206/500
70/71 [============================>.] - ETA: 0s - loss: 0.5149 - accuracy: 0.7323
Epoch 00206: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5145 - accuracy: 0.7319 - val_loss: 1.2988 - val_accuracy: 0.5107
Epoch 207/500
70/71 [============================>.] - ETA: 0s - loss: 0.5222 - accuracy: 0.7260
Epoch 00207: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5226 - accuracy: 0.7264 - val_loss: 1.0564 - val_accuracy: 0.4558
Epoch 208/500
70/71 [============================>.] - ETA: 0s - loss: 0.5118 - accuracy: 0.7308
Epoch 00208: saving model to best_model.h5
71/71 [==============================] - 21s 293ms/step - loss: 0.5108 - accuracy: 0.7312 - val_loss: 1.0883 - val_accuracy: 0.5245
Epoch 209/500
70/71 [============================>.] - ETA: 0s - loss: 0.5254 - accuracy: 0.7248
Epoch 00209: saving model to best_model.h5
71/71 [==============================] - 20s 277ms/step - loss: 0.5263 - accuracy: 0.7236 - val_loss: 0.9144 - val_accuracy: 0.4901
Epoch 210/500
70/71 [============================>.] - ETA: 0s - loss: 0.5053 - accuracy: 0.7373
Epoch 00210: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5052 - accuracy: 0.7368 - val_loss: 1.0266 - val_accuracy: 0.5365
Epoch 211/500
70/71 [============================>.] - ETA: 0s - loss: 0.5172 - accuracy: 0.7283
Epoch 00211: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5170 - accuracy: 0.7286 - val_loss: 1.5774 - val_accuracy: 0.5519
Epoch 212/500
70/71 [============================>.] - ETA: 0s - loss: 0.5244 - accuracy: 0.7218
Epoch 00212: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5243 - accuracy: 0.7217 - val_loss: 1.3302 - val_accuracy: 0.4953
Epoch 213/500
70/71 [============================>.] - ETA: 0s - loss: 0.5202 - accuracy: 0.7218
Epoch 00213: saving model to best_model.h5
71/71 [==============================] - 20s 282ms/step - loss: 0.5190 - accuracy: 0.7224 - val_loss: 1.5494 - val_accuracy: 0.4790
Epoch 214/500
70/71 [============================>.] - ETA: 0s - loss: 0.5212 - accuracy: 0.7218
Epoch 00214: saving model to best_model.h5
71/71 [==============================] - 20s 281ms/step - loss: 0.5203 - accuracy: 0.7233 - val_loss: 0.9906 - val_accuracy: 0.4850
Epoch 215/500
70/71 [============================>.] - ETA: 0s - loss: 0.5159 - accuracy: 0.7236
Epoch 00215: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5161 - accuracy: 0.7228 - val_loss: 1.4467 - val_accuracy: 0.4979
Epoch 216/500
70/71 [============================>.] - ETA: 0s - loss: 0.5023 - accuracy: 0.7301
Epoch 00216: saving model to best_model.h5
71/71 [==============================] - 20s 280ms/step - loss: 0.5018 - accuracy: 0.7310 - val_loss: 1.2833 - val_accuracy: 0.4798
Epoch 217/500
70/71 [============================>.] - ETA: 0s - loss: 0.5110 - accuracy: 0.7353
Epoch 00217: saving model to best_model.h5
71/71 [==============================] - 20s 278ms/step - loss: 0.5102 - accuracy: 0.7361 - val_loss: 1.0330 - val_accuracy: 0.4567
Epoch 218/500
70/71 [============================>.] - ETA: 0s - loss: 0.5112 - accuracy: 0.7344
Epoch 00218: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5129 - accuracy: 0.7335 - val_loss: 1.5519 - val_accuracy: 0.5210
Epoch 219/500
70/71 [============================>.] - ETA: 0s - loss: 0.5157 - accuracy: 0.7258
Epoch 00219: saving model to best_model.h5
71/71 [==============================] - 20s 285ms/step - loss: 0.5169 - accuracy: 0.7257 - val_loss: 1.2270 - val_accuracy: 0.5047
Epoch 220/500
70/71 [============================>.] - ETA: 0s - loss: 0.5007 - accuracy: 0.7350
Epoch 00220: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.5013 - accuracy: 0.7344 - val_loss: 1.2868 - val_accuracy: 0.5116
Epoch 221/500
70/71 [============================>.] - ETA: 0s - loss: 0.4956 - accuracy: 0.7434
Epoch 00221: saving model to best_model.h5
71/71 [==============================] - 20s 283ms/step - loss: 0.4942 - accuracy: 0.7439 - val_loss: 1.1584 - val_accuracy: 0.5425
%% Cell type:code id: tags:
``` python
import pickle
```
%% Cell type:code id: tags:
``` python
with open("trainingHistory", "wb") as historyFile:
pickle.dump(H.history, historyFile)
```
%% Cell type:code id: tags:
``` python
history = pickle.load(open('trainingHistory', "rb"))
history
plt.style.use("ggplot")
plt.figure()
# N = np.arange(0, NUM_EPOCHS)
N = np.arange(0, len(history["loss"]))
plt.plot(N, history["loss"], label="train_loss")
plt.plot(N, history["val_loss"], label="val_loss")
plt.plot(N, history["accuracy"], label="train_acc")
plt.plot(N, history["val_accuracy"], label="val_acc")
plt.title("Training Loss and Accuracy")
plt.xlabel("Epoch #")
plt.ylabel("Loss/Accuracy")
plt.legend(loc="lower left")
plt.savefig("historyGraph.png")
```
%% Cell type:code id: tags:
``` python
from IPython.display import Image
Image("historyGraph.png")
```
%% Output
<IPython.core.display.Image object>
%% Cell type:code id: tags:
``` python
# evaluate the network and show a classification report
model = FireDetectionNet.build(width=128, height=128, depth=3,
classes=2)
model.load_weights("best_model.h5")
print("[INFO] evaluating network...")
predictions = model.predict(Xtest, batch_size=BATCH_SIZE)
print(classification_report(Ytest.argmax(axis=1),
predictions.argmax(axis=1), target_names=CLASSES))
# serialize the model to disk
# print("[INFO] serializing network to '{}'...".format(MODEL_PATH))
# model.save(MODEL_PATH)
# construct a plot that plots and saves the training history
N = np.arange(0, 221)
plt.style.use("ggplot")
plt.figure()
plt.plot(N, H.history["loss"], label="train_loss")
plt.plot(N, H.history["val_loss"], label="val_loss")
plt.plot(N, H.history["accuracy"], label="train_acc")
plt.plot(N, H.history["val_accuracy"], label="val_acc")
plt.title("Training Loss and Accuracy")
plt.xlabel("Epoch #")
plt.ylabel("Loss/Accuracy")
plt.legend(loc="lower left")
plt.savefig(TRAINING_PLOT_PATH)
```
%% Output
[INFO] evaluating network...
precision recall f1-score support
Non-Fire 0.52 0.85 0.64 739
Fire 0.57 0.20 0.30 740
accuracy 0.53 1479
macro avg 0.54 0.53 0.47 1479
weighted avg 0.54 0.53 0.47 1479
%% Cell type:code id: tags:
``` python
!ls
```
%% Cell type:code id: tags:
``` python
import random
from PIL import Image
firePaths = list(paths.list_images(FIRE_PATH))
nonFirePaths = list(paths.list_images(NON_FIRE_PATH))
imagePaths = firePaths + nonFirePaths
imagePath = random.sample(imagePaths, 1)[0]
img = cv2.resize(cv2.imread(imagePath), (128,128))
img = img.astype("float32")/255
print(np.argmax(model.predict(np.expand_dims(img, axis=0))[0]), imagePath.split(":")[1][:-4])
Image.fromarray(cv2.imread(imagePath), "RGB")
```
%% Cell type:code id: tags:
``` python
import random
from PIL import Image
firePaths = list(paths.list_images("20180611fallbrookrmwmobocAFTER"))
nonFirePaths = list(paths.list_images("20180611fallbrookrmwmobocBEFORE"))
imagePaths = firePaths + nonFirePaths
MaxnumberofImg = len(imagePaths)
numberofImg = 0
for imagePath in imagePaths:
img = cv2.resize(cv2.imread(imagePaths[numberofImg]), (128,128))
img = img.astype("float32")/255
print(np.argmax(model.predict(np.expand_dims(img, axis=0))[0]), imagePaths[numberofImg].split(":")[1][:-4])
Image.fromarray(cv2.imread(imagePath), "RGB")
```
%% Cell type:code id: tags:
``` python
model.load_weights("best_model.h5")
```
%% Cell type:code id: tags:
``` python
# model.evaluate(testX,testY)
testX
```
%% Cell type:markdown id: tags:
### Transfer to TF.LITE
%% Cell type:code id: tags:
``` python
from tensorflow import lite
```
%% Cell type:code id: tags:
``` python
converter = lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
```
%% Cell type:code id: tags:
``` python
open("wildfiretflite_model.tflite", "wb").write(tflite_model)
```
%% Output
8501404
%% Cell type:code id: tags:
``` python
```
FROM tensorflow/tensorflow:2.0.0a0-gpu-py3
RUN apt-get update
RUN apt-get install nano
RUN pip install --upgrade pip
RUN pip install numpy scipy scikit-learn pillow h5py keras
RUN pip install --upgrade imutils
RUN pip install --upgrade scikit-learn
RUN pip install --upgrade matplotlib
RUN pip install -q tensorflow==2.0.0-beta1
RUN apt-get install locate
\ No newline at end of file
ARG cuda_version=10.1
ARG cudnn_version=7
FROM nvidia/cuda:${cuda_version}-cudnn${cudnn_version}-devel
ENV NB_USER kerasTester
ENV NB_UID 1000
# RUN mkdir /userdata/kerasData
RUN apt-get update && \
apt-get -y install sudo
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
# chown $NB_USER $CONDA_DIR -R && \
# chown $NB_USER /userdata/kerasData -R && \
# chown $NB_USER / -R && \
# mkdir -p / && \
sh -c 'echo "$NB_USER:test" | chpasswd' && \
usermod -aG sudo $NB_USER
WORKDIR /userdata/kerasData
# Install system packages
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
bzip2 \
g++ \
git \
graphviz \
libgl1-mesa-glx \
libhdf5-dev \
openmpi-bin \
xvfb \
screen \
wget && \
rm -rf /var/lib/apt/lists/*
# Install conda
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.7.12.1-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc
# Install Python packages and keras
ARG python_version=3.6
RUN conda config --append channels conda-forge
RUN conda install -y python=${python_version} && \
pip install --upgrade pip && \
pip install \
sklearn_pandas \
opencv-python && \
conda install \
bcolz \
h5py \
statsmodels \
matplotlib \
mkl \
nose \
notebook \
Pillow \
pandas \
pydot \
pyyaml \
scikit-learn \
tensorflow-gpu \
six \
theano \
mkdocs \
numpy
RUN pip install keras
# RUN git clone git://github.com/keras-team/keras.git /src && pip install -e /src[tests]
RUN conda clean -yt
# pip install git+git://github.com/keras-team/keras.git && \
USER $NB_USER
#ADD theanorc /home/keras/.theanorc
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PYTHONPATH='/src/:$PYTHONPATH'
%% Cell type:code id: tags:
``` python
from numpy import loadtxt
from keras.models import load_model
import tensorflow as tf
from keras import backend as K
```
%% Cell type:code id: tags:
``` python
!pwd
```
%% Output
/userdata/kerasData
%% Cell type:code id: tags:
``` python
def f1(y_true, y_pred):
def recall(y_true, y_pred):
"""Recall metric.
Only computes a batch-wise average of recall.
Computes the recall, a metric for multi-label classification of
how many relevant items are selected.
"""
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall
def precision(y_true, y_pred):
"""Precision metric.
Only computes a batch-wise average of precision.
Computes the precision, a metric for multi-label classification of
how many selected items are relevant.
"""
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision
precision = precision(y_true, y_pred)
recall = recall(y_true, y_pred)
return 2*((precision*recall)/(precision+recall+K.epsilon()))
```
%% Cell type:code id: tags:
``` python
INIT_LR = 1e-4
batch_size = 16
NUM_EPOCHS = 200
image_size=(128, 128)
class_mode="binary"
image_generator = tf.keras.preprocessing.image.ImageDataGenerator()
TestGenerator = image_generator.flow_from_directory(
"/userdata/kerasData/preloaded/flowDirectory/validation",
target_size=image_size,
batch_size=batch_size,
seed=1000,
class_mode=class_mode)
```
%% Output
Found 2781 images belonging to 2 classes.
%% Cell type:code id: tags:
``` python
model_128 = load_model("/userdata/kerasData/output/model/best_model128_128_e-4.h5", custom_objects={"f1":f1})
model_128.summary()
```
%% Output
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
separable_conv2d (SeparableC (None, 128, 128, 16) 211
_________________________________________________________________
activation (Activation) (None, 128, 128, 16) 0
_________________________________________________________________
batch_normalization (BatchNo (None, 128, 128, 16) 64
_________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 64, 64, 16) 0
_________________________________________________________________
separable_conv2d_1 (Separabl (None, 64, 64, 32) 688
_________________________________________________________________
activation_1 (Activation) (None, 64, 64, 32) 0
_________________________________________________________________
batch_normalization_1 (Batch (None, 64, 64, 32) 128
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 32, 32, 32) 0
_________________________________________________________________
separable_conv2d_2 (Separabl (None, 32, 32, 64) 2400
_________________________________________________________________
activation_2 (Activation) (None, 32, 32, 64) 0
_________________________________________________________________
batch_normalization_2 (Batch (None, 32, 32, 64) 256
_________________________________________________________________
separable_conv2d_3 (Separabl (None, 32, 32, 64) 4736
_________________________________________________________________
activation_3 (Activation) (None, 32, 32, 64) 0
_________________________________________________________________
batch_normalization_3 (Batch (None, 32, 32, 64) 256
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 16, 16, 64) 0
_________________________________________________________________
flatten (Flatten) (None, 16384) 0
_________________________________________________________________
dense (Dense) (None, 128) 2097280
_________________________________________________________________
activation_4 (Activation) (None, 128) 0
_________________________________________________________________
batch_normalization_4 (Batch (None, 128) 512
_________________________________________________________________
dropout (Dropout) (None, 128) 0
_________________________________________________________________
dense_1 (Dense) (None, 128) 16512
_________________________________________________________________
activation_5 (Activation) (None, 128) 0
_________________________________________________________________
batch_normalization_5 (Batch (None, 128) 512
_________________________________________________________________
dropout_1 (Dropout) (None, 128) 0
_________________________________________________________________
dense_2 (Dense) (None, 1) 129
_________________________________________________________________
activation_6 (Activation) (None, 1) 0
=================================================================
Total params: 2,123,684
Trainable params: 2,122,820
Non-trainable params: 864
_________________________________________________________________
%% Cell type:code id: tags:
``` python
model_128.evaluate(TestGenerator)
```
%% Output
174/174 [==============================] - 419s 2s/step - loss: 0.7333 - accuracy: 0.5045 - f1: 0.6095 - recall: 0.8166 - precision: 0.5016
[0.7332570552825928,
0.5044947862625122,
0.6094719767570496,
0.8166065216064453,
0.5015521049499512]
%% Cell type:code id: tags:
``` python
INIT_LR = 1e-4
batch_size = 16
NUM_EPOCHS = 200
image_size=(2048, 1536)
class_mode="categorical"
model_e5 = load_model('/userdata/kerasData/best_model_e5.h5', custom_objects={"f1":f1})
model_e5.summary()
image_generator = tf.keras.preprocessing.image.ImageDataGenerator()
testGenerator = image_generator.flow_from_directory(
"/userdata/kerasData/preloaded/flowDirectory/test",
target_size=image_size,
seed=1000,
batch_size=batch_size,
class_mode=class_mode)
```
%% Output
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
separable_conv2d (SeparableC (None, 128, 128, 16) 211
_________________________________________________________________
activation (Activation) (None, 128, 128, 16) 0
_________________________________________________________________
batch_normalization (BatchNo (None, 128, 128, 16) 64
_________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 64, 64, 16) 0
_________________________________________________________________
separable_conv2d_1 (Separabl (None, 64, 64, 32) 688
_________________________________________________________________
activation_1 (Activation) (None, 64, 64, 32) 0
_________________________________________________________________
batch_normalization_1 (Batch (None, 64, 64, 32) 128
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 32, 32, 32) 0
_________________________________________________________________
separable_conv2d_2 (Separabl (None, 32, 32, 64) 2400
_________________________________________________________________
activation_2 (Activation) (None, 32, 32, 64) 0
_________________________________________________________________
batch_normalization_2 (Batch (None, 32, 32, 64) 256
_________________________________________________________________
separable_conv2d_3 (Separabl (None, 32, 32, 64) 4736
_________________________________________________________________
activation_3 (Activation) (None, 32, 32, 64) 0
_________________________________________________________________
batch_normalization_3 (Batch (None, 32, 32, 64) 256
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 16, 16, 64) 0
_________________________________________________________________
flatten (Flatten) (None, 16384) 0
_________________________________________________________________
dense (Dense) (None, 128) 2097280
_________________________________________________________________
activation_4 (Activation) (None, 128) 0
_________________________________________________________________
batch_normalization_4 (Batch (None, 128) 512
_________________________________________________________________
dropout (Dropout) (None, 128) 0
_________________________________________________________________
dense_1 (Dense) (None, 128) 16512
_________________________________________________________________
activation_5 (Activation) (None, 128) 0
_________________________________________________________________
batch_normalization_5 (Batch (None, 128) 512
_________________________________________________________________
dropout_1 (Dropout) (None, 128) 0
_________________________________________________________________
dense_2 (Dense) (None, 2) 258
_________________________________________________________________
activation_6 (Activation) (None, 2) 0
=================================================================
Total params: 2,123,813
Trainable params: 2,122,949
Non-trainable params: 864
_________________________________________________________________
Found 3485 images belonging to 2 classes.
%% Cell type:code id: tags:
``` python
image_size=(2048, 1536)
class_mode="categorical"
image_generator = tf.keras.preprocessing.image.ImageDataGenerator()
testGenerator = image_generator.flow_from_directory(
"/userdata/kerasData/preloaded/flowDirectory/test",
target_size=image_size,
seed=1000,
batch_size=batch_size,
class_mode=class_mode)
```
%% Output
Found 3485 images belonging to 2 classes.
%% Cell type:code id: tags:
``` python
model_e5.evaluate(testGenerator)
```
%% Output
---------------------------------------------------------------------------
InvalidArgumentError Traceback (most recent call last)
<ipython-input-8-6de600d60988> in <module>
----> 1 model_e5.evaluate(testGenerator)
/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in _method_wrapper(self, *args, **kwargs)
64 def _method_wrapper(self, *args, **kwargs):
65 if not self._in_multi_worker_mode(): # pylint: disable=protected-access
---> 66 return method(self, *args, **kwargs)
67
68 # Running inside `run_distribute_coordinator` already.
/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in evaluate(self, x, y, batch_size, verbose, sample_weight, steps, callbacks, max_queue_size, workers, use_multiprocessing, return_dict)
1079 step_num=step):
1080 callbacks.on_test_batch_begin(step)
-> 1081 tmp_logs = test_function(iterator)
1082 # Catch OutOfRangeError for Datasets of unknown size.
1083 # This blocks until the batch has finished executing.
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
578 xla_context.Exit()
579 else:
--> 580 result = self._call(*args, **kwds)
581
582 if tracing_count == self._get_tracing_count():
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
642 # Lifting succeeded, so variables are initialized and we can run the
643 # stateless function.
--> 644 return self._stateless_fn(*args, **kwds)
645 else:
646 canon_args, canon_kwds = \
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/function.py in __call__(self, *args, **kwargs)
2418 with self._lock:
2419 graph_function, args, kwargs = self._maybe_define_function(args, kwargs)
-> 2420 return graph_function._filtered_call(args, kwargs) # pylint: disable=protected-access
2421
2422 @property
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/function.py in _filtered_call(self, args, kwargs)
1663 if isinstance(t, (ops.Tensor,
1664 resource_variable_ops.BaseResourceVariable))),
-> 1665 self.captured_inputs)
1666
1667 def _call_flat(self, args, captured_inputs, cancellation_manager=None):
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1744 # No tape is watching; skip to running the function.
1745 return self._build_call_outputs(self._inference_function.call(
-> 1746 ctx, args, cancellation_manager=cancellation_manager))
1747 forward_backward = self._select_forward_and_backward_functions(
1748 args,
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/function.py in call(self, ctx, args, cancellation_manager)
596 inputs=args,
597 attrs=attrs,
--> 598 ctx=ctx)
599 else:
600 outputs = execute.execute_with_cancellation(
/opt/conda/lib/python3.6/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
58 ctx.ensure_initialized()
59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60 inputs, attrs, num_outputs)
61 except core._NotOkStatusException as e:
62 if name is not None:
InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: Incompatible shapes: [16,2] vs. [3072,2]
[[node mul_1 (defined at <ipython-input-2-85a3f15ecf4d>:24) ]]
[[assert_less_equal/Assert/AssertGuard/pivot_f/_13/_39]]
(1) Invalid argument: Incompatible shapes: [16,2] vs. [3072,2]
[[node mul_1 (defined at <ipython-input-2-85a3f15ecf4d>:24) ]]
0 successful operations.
0 derived errors ignored. [Op:__inference_test_function_2377]
Errors may have originated from an input operation.
Input Source operations connected to node mul_1:
sequential/activation_6/Softmax (defined at <ipython-input-8-6de600d60988>:1)
Input Source operations connected to node mul_1:
sequential/activation_6/Softmax (defined at <ipython-input-8-6de600d60988>:1)
Function call stack:
test_function -> test_function
%% Cell type:code id: tags:
``` python
```
Source diff could not be displayed: it is too large. Options to address this: view the blob.
# Keras Container on Nautilus
This project allows for the usage of Keras on a jupter notebook in Nautilus (as an importable package). With this project, we are able to train keras models on the Nautilus cloud.
## Getting Started
These instructions will get you a copy of the project up and running on your namespace.
### Prerequisites
Nautilus namespace
Nvidia GPU
## Components
The project has the following components:
```
- Dockerfile (Dockerfile)
- Continous Integration Yaml (.gitlab-ci.yml)
- An example jupter notebook (ClassificationExample.ipynb)
- Nautilus deployment Yaml (kerasDeloyment.yaml)
```
### Dockerfile
```
This file is used to make the enviroment necessary to run Keras on Jupyter Notebook. Unless
truely needed, please avoid editing this file.
```
### Continous Integration Yaml
```
This file is used to utilize gitlab's continous integration feature. Nautilus uses kaniko instead of docker, which can be changed back into using a docker image by replacing the current .gitlab-ci.yml with the "dockerBased-ci.yml" file.
```
### Jupter notebook
```
This was the notebook I used to train an wildfire classification model. The structure and import commands can be used to utilize keras in
other notebooks. I will go over the specific details below.
```
### Nautilus Deployment Yaml
If you are planning to use this implementation on another Nautilus namespace, this portion of the readme is especially important. Here are the important aspects of this yaml:
1. Changing namespace address <br /> <br />
![Changing the names](screenshots/nautilusDeploymentNamespaceName.PNG) <br />
**Change the name and the namespace entries to the current working namespace and a suitable name**
2. Change the resource requests <br /> <br />
![Change the resource limits and requests](screenshots/nautilusDeploymentResources.PNG) <br />
**Change the numbers to suit the task**
3. Mount volumne <br /><br />
![Mount Volume onto a path if already created. To find out how to create a persistent volumne claim, refer to Nautilus documentation](screenshots/nautilusDeploymentStorage.PNG) <br />
**Very important for crash-resistance. I highly recommend saving all work onto mounted directory**
4. Choose GPU type <br /><br />
![Choose correctly](screenshots/nautilusDeploymentGPUrequest.PNG) <br />
If doing intensive training, choose larger/more expensive GPUs
## Using the Components
### Starting the development and accessing jupyter notebook
1. Go into kerasDeloyment.yaml file
2. Choose the RAW file format <br />
![](screenshots/rawfile.PNG) <br />
3. copy url of RAW file <br />
![](screenshots/rawaddress.PNG) <br />
4. execute yaml file on nautilius namespace <br />
![](screenshots/kubectinit.PNG)
5. exec into nautilus pod <br />
![](screenshots/execinto.PNG)
6. Navigate to /userdata/kerasData and Start Jupyter Notebook <br /><br />
![](screenshots/startjupyter.PNG)<br />
**Note: The port number choice does not matter, as long as there are not other processes running on that port. If a port is already in use, jupyter will automatically assign another port. Make sure to match the port number in the next step** <br /> <br />
![](screenshots/usingotherports.PNG)<br />
_What happens when a wrong port is chosen_ <br />
7. Go to your computer terminal and start port-forward, matching the port in the pod <br />
![](screenshots/portforward.PNG)<br />
8. Go to the localhost address<br />
![](screenshots/localhostaddress.png)<br />
9. Test for keras <br />
- Create a new notebook or use the ClassificationExample.ipynb file
- Run the following tests <br />
![](screenshots/firstBatch.PNG) <br /><br />
<!-- ![](screenshots/secondBatch.PNG)<br /><br /> -->
**_Make sure that the outputs return True or some name._**<br />
**You are now ready to use Keras on a jupyter notebook hosted on Kubernetes**
### Using Keras in Notebook
#### EXTREMELY IMPORTANT!
In order to prevent Keras from assigning too much GPU memory and stalling training efforts later on, run this:
![](screenshots/hickups.PNG) <br />
If you see an error, shutdown the network server and try again <br />
![](screenshots/toolate.PNG)<br/>
If you see nvidia-smi memory allocation at 0/- you have suceeded in reseting the GPU <br />
![](screenshots/nvidiasmireg.PNG)<br />
Please refer to [Keras Documentation](https://keras.io/) for instructions and information on using Keras
I used the notebook for the following:
- Training a CNN on the notebook for reference
- Using a LearningRateFinder to find the optimal learning rate
## Using the Fire-Classification training
1. Write the network using Keras layers <br />
![](screenshots/modelbuild.PNG) <br /> <br />
2. Set the paths <br />
![](screenshots/pathfields.PNG) <br />
The following must be set
- FIRE_PATH = Path of the directory with the fire images
- Non_FIRE_PATH = Path of the directory with images without fire
- MODEL_PATH = Path where the saved model file should go
- LRFIND_PLOT_PATH = Where the learning rate finder graph should go
- TRAINING_PLOT_PATH = Where the training plot graph (loss & accuracy graphs) shoud go
3. Loading Data
- Use the load_dataset() function of the load_data notebook ONLY for HPWREN HWB Database
- Otherwise, change the script so that the following numpy arrays are generated, if you want to use the prebuild loader in the Training notebook
MAKE SURE THESE in load_data.ipynb ![](screenshots/loading_in.PNG)<br /> MATCH THESE in ClassificationExample.ipynb <br /> ![](screenshot/THEOTHEREND.PNG)
- Use the def loadData(pathToFiles) in ClassificationExample.ipynb
4. Image Load Tester
Tests the images to see if the loading worked
5. Model Initialization <br />
![](screenshots/init.png)<br />
- The width, height and depth is the data format. Classes are the number of condiitons in the data. In our case: ["Fire", "Not-Fire"]
- Change the optimization function if you know what you are doing. We are using a starndard SDG
6. Learning Rate Finder <br />
Run to find the place where the Network starts to learn
![](screenshots/lrf.png) <br />
![](screenshots/lrfplot.png) <br />
More information is availbe here [pyimagesearch](https://www.pyimagesearch.com/2019/08/05/keras-learning-rate-finder/)
Finally, fill out the INIT_LR from what you learned from above
![](screenshots/initlr.png)<br />
7. Train <br />
![](screenshots/startTraining.PNG) <br />
8. Get results <br />
![](screenshots/results.PNG) <br />
You will find the accuracy measures in the table. Find the model in fire_detection.model
## TF Versions
- TF 2.0 should be on pip path
- TF1.15 is available in the conda environment tf15
- To start type: conda activate tf15
## Contributors
* **Byungheon Jeong** - [byungheon-jeong](https://gitlab.nautilus.optiputer.net/byungheon-jeong)
* **Spence Chen** - [Spencer](https://gitlab.nautilus.optiputer.net/Spencer123)
* **Isaac Nealey** - [Isacc](https://gitlab.nautilus.optiputer.net/inealey)
* **John Graham** - [John](https://gitlab.nautilus.optiputer.net/jjgraham)
## Acknowledgments
* The Dockerfile is from the Dockerhub of the Keras team
* The Fire CNN and the Learning Rate finder is adapted from Adrain's excellent blog on first-detection - [Pyimagesearch](https://www.pyimagesearch.com/2019/11/18/fire-and-smoke-detection-with-keras-and-deep-learning/)
Source diff could not be displayed: it is too large. Options to address this: view the blob.
image: docker:git
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.nautilus.optiputer.net
stages:
- build-and-push
build-and-push-job:
stage: build-and-push
tags:
- build-as-docker
script:
- docker build --no-cache -t gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} .
- docker tag gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:latest
- docker push gitlab-registry.nautilus.optiputer.net/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
Source diff could not be displayed: it is too large. Options to address this: view the blob.
ls |grep -v ".*-c$"|xargs -I {} rm -rf {}
find /userdata/kerasData/hpwren.ucsd.edu/HWB/HPWREN-FIgLib/ -type f -name ".*.mp4" -print
find $PWD -maxdepth 2|grep ".*html.*"|xargs -I {} rm -rf {}
\ No newline at end of file
File added
#(128,128)
def load_dataset(datasetPath, image_dimensions):
# grab the paths to all images in our dataset directory, then
# initialize our lists of images
imagePaths = os.listdir(datasetPath)
trainXList = []
testXList = []
testX = np.array([])
trainY = np.array([])
trainY = np.array([])
testY = np.array([])
testI = 0
# loop over the image paths
for directories in imagePaths:
tempF= []
tempNF = []
for element in os.listdir(datasetPath + "/"+ directories):
if re.search(".jpg", element):
image = cv2.imread(datasetPath + "/"+ directories + "/" + element)
image = cv2.resize(image, image_dimensions)
if "+" in element:
tempF.append(image)
else:
tempNF.append(image)
tempF = np.array(tempF, dtype="float32")
tempNF = np.array(tempNF, dtype="float32")
fireLabels = np.ones((tempF.shape[0],))
nonFireLabels = np.zeros((tempNF.shape[0],))
data = np.vstack([tempF, tempNF])
labels = np.hstack([fireLabels, nonFireLabels])
labels = to_categorical(labels, num_classes=2)
print(labels)
data /= 255
(t_trainX, t_testX, t_trainY, t_testY) = train_test_split(data, labels,
test_size=0.2, random_state=42)
trainXList.append(t_trainX)
testXList.append(t_testX)
print(t_trainY.shape, trainY.shape)
if trainY.size == 0:
trainY = t_trainY
testY = t_testY
else:
trainY = np.append(trainY, t_trainY, axis = 0)
testY = np.append(testY, t_testY, axis = 0)
trainX = np.vstack(trainXList)
testX = np.vstack(testXList)
# trainY = np.hstack(trainYList)
# testY = np.hstack(testYList)
labels = np.append(trainY, testY)
labels = to_categorical(labels, num_classes=2)
classTotals = labels.sum(axis=0)
classWeight = classTotals.max() / classTotals
print(trainX.shape, testX.shape, trainY.shape, testY.shape)
return trainX, testX, trainY, testY, classWeight
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: keras-2
namespace: digits
spec:
replicas: 1
selector:
matchLabels:
k8s-app: keras-2
template:
metadata:
labels:
k8s-app: keras-2
spec:
tolerations:
- key: "region"
operator: "Equal"
value: "allow"
effect: "NoSchedule"
containers:
- name: keras-kube
image: gitlab-registry.nautilus.optiputer.net/ar-noc/keras-smoke-detection:latest
securityContext:
capabilities:
add:
- NET_ADMIN
command: ["/bin/sh", "-c"]
args: ["sleep infinity"]
resources:
limits:
memory: "64Gi"
cpu: "8"
nvidia.com/gpu: 1
requests:
memory: "32Gi"
cpu: "2"
nvidia.com/gpu: 1
volumeMounts:
- mountPath: /userdata/kerasData
name: modeltraining
volumes:
- name: modeltraining
persistentVolumeClaim:
claimName: modeltraining
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: gpu-type
# operator: In # Use NotIn for other types
# values:
# - K40
# - V100
File added
screenshots/THEOTHEREND.PNG

47.7 KiB

screenshots/eng.PNG

15.2 KiB

screenshots/execinto.PNG

5.4 KiB

screenshots/firstBatch.PNG

12.9 KiB

screenshots/hickups.PNG

11.7 KiB

screenshots/init.png

29.7 KiB