Face Mask Detection

This commit is contained in:
s470609 2022-02-16 02:14:07 +01:00
commit d74903352c
15 changed files with 4576 additions and 0 deletions

140
.gitignore vendored Normal file
View File

@ -0,0 +1,140 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
data/*
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/face-mask-detection.iml" filepath="$PROJECT_DIR$/.idea/face-mask-detection.iml" />
</modules>
</component>
</project>

302
data_preprocessing.ipynb Normal file
View File

@ -0,0 +1,302 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "60b9db20",
"metadata": {},
"outputs": [],
"source": [
"import glob\n",
"import pandas as pd\n",
"import cv2\n",
"import os\n",
"from xml.etree import ElementTree"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "02938bb8",
"metadata": {},
"outputs": [],
"source": [
"ANNOTATIONS_DIR = './data/annotations'\n",
"IMAGES_DIR = './data/images'\n",
"CROPPED_DIR = './data/cropped_images'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "b2cd1af7",
"metadata": {},
"outputs": [],
"source": [
"metadata = {'xmin': [], 'ymin': [], 'xmax': [], 'ymax': [], 'label': [], 'file': []}\n",
"\n",
"for file in glob.glob(ANNOTATIONS_DIR + '/*.xml'):\n",
" tree = ElementTree.parse(file)\n",
" file_name = os.path.splitext(os.path.basename(file))[0]\n",
" \n",
" for annotation in tree.iter():\n",
"\n",
" if 'object' in annotation.tag:\n",
" for attr in list(annotation):\n",
" \n",
" if 'name' in attr.tag:\n",
" name = attr.text \n",
" metadata['label'].append(name)\n",
" metadata['file'].append(file_name)\n",
" \n",
" if 'bndbox' in attr.tag:\n",
" for dimensions in list(attr):\n",
" if 'xmin' in dimensions.tag:\n",
" xmin = int(round(float(dimensions.text)))\n",
" metadata['xmin'].append(xmin)\n",
" if 'ymin' in dimensions.tag:\n",
" ymin = int(round(float(dimensions.text)))\n",
" metadata['ymin'].append(ymin) \n",
" if 'xmax' in dimensions.tag:\n",
" xmax = int(round(float(dimensions.text)))\n",
" metadata['xmax'].append(xmax) \n",
" if 'ymax' in dimensions.tag:\n",
" ymax = int(round(float(dimensions.text)))\n",
" metadata['ymax'].append(ymax)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7de14020",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>xmin</th>\n",
" <th>ymin</th>\n",
" <th>xmax</th>\n",
" <th>ymax</th>\n",
" <th>label</th>\n",
" <th>file</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>79</td>\n",
" <td>105</td>\n",
" <td>109</td>\n",
" <td>142</td>\n",
" <td>without_mask</td>\n",
" <td>maksssksksss0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>185</td>\n",
" <td>100</td>\n",
" <td>226</td>\n",
" <td>144</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>325</td>\n",
" <td>90</td>\n",
" <td>360</td>\n",
" <td>141</td>\n",
" <td>without_mask</td>\n",
" <td>maksssksksss0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>321</td>\n",
" <td>34</td>\n",
" <td>354</td>\n",
" <td>69</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>224</td>\n",
" <td>38</td>\n",
" <td>261</td>\n",
" <td>73</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4067</th>\n",
" <td>263</td>\n",
" <td>62</td>\n",
" <td>287</td>\n",
" <td>85</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss98</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4068</th>\n",
" <td>344</td>\n",
" <td>80</td>\n",
" <td>377</td>\n",
" <td>106</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss98</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4069</th>\n",
" <td>181</td>\n",
" <td>54</td>\n",
" <td>273</td>\n",
" <td>162</td>\n",
" <td>mask_weared_incorrect</td>\n",
" <td>maksssksksss99</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4070</th>\n",
" <td>99</td>\n",
" <td>87</td>\n",
" <td>176</td>\n",
" <td>165</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss99</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4071</th>\n",
" <td>289</td>\n",
" <td>99</td>\n",
" <td>355</td>\n",
" <td>233</td>\n",
" <td>with_mask</td>\n",
" <td>maksssksksss99</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>4072 rows × 6 columns</p>\n",
"</div>"
],
"text/plain": [
" xmin ymin xmax ymax label file\n",
"0 79 105 109 142 without_mask maksssksksss0\n",
"1 185 100 226 144 with_mask maksssksksss0\n",
"2 325 90 360 141 without_mask maksssksksss0\n",
"3 321 34 354 69 with_mask maksssksksss1\n",
"4 224 38 261 73 with_mask maksssksksss1\n",
"... ... ... ... ... ... ...\n",
"4067 263 62 287 85 with_mask maksssksksss98\n",
"4068 344 80 377 106 with_mask maksssksksss98\n",
"4069 181 54 273 162 mask_weared_incorrect maksssksksss99\n",
"4070 99 87 176 165 with_mask maksssksksss99\n",
"4071 289 99 355 233 with_mask maksssksksss99\n",
"\n",
"[4072 rows x 6 columns]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"metadata_df = pd.DataFrame(metadata)\n",
"metadata_df"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "ac7bdedc",
"metadata": {},
"outputs": [],
"source": [
"for i in range(len(metadata_df)):\n",
" \n",
" path = IMAGES_DIR + '/' + metadata_df['file'].iloc[i] + '.png'\n",
"\n",
" image = cv2.imread(path)\n",
" \n",
" cropped_name = str(i) + '.png'\n",
" \n",
" xmin = metadata_df['xmin'].iloc[i]\n",
" ymin = metadata_df['ymin'].iloc[i]\n",
" xmax = metadata_df['xmax'].iloc[i]\n",
" ymax = metadata_df['ymax'].iloc[i]\n",
"\n",
" cropped_image = image[ymin:ymax, xmin:xmax]\n",
" \n",
" cropped_path = CROPPED_DIR + '/' + cropped_name\n",
" \n",
" cv2.imwrite(cropped_path, cropped_image)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "a2998898",
"metadata": {},
"outputs": [],
"source": [
"metadata_df['label'].to_csv(r'./data/labels.txt', index=False, header=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "df86c02f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

101
detect_mask.py Normal file
View File

@ -0,0 +1,101 @@
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
import numpy as np
import cv2
labels = {0: 'mask_incorrectly_worn', 1: 'with_mask', 2: 'without_mask'}
def most_common(lst):
return max(set(lst), key=lst.count)
def detect_mask(img, face_detector, face_mask_detector):
(h, w) = img.shape[:2]
blob = cv2.dnn.blobFromImage(img, 1.0, (128, 128), (104.0, 177.0, 123.0))
face_detector.setInput(blob)
detections = face_detector.forward()
faces = []
locs = []
preds = []
for i in range(0, detections.shape[2]):
confidence = detections[0, 0, i, 2]
if confidence > 0.5:
box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
(startX, startY, endX, endY) = box.astype("int")
(startX, startY) = (max(0, startX), max(0, startY))
(endX, endY) = (min(w - 1, endX), min(h - 1, endY))
face = img[startY:endY, startX:endX]
face = cv2.cvtColor(face, cv2.COLOR_BGR2RGB)
face = cv2.resize(face, (128, 128))
face = img_to_array(face)
face = preprocess_input(face)
faces.append(face)
locs.append((startX, startY, endX, endY))
if len(faces) > 0:
faces = np.array(faces, dtype="float32")
preds = face_mask_detector.predict(faces, batch_size=32)
return locs, preds
prototxtPath = r"face_detector\deploy.prototxt"
weightsPath = r"face_detector\res10_300x300_ssd_iter_140000.caffemodel"
faceNet = cv2.dnn.readNet(prototxtPath, weightsPath)
mask_detection_model = load_model("face_mask_detection2.h5")
states = []
current_label = ''
current_color = (0, 0, 0)
cam = cv2.VideoCapture(0)
while True:
ret, frame = cam.read()
if not ret:
print("failed to grab frame")
break
(locs, preds) = detect_mask(frame, faceNet, mask_detection_model)
for (box, pred) in zip(locs, preds):
(startX, startY, endX, endY) = box
label_index = np.argmax(pred)
states.append(label_index)
if len(states) == 10:
index = most_common(states)
current_label = labels[index]
if index == 2:
current_color = (0, 0, 255)
elif index == 1:
current_color = (0, 255, 0)
else:
current_color = (0, 127, 255)
states.clear()
if current_label != '':
cv2.putText(frame, current_label, (startX, startY - 10),
cv2.FONT_HERSHEY_SIMPLEX, 0.45, current_color, 2)
cv2.rectangle(frame, (startX, startY), (endX, endY), current_color, 2)
cv2.imshow("Face Mask Detection", frame)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
cv2.destroyAllWindows()
cam.release()

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
face_mask_detection.h5 Normal file

Binary file not shown.

BIN
face_mask_detection2.h5 Normal file

Binary file not shown.

461
test1/test1.txt Normal file
View File

@ -0,0 +1,461 @@
model: face_mask_detection.h5
Epoch 1/20
102/102 [==============================] - 79s 752ms/step - loss: 0.9477 - accuracy: 0.7547 - val_loss: 0.4901 - val_accuracy: 0.8552
Epoch 2/20
102/102 [==============================] - 76s 751ms/step - loss: 0.4837 - accuracy: 0.8164 - val_loss: 0.3934 - val_accuracy: 0.8503
Epoch 3/20
102/102 [==============================] - 76s 750ms/step - loss: 0.4393 - accuracy: 0.8376 - val_loss: 0.3695 - val_accuracy: 0.8785
Epoch 4/20
102/102 [==============================] - 77s 756ms/step - loss: 0.3877 - accuracy: 0.8542 - val_loss: 0.3527 - val_accuracy: 0.8429
Epoch 5/20
102/102 [==============================] - 76s 746ms/step - loss: 0.3312 - accuracy: 0.8726 - val_loss: 0.2975 - val_accuracy: 0.9006
Epoch 6/20
102/102 [==============================] - 76s 745ms/step - loss: 0.3371 - accuracy: 0.8726 - val_loss: 0.2907 - val_accuracy: 0.8994
Epoch 7/20
102/102 [==============================] - 76s 745ms/step - loss: 0.2786 - accuracy: 0.9011 - val_loss: 0.2727 - val_accuracy: 0.9141
Epoch 8/20
102/102 [==============================] - 76s 746ms/step - loss: 0.2603 - accuracy: 0.9036 - val_loss: 0.2752 - val_accuracy: 0.9031
Epoch 9/20
102/102 [==============================] - 76s 744ms/step - loss: 0.2534 - accuracy: 0.9036 - val_loss: 0.2800 - val_accuracy: 0.9006
Epoch 10/20
102/102 [==============================] - 76s 750ms/step - loss: 0.2310 - accuracy: 0.9100 - val_loss: 0.3186 - val_accuracy: 0.8834
Epoch 11/20
102/102 [==============================] - 76s 746ms/step - loss: 0.2313 - accuracy: 0.9137 - val_loss: 0.2957 - val_accuracy: 0.9117
Epoch 12/20
102/102 [==============================] - 76s 745ms/step - loss: 0.2153 - accuracy: 0.9165 - val_loss: 0.2776 - val_accuracy: 0.9080
Epoch 13/20
102/102 [==============================] - 76s 749ms/step - loss: 0.2085 - accuracy: 0.9226 - val_loss: 0.2649 - val_accuracy: 0.9055
Epoch 14/20
102/102 [==============================] - 76s 748ms/step - loss: 0.1967 - accuracy: 0.9248 - val_loss: 0.2683 - val_accuracy: 0.9117
Epoch 15/20
102/102 [==============================] - 80s 791ms/step - loss: 0.2008 - accuracy: 0.9196 - val_loss: 0.2694 - val_accuracy: 0.9178
Epoch 16/20
102/102 [==============================] - 76s 749ms/step - loss: 0.1817 - accuracy: 0.9328 - val_loss: 0.2891 - val_accuracy: 0.9117
Epoch 17/20
102/102 [==============================] - 77s 753ms/step - loss: 0.1827 - accuracy: 0.9275 - val_loss: 0.2619 - val_accuracy: 0.9276
Epoch 18/20
102/102 [==============================] - 78s 768ms/step - loss: 0.1553 - accuracy: 0.9392 - val_loss: 0.2798 - val_accuracy: 0.9215
Epoch 19/20
102/102 [==============================] - 83s 814ms/step - loss: 0.1410 - accuracy: 0.9438 - val_loss: 0.2985 - val_accuracy: 0.9178
Epoch 20/20
102/102 [==============================] - 87s 851ms/step - loss: 0.1604 - accuracy: 0.9364 - val_loss: 0.3088 - val_accuracy: 0.9202
Model: "model_6"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_16 (InputLayer) [(None, 224, 224, 3 0 []
)]
Conv1 (Conv2D) (None, 112, 112, 32 864 ['input_16[0][0]']
)
bn_Conv1 (BatchNormalization) (None, 112, 112, 32 128 ['Conv1[0][0]']
)
Conv1_relu (ReLU) (None, 112, 112, 32 0 ['bn_Conv1[0][0]']
)
expanded_conv_depthwise (Depth (None, 112, 112, 32 288 ['Conv1_relu[0][0]']
wiseConv2D) )
expanded_conv_depthwise_BN (Ba (None, 112, 112, 32 128 ['expanded_conv_depthwise[0][0]']
tchNormalization) )
expanded_conv_depthwise_relu ( (None, 112, 112, 32 0 ['expanded_conv_depthwise_BN[0][0
ReLU) ) ]']
expanded_conv_project (Conv2D) (None, 112, 112, 16 512 ['expanded_conv_depthwise_relu[0]
) [0]']
expanded_conv_project_BN (Batc (None, 112, 112, 16 64 ['expanded_conv_project[0][0]']
hNormalization) )
block_1_expand (Conv2D) (None, 112, 112, 96 1536 ['expanded_conv_project_BN[0][0]'
) ]
block_1_expand_BN (BatchNormal (None, 112, 112, 96 384 ['block_1_expand[0][0]']
ization) )
block_1_expand_relu (ReLU) (None, 112, 112, 96 0 ['block_1_expand_BN[0][0]']
)
block_1_pad (ZeroPadding2D) (None, 113, 113, 96 0 ['block_1_expand_relu[0][0]']
)
block_1_depthwise (DepthwiseCo (None, 56, 56, 96) 864 ['block_1_pad[0][0]']
nv2D)
block_1_depthwise_BN (BatchNor (None, 56, 56, 96) 384 ['block_1_depthwise[0][0]']
malization)
block_1_depthwise_relu (ReLU) (None, 56, 56, 96) 0 ['block_1_depthwise_BN[0][0]']
block_1_project (Conv2D) (None, 56, 56, 24) 2304 ['block_1_depthwise_relu[0][0]']
block_1_project_BN (BatchNorma (None, 56, 56, 24) 96 ['block_1_project[0][0]']
lization)
block_2_expand (Conv2D) (None, 56, 56, 144) 3456 ['block_1_project_BN[0][0]']
block_2_expand_BN (BatchNormal (None, 56, 56, 144) 576 ['block_2_expand[0][0]']
ization)
block_2_expand_relu (ReLU) (None, 56, 56, 144) 0 ['block_2_expand_BN[0][0]']
block_2_depthwise (DepthwiseCo (None, 56, 56, 144) 1296 ['block_2_expand_relu[0][0]']
nv2D)
block_2_depthwise_BN (BatchNor (None, 56, 56, 144) 576 ['block_2_depthwise[0][0]']
malization)
block_2_depthwise_relu (ReLU) (None, 56, 56, 144) 0 ['block_2_depthwise_BN[0][0]']
block_2_project (Conv2D) (None, 56, 56, 24) 3456 ['block_2_depthwise_relu[0][0]']
block_2_project_BN (BatchNorma (None, 56, 56, 24) 96 ['block_2_project[0][0]']
lization)
block_2_add (Add) (None, 56, 56, 24) 0 ['block_1_project_BN[0][0]',
'block_2_project_BN[0][0]']
block_3_expand (Conv2D) (None, 56, 56, 144) 3456 ['block_2_add[0][0]']
block_3_expand_BN (BatchNormal (None, 56, 56, 144) 576 ['block_3_expand[0][0]']
ization)
block_3_expand_relu (ReLU) (None, 56, 56, 144) 0 ['block_3_expand_BN[0][0]']
block_3_pad (ZeroPadding2D) (None, 57, 57, 144) 0 ['block_3_expand_relu[0][0]']
block_3_depthwise (DepthwiseCo (None, 28, 28, 144) 1296 ['block_3_pad[0][0]']
nv2D)
block_3_depthwise_BN (BatchNor (None, 28, 28, 144) 576 ['block_3_depthwise[0][0]']
malization)
block_3_depthwise_relu (ReLU) (None, 28, 28, 144) 0 ['block_3_depthwise_BN[0][0]']
block_3_project (Conv2D) (None, 28, 28, 32) 4608 ['block_3_depthwise_relu[0][0]']
block_3_project_BN (BatchNorma (None, 28, 28, 32) 128 ['block_3_project[0][0]']
lization)
block_4_expand (Conv2D) (None, 28, 28, 192) 6144 ['block_3_project_BN[0][0]']
block_4_expand_BN (BatchNormal (None, 28, 28, 192) 768 ['block_4_expand[0][0]']
ization)
block_4_expand_relu (ReLU) (None, 28, 28, 192) 0 ['block_4_expand_BN[0][0]']
block_4_depthwise (DepthwiseCo (None, 28, 28, 192) 1728 ['block_4_expand_relu[0][0]']
nv2D)
block_4_depthwise_BN (BatchNor (None, 28, 28, 192) 768 ['block_4_depthwise[0][0]']
malization)
block_4_depthwise_relu (ReLU) (None, 28, 28, 192) 0 ['block_4_depthwise_BN[0][0]']
block_4_project (Conv2D) (None, 28, 28, 32) 6144 ['block_4_depthwise_relu[0][0]']
block_4_project_BN (BatchNorma (None, 28, 28, 32) 128 ['block_4_project[0][0]']
lization)
block_4_add (Add) (None, 28, 28, 32) 0 ['block_3_project_BN[0][0]',
'block_4_project_BN[0][0]']
block_5_expand (Conv2D) (None, 28, 28, 192) 6144 ['block_4_add[0][0]']
block_5_expand_BN (BatchNormal (None, 28, 28, 192) 768 ['block_5_expand[0][0]']
ization)
block_5_expand_relu (ReLU) (None, 28, 28, 192) 0 ['block_5_expand_BN[0][0]']
block_5_depthwise (DepthwiseCo (None, 28, 28, 192) 1728 ['block_5_expand_relu[0][0]']
nv2D)
block_5_depthwise_BN (BatchNor (None, 28, 28, 192) 768 ['block_5_depthwise[0][0]']
malization)
block_5_depthwise_relu (ReLU) (None, 28, 28, 192) 0 ['block_5_depthwise_BN[0][0]']
block_5_project (Conv2D) (None, 28, 28, 32) 6144 ['block_5_depthwise_relu[0][0]']
block_5_project_BN (BatchNorma (None, 28, 28, 32) 128 ['block_5_project[0][0]']
lization)
block_5_add (Add) (None, 28, 28, 32) 0 ['block_4_add[0][0]',
'block_5_project_BN[0][0]']
block_6_expand (Conv2D) (None, 28, 28, 192) 6144 ['block_5_add[0][0]']
block_6_expand_BN (BatchNormal (None, 28, 28, 192) 768 ['block_6_expand[0][0]']
ization)
block_6_expand_relu (ReLU) (None, 28, 28, 192) 0 ['block_6_expand_BN[0][0]']
block_6_pad (ZeroPadding2D) (None, 29, 29, 192) 0 ['block_6_expand_relu[0][0]']
block_6_depthwise (DepthwiseCo (None, 14, 14, 192) 1728 ['block_6_pad[0][0]']
nv2D)
block_6_depthwise_BN (BatchNor (None, 14, 14, 192) 768 ['block_6_depthwise[0][0]']
malization)
block_6_depthwise_relu (ReLU) (None, 14, 14, 192) 0 ['block_6_depthwise_BN[0][0]']
block_6_project (Conv2D) (None, 14, 14, 64) 12288 ['block_6_depthwise_relu[0][0]']
block_6_project_BN (BatchNorma (None, 14, 14, 64) 256 ['block_6_project[0][0]']
lization)
block_7_expand (Conv2D) (None, 14, 14, 384) 24576 ['block_6_project_BN[0][0]']
block_7_expand_BN (BatchNormal (None, 14, 14, 384) 1536 ['block_7_expand[0][0]']
ization)
block_7_expand_relu (ReLU) (None, 14, 14, 384) 0 ['block_7_expand_BN[0][0]']
block_7_depthwise (DepthwiseCo (None, 14, 14, 384) 3456 ['block_7_expand_relu[0][0]']
nv2D)
block_7_depthwise_BN (BatchNor (None, 14, 14, 384) 1536 ['block_7_depthwise[0][0]']
malization)
block_7_depthwise_relu (ReLU) (None, 14, 14, 384) 0 ['block_7_depthwise_BN[0][0]']
block_7_project (Conv2D) (None, 14, 14, 64) 24576 ['block_7_depthwise_relu[0][0]']
block_7_project_BN (BatchNorma (None, 14, 14, 64) 256 ['block_7_project[0][0]']
lization)
block_7_add (Add) (None, 14, 14, 64) 0 ['block_6_project_BN[0][0]',
'block_7_project_BN[0][0]']
block_8_expand (Conv2D) (None, 14, 14, 384) 24576 ['block_7_add[0][0]']
block_8_expand_BN (BatchNormal (None, 14, 14, 384) 1536 ['block_8_expand[0][0]']
ization)
block_8_expand_relu (ReLU) (None, 14, 14, 384) 0 ['block_8_expand_BN[0][0]']
block_8_depthwise (DepthwiseCo (None, 14, 14, 384) 3456 ['block_8_expand_relu[0][0]']
nv2D)
block_8_depthwise_BN (BatchNor (None, 14, 14, 384) 1536 ['block_8_depthwise[0][0]']
malization)
block_8_depthwise_relu (ReLU) (None, 14, 14, 384) 0 ['block_8_depthwise_BN[0][0]']
block_8_project (Conv2D) (None, 14, 14, 64) 24576 ['block_8_depthwise_relu[0][0]']
block_8_project_BN (BatchNorma (None, 14, 14, 64) 256 ['block_8_project[0][0]']
lization)
block_8_add (Add) (None, 14, 14, 64) 0 ['block_7_add[0][0]',
'block_8_project_BN[0][0]']
block_9_expand (Conv2D) (None, 14, 14, 384) 24576 ['block_8_add[0][0]']
block_9_expand_BN (BatchNormal (None, 14, 14, 384) 1536 ['block_9_expand[0][0]']
ization)
block_9_expand_relu (ReLU) (None, 14, 14, 384) 0 ['block_9_expand_BN[0][0]']
block_9_depthwise (DepthwiseCo (None, 14, 14, 384) 3456 ['block_9_expand_relu[0][0]']
nv2D)
block_9_depthwise_BN (BatchNor (None, 14, 14, 384) 1536 ['block_9_depthwise[0][0]']
malization)
block_9_depthwise_relu (ReLU) (None, 14, 14, 384) 0 ['block_9_depthwise_BN[0][0]']
block_9_project (Conv2D) (None, 14, 14, 64) 24576 ['block_9_depthwise_relu[0][0]']
block_9_project_BN (BatchNorma (None, 14, 14, 64) 256 ['block_9_project[0][0]']
lization)
block_9_add (Add) (None, 14, 14, 64) 0 ['block_8_add[0][0]',
'block_9_project_BN[0][0]']
block_10_expand (Conv2D) (None, 14, 14, 384) 24576 ['block_9_add[0][0]']
block_10_expand_BN (BatchNorma (None, 14, 14, 384) 1536 ['block_10_expand[0][0]']
lization)
block_10_expand_relu (ReLU) (None, 14, 14, 384) 0 ['block_10_expand_BN[0][0]']
block_10_depthwise (DepthwiseC (None, 14, 14, 384) 3456 ['block_10_expand_relu[0][0]']
onv2D)
block_10_depthwise_BN (BatchNo (None, 14, 14, 384) 1536 ['block_10_depthwise[0][0]']
rmalization)
block_10_depthwise_relu (ReLU) (None, 14, 14, 384) 0 ['block_10_depthwise_BN[0][0]']
block_10_project (Conv2D) (None, 14, 14, 96) 36864 ['block_10_depthwise_relu[0][0]']
block_10_project_BN (BatchNorm (None, 14, 14, 96) 384 ['block_10_project[0][0]']
alization)
block_11_expand (Conv2D) (None, 14, 14, 576) 55296 ['block_10_project_BN[0][0]']
block_11_expand_BN (BatchNorma (None, 14, 14, 576) 2304 ['block_11_expand[0][0]']
lization)
block_11_expand_relu (ReLU) (None, 14, 14, 576) 0 ['block_11_expand_BN[0][0]']
block_11_depthwise (DepthwiseC (None, 14, 14, 576) 5184 ['block_11_expand_relu[0][0]']
onv2D)
block_11_depthwise_BN (BatchNo (None, 14, 14, 576) 2304 ['block_11_depthwise[0][0]']
rmalization)
block_11_depthwise_relu (ReLU) (None, 14, 14, 576) 0 ['block_11_depthwise_BN[0][0]']
block_11_project (Conv2D) (None, 14, 14, 96) 55296 ['block_11_depthwise_relu[0][0]']
block_11_project_BN (BatchNorm (None, 14, 14, 96) 384 ['block_11_project[0][0]']
alization)
block_11_add (Add) (None, 14, 14, 96) 0 ['block_10_project_BN[0][0]',
'block_11_project_BN[0][0]']
block_12_expand (Conv2D) (None, 14, 14, 576) 55296 ['block_11_add[0][0]']
block_12_expand_BN (BatchNorma (None, 14, 14, 576) 2304 ['block_12_expand[0][0]']
lization)
block_12_expand_relu (ReLU) (None, 14, 14, 576) 0 ['block_12_expand_BN[0][0]']
block_12_depthwise (DepthwiseC (None, 14, 14, 576) 5184 ['block_12_expand_relu[0][0]']
onv2D)
block_12_depthwise_BN (BatchNo (None, 14, 14, 576) 2304 ['block_12_depthwise[0][0]']
rmalization)
block_12_depthwise_relu (ReLU) (None, 14, 14, 576) 0 ['block_12_depthwise_BN[0][0]']
block_12_project (Conv2D) (None, 14, 14, 96) 55296 ['block_12_depthwise_relu[0][0]']
block_12_project_BN (BatchNorm (None, 14, 14, 96) 384 ['block_12_project[0][0]']
alization)
block_12_add (Add) (None, 14, 14, 96) 0 ['block_11_add[0][0]',
'block_12_project_BN[0][0]']
block_13_expand (Conv2D) (None, 14, 14, 576) 55296 ['block_12_add[0][0]']
block_13_expand_BN (BatchNorma (None, 14, 14, 576) 2304 ['block_13_expand[0][0]']
lization)
block_13_expand_relu (ReLU) (None, 14, 14, 576) 0 ['block_13_expand_BN[0][0]']
block_13_pad (ZeroPadding2D) (None, 15, 15, 576) 0 ['block_13_expand_relu[0][0]']
block_13_depthwise (DepthwiseC (None, 7, 7, 576) 5184 ['block_13_pad[0][0]']
onv2D)
block_13_depthwise_BN (BatchNo (None, 7, 7, 576) 2304 ['block_13_depthwise[0][0]']
rmalization)
block_13_depthwise_relu (ReLU) (None, 7, 7, 576) 0 ['block_13_depthwise_BN[0][0]']
block_13_project (Conv2D) (None, 7, 7, 160) 92160 ['block_13_depthwise_relu[0][0]']
block_13_project_BN (BatchNorm (None, 7, 7, 160) 640 ['block_13_project[0][0]']
alization)
block_14_expand (Conv2D) (None, 7, 7, 960) 153600 ['block_13_project_BN[0][0]']
block_14_expand_BN (BatchNorma (None, 7, 7, 960) 3840 ['block_14_expand[0][0]']
lization)
block_14_expand_relu (ReLU) (None, 7, 7, 960) 0 ['block_14_expand_BN[0][0]']
block_14_depthwise (DepthwiseC (None, 7, 7, 960) 8640 ['block_14_expand_relu[0][0]']
onv2D)
block_14_depthwise_BN (BatchNo (None, 7, 7, 960) 3840 ['block_14_depthwise[0][0]']
rmalization)
block_14_depthwise_relu (ReLU) (None, 7, 7, 960) 0 ['block_14_depthwise_BN[0][0]']
block_14_project (Conv2D) (None, 7, 7, 160) 153600 ['block_14_depthwise_relu[0][0]']
block_14_project_BN (BatchNorm (None, 7, 7, 160) 640 ['block_14_project[0][0]']
alization)
block_14_add (Add) (None, 7, 7, 160) 0 ['block_13_project_BN[0][0]',
'block_14_project_BN[0][0]']
block_15_expand (Conv2D) (None, 7, 7, 960) 153600 ['block_14_add[0][0]']
block_15_expand_BN (BatchNorma (None, 7, 7, 960) 3840 ['block_15_expand[0][0]']
lization)
block_15_expand_relu (ReLU) (None, 7, 7, 960) 0 ['block_15_expand_BN[0][0]']
block_15_depthwise (DepthwiseC (None, 7, 7, 960) 8640 ['block_15_expand_relu[0][0]']
onv2D)
block_15_depthwise_BN (BatchNo (None, 7, 7, 960) 3840 ['block_15_depthwise[0][0]']
rmalization)
block_15_depthwise_relu (ReLU) (None, 7, 7, 960) 0 ['block_15_depthwise_BN[0][0]']
block_15_project (Conv2D) (None, 7, 7, 160) 153600 ['block_15_depthwise_relu[0][0]']
block_15_project_BN (BatchNorm (None, 7, 7, 160) 640 ['block_15_project[0][0]']
alization)
block_15_add (Add) (None, 7, 7, 160) 0 ['block_14_add[0][0]',
'block_15_project_BN[0][0]']
block_16_expand (Conv2D) (None, 7, 7, 960) 153600 ['block_15_add[0][0]']
block_16_expand_BN (BatchNorma (None, 7, 7, 960) 3840 ['block_16_expand[0][0]']
lization)
block_16_expand_relu (ReLU) (None, 7, 7, 960) 0 ['block_16_expand_BN[0][0]']
block_16_depthwise (DepthwiseC (None, 7, 7, 960) 8640 ['block_16_expand_relu[0][0]']
onv2D)
block_16_depthwise_BN (BatchNo (None, 7, 7, 960) 3840 ['block_16_depthwise[0][0]']
rmalization)
block_16_depthwise_relu (ReLU) (None, 7, 7, 960) 0 ['block_16_depthwise_BN[0][0]']
block_16_project (Conv2D) (None, 7, 7, 320) 307200 ['block_16_depthwise_relu[0][0]']
block_16_project_BN (BatchNorm (None, 7, 7, 320) 1280 ['block_16_project[0][0]']
alization)
Conv_1 (Conv2D) (None, 7, 7, 1280) 409600 ['block_16_project_BN[0][0]']
Conv_1_bn (BatchNormalization) (None, 7, 7, 1280) 5120 ['Conv_1[0][0]']
out_relu (ReLU) (None, 7, 7, 1280) 0 ['Conv_1_bn[0][0]']
average_pooling2d_17 (AverageP (None, 3, 3, 1280) 0 ['out_relu[0][0]']
ooling2D)
flatten_7 (Flatten) (None, 11520) 0 ['average_pooling2d_17[0][0]']
dense_21 (Dense) (None, 256) 2949376 ['flatten_7[0][0]']
dropout_7 (Dropout) (None, 256) 0 ['dense_21[0][0]']
dense_22 (Dense) (None, 64) 16448 ['dropout_7[0][0]']
dense_23 (Dense) (None, 3) 195 ['dense_22[0][0]']
==================================================================================================
Total params: 5,224,003
Trainable params: 2,966,019
Non-trainable params: 2,257,984

448
test1/test2.txt Normal file
View File

@ -0,0 +1,448 @@
model: face_mask_detection2.hp
Epoch 1/15
102/102 [==============================] - 31s 277ms/step - loss: 0.5791 - accuracy: 0.8001 - val_loss: 0.4123 - val_accuracy: 0.8466
Epoch 2/15
102/102 [==============================] - 27s 270ms/step - loss: 0.4334 - accuracy: 0.8342 - val_loss: 0.3737 - val_accuracy: 0.8466
Epoch 3/15
102/102 [==============================] - 28s 271ms/step - loss: 0.3859 - accuracy: 0.8505 - val_loss: 0.3362 - val_accuracy: 0.8847
Epoch 4/15
102/102 [==============================] - 28s 270ms/step - loss: 0.3585 - accuracy: 0.8591 - val_loss: 0.3520 - val_accuracy: 0.8540
Epoch 5/15
102/102 [==============================] - 28s 273ms/step - loss: 0.3224 - accuracy: 0.8806 - val_loss: 0.3561 - val_accuracy: 0.8503
Epoch 6/15
102/102 [==============================] - 27s 270ms/step - loss: 0.3080 - accuracy: 0.8766 - val_loss: 0.3010 - val_accuracy: 0.8798
Epoch 7/15
102/102 [==============================] - 30s 291ms/step - loss: 0.2779 - accuracy: 0.8870 - val_loss: 0.2870 - val_accuracy: 0.8982
Epoch 8/15
102/102 [==============================] - 32s 319ms/step - loss: 0.2697 - accuracy: 0.8971 - val_loss: 0.3190 - val_accuracy: 0.8847
Epoch 9/15
102/102 [==============================] - 32s 312ms/step - loss: 0.2526 - accuracy: 0.9011 - val_loss: 0.2778 - val_accuracy: 0.8945
Epoch 10/15
102/102 [==============================] - 31s 304ms/step - loss: 0.2416 - accuracy: 0.9073 - val_loss: 0.2891 - val_accuracy: 0.8883
Epoch 11/15
102/102 [==============================] - 31s 303ms/step - loss: 0.2325 - accuracy: 0.9100 - val_loss: 0.2945 - val_accuracy: 0.8933
Epoch 12/15
102/102 [==============================] - 31s 302ms/step - loss: 0.2156 - accuracy: 0.9128 - val_loss: 0.2748 - val_accuracy: 0.9067
Epoch 13/15
102/102 [==============================] - 33s 328ms/step - loss: 0.2105 - accuracy: 0.9211 - val_loss: 0.3212 - val_accuracy: 0.8994
Epoch 14/15
102/102 [==============================] - 32s 311ms/step - loss: 0.1986 - accuracy: 0.9171 - val_loss: 0.2914 - val_accuracy: 0.9043
Epoch 15/15
102/102 [==============================] - 32s 311ms/step - loss: 0.2002 - accuracy: 0.9254 - val_loss: 0.2541 - val_accuracy: 0.9117
26/26 [==============================] - 6s 213ms/step - loss: 0.2541 - accuracy: 0.9117
Test loss: 0.2540619671344757 / Test accuracy: 0.9116564393043518
Model: "model_8"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_17 (InputLayer) [(None, 128, 128, 3 0 []
)]
Conv1 (Conv2D) (None, 64, 64, 32) 864 ['input_17[0][0]']
bn_Conv1 (BatchNormalization) (None, 64, 64, 32) 128 ['Conv1[0][0]']
Conv1_relu (ReLU) (None, 64, 64, 32) 0 ['bn_Conv1[0][0]']
expanded_conv_depthwise (Depth (None, 64, 64, 32) 288 ['Conv1_relu[0][0]']
wiseConv2D)
expanded_conv_depthwise_BN (Ba (None, 64, 64, 32) 128 ['expanded_conv_depthwise[0][0]']
tchNormalization)
expanded_conv_depthwise_relu ( (None, 64, 64, 32) 0 ['expanded_conv_depthwise_BN[0][0
ReLU) ]']
expanded_conv_project (Conv2D) (None, 64, 64, 16) 512 ['expanded_conv_depthwise_relu[0]
[0]']
expanded_conv_project_BN (Batc (None, 64, 64, 16) 64 ['expanded_conv_project[0][0]']
hNormalization)
block_1_expand (Conv2D) (None, 64, 64, 96) 1536 ['expanded_conv_project_BN[0][0]'
]
block_1_expand_BN (BatchNormal (None, 64, 64, 96) 384 ['block_1_expand[0][0]']
ization)
block_1_expand_relu (ReLU) (None, 64, 64, 96) 0 ['block_1_expand_BN[0][0]']
block_1_pad (ZeroPadding2D) (None, 65, 65, 96) 0 ['block_1_expand_relu[0][0]']
block_1_depthwise (DepthwiseCo (None, 32, 32, 96) 864 ['block_1_pad[0][0]']
nv2D)
block_1_depthwise_BN (BatchNor (None, 32, 32, 96) 384 ['block_1_depthwise[0][0]']
malization)
block_1_depthwise_relu (ReLU) (None, 32, 32, 96) 0 ['block_1_depthwise_BN[0][0]']
block_1_project (Conv2D) (None, 32, 32, 24) 2304 ['block_1_depthwise_relu[0][0]']
block_1_project_BN (BatchNorma (None, 32, 32, 24) 96 ['block_1_project[0][0]']
lization)
block_2_expand (Conv2D) (None, 32, 32, 144) 3456 ['block_1_project_BN[0][0]']
block_2_expand_BN (BatchNormal (None, 32, 32, 144) 576 ['block_2_expand[0][0]']
ization)
block_2_expand_relu (ReLU) (None, 32, 32, 144) 0 ['block_2_expand_BN[0][0]']
block_2_depthwise (DepthwiseCo (None, 32, 32, 144) 1296 ['block_2_expand_relu[0][0]']
nv2D)
block_2_depthwise_BN (BatchNor (None, 32, 32, 144) 576 ['block_2_depthwise[0][0]']
malization)
block_2_depthwise_relu (ReLU) (None, 32, 32, 144) 0 ['block_2_depthwise_BN[0][0]']
block_2_project (Conv2D) (None, 32, 32, 24) 3456 ['block_2_depthwise_relu[0][0]']
block_2_project_BN (BatchNorma (None, 32, 32, 24) 96 ['block_2_project[0][0]']
lization)
block_2_add (Add) (None, 32, 32, 24) 0 ['block_1_project_BN[0][0]',
'block_2_project_BN[0][0]']
block_3_expand (Conv2D) (None, 32, 32, 144) 3456 ['block_2_add[0][0]']
block_3_expand_BN (BatchNormal (None, 32, 32, 144) 576 ['block_3_expand[0][0]']
ization)
block_3_expand_relu (ReLU) (None, 32, 32, 144) 0 ['block_3_expand_BN[0][0]']
block_3_pad (ZeroPadding2D) (None, 33, 33, 144) 0 ['block_3_expand_relu[0][0]']
block_3_depthwise (DepthwiseCo (None, 16, 16, 144) 1296 ['block_3_pad[0][0]']
nv2D)
block_3_depthwise_BN (BatchNor (None, 16, 16, 144) 576 ['block_3_depthwise[0][0]']
malization)
block_3_depthwise_relu (ReLU) (None, 16, 16, 144) 0 ['block_3_depthwise_BN[0][0]']
block_3_project (Conv2D) (None, 16, 16, 32) 4608 ['block_3_depthwise_relu[0][0]']
block_3_project_BN (BatchNorma (None, 16, 16, 32) 128 ['block_3_project[0][0]']
lization)
block_4_expand (Conv2D) (None, 16, 16, 192) 6144 ['block_3_project_BN[0][0]']
block_4_expand_BN (BatchNormal (None, 16, 16, 192) 768 ['block_4_expand[0][0]']
ization)
block_4_expand_relu (ReLU) (None, 16, 16, 192) 0 ['block_4_expand_BN[0][0]']
block_4_depthwise (DepthwiseCo (None, 16, 16, 192) 1728 ['block_4_expand_relu[0][0]']
nv2D)
block_4_depthwise_BN (BatchNor (None, 16, 16, 192) 768 ['block_4_depthwise[0][0]']
malization)
block_4_depthwise_relu (ReLU) (None, 16, 16, 192) 0 ['block_4_depthwise_BN[0][0]']
block_4_project (Conv2D) (None, 16, 16, 32) 6144 ['block_4_depthwise_relu[0][0]']
block_4_project_BN (BatchNorma (None, 16, 16, 32) 128 ['block_4_project[0][0]']
lization)
block_4_add (Add) (None, 16, 16, 32) 0 ['block_3_project_BN[0][0]',
'block_4_project_BN[0][0]']
block_5_expand (Conv2D) (None, 16, 16, 192) 6144 ['block_4_add[0][0]']
block_5_expand_BN (BatchNormal (None, 16, 16, 192) 768 ['block_5_expand[0][0]']
ization)
block_5_expand_relu (ReLU) (None, 16, 16, 192) 0 ['block_5_expand_BN[0][0]']
block_5_depthwise (DepthwiseCo (None, 16, 16, 192) 1728 ['block_5_expand_relu[0][0]']
nv2D)
block_5_depthwise_BN (BatchNor (None, 16, 16, 192) 768 ['block_5_depthwise[0][0]']
malization)
block_5_depthwise_relu (ReLU) (None, 16, 16, 192) 0 ['block_5_depthwise_BN[0][0]']
block_5_project (Conv2D) (None, 16, 16, 32) 6144 ['block_5_depthwise_relu[0][0]']
block_5_project_BN (BatchNorma (None, 16, 16, 32) 128 ['block_5_project[0][0]']
lization)
block_5_add (Add) (None, 16, 16, 32) 0 ['block_4_add[0][0]',
'block_5_project_BN[0][0]']
block_6_expand (Conv2D) (None, 16, 16, 192) 6144 ['block_5_add[0][0]']
block_6_expand_BN (BatchNormal (None, 16, 16, 192) 768 ['block_6_expand[0][0]']
ization)
block_6_expand_relu (ReLU) (None, 16, 16, 192) 0 ['block_6_expand_BN[0][0]']
block_6_pad (ZeroPadding2D) (None, 17, 17, 192) 0 ['block_6_expand_relu[0][0]']
block_6_depthwise (DepthwiseCo (None, 8, 8, 192) 1728 ['block_6_pad[0][0]']
nv2D)
block_6_depthwise_BN (BatchNor (None, 8, 8, 192) 768 ['block_6_depthwise[0][0]']
malization)
block_6_depthwise_relu (ReLU) (None, 8, 8, 192) 0 ['block_6_depthwise_BN[0][0]']
block_6_project (Conv2D) (None, 8, 8, 64) 12288 ['block_6_depthwise_relu[0][0]']
block_6_project_BN (BatchNorma (None, 8, 8, 64) 256 ['block_6_project[0][0]']
lization)
block_7_expand (Conv2D) (None, 8, 8, 384) 24576 ['block_6_project_BN[0][0]']
block_7_expand_BN (BatchNormal (None, 8, 8, 384) 1536 ['block_7_expand[0][0]']
ization)
block_7_expand_relu (ReLU) (None, 8, 8, 384) 0 ['block_7_expand_BN[0][0]']
block_7_depthwise (DepthwiseCo (None, 8, 8, 384) 3456 ['block_7_expand_relu[0][0]']
nv2D)
block_7_depthwise_BN (BatchNor (None, 8, 8, 384) 1536 ['block_7_depthwise[0][0]']
malization)
block_7_depthwise_relu (ReLU) (None, 8, 8, 384) 0 ['block_7_depthwise_BN[0][0]']
block_7_project (Conv2D) (None, 8, 8, 64) 24576 ['block_7_depthwise_relu[0][0]']
block_7_project_BN (BatchNorma (None, 8, 8, 64) 256 ['block_7_project[0][0]']
lization)
block_7_add (Add) (None, 8, 8, 64) 0 ['block_6_project_BN[0][0]',
'block_7_project_BN[0][0]']
block_8_expand (Conv2D) (None, 8, 8, 384) 24576 ['block_7_add[0][0]']
block_8_expand_BN (BatchNormal (None, 8, 8, 384) 1536 ['block_8_expand[0][0]']
ization)
block_8_expand_relu (ReLU) (None, 8, 8, 384) 0 ['block_8_expand_BN[0][0]']
block_8_depthwise (DepthwiseCo (None, 8, 8, 384) 3456 ['block_8_expand_relu[0][0]']
nv2D)
block_8_depthwise_BN (BatchNor (None, 8, 8, 384) 1536 ['block_8_depthwise[0][0]']
malization)
block_8_depthwise_relu (ReLU) (None, 8, 8, 384) 0 ['block_8_depthwise_BN[0][0]']
block_8_project (Conv2D) (None, 8, 8, 64) 24576 ['block_8_depthwise_relu[0][0]']
block_8_project_BN (BatchNorma (None, 8, 8, 64) 256 ['block_8_project[0][0]']
lization)
block_8_add (Add) (None, 8, 8, 64) 0 ['block_7_add[0][0]',
'block_8_project_BN[0][0]']
block_9_expand (Conv2D) (None, 8, 8, 384) 24576 ['block_8_add[0][0]']
block_9_expand_BN (BatchNormal (None, 8, 8, 384) 1536 ['block_9_expand[0][0]']
ization)
block_9_expand_relu (ReLU) (None, 8, 8, 384) 0 ['block_9_expand_BN[0][0]']
block_9_depthwise (DepthwiseCo (None, 8, 8, 384) 3456 ['block_9_expand_relu[0][0]']
nv2D)
block_9_depthwise_BN (BatchNor (None, 8, 8, 384) 1536 ['block_9_depthwise[0][0]']
malization)
block_9_depthwise_relu (ReLU) (None, 8, 8, 384) 0 ['block_9_depthwise_BN[0][0]']
block_9_project (Conv2D) (None, 8, 8, 64) 24576 ['block_9_depthwise_relu[0][0]']
block_9_project_BN (BatchNorma (None, 8, 8, 64) 256 ['block_9_project[0][0]']
lization)
block_9_add (Add) (None, 8, 8, 64) 0 ['block_8_add[0][0]',
'block_9_project_BN[0][0]']
block_10_expand (Conv2D) (None, 8, 8, 384) 24576 ['block_9_add[0][0]']
block_10_expand_BN (BatchNorma (None, 8, 8, 384) 1536 ['block_10_expand[0][0]']
lization)
block_10_expand_relu (ReLU) (None, 8, 8, 384) 0 ['block_10_expand_BN[0][0]']
block_10_depthwise (DepthwiseC (None, 8, 8, 384) 3456 ['block_10_expand_relu[0][0]']
onv2D)
block_10_depthwise_BN (BatchNo (None, 8, 8, 384) 1536 ['block_10_depthwise[0][0]']
rmalization)
block_10_depthwise_relu (ReLU) (None, 8, 8, 384) 0 ['block_10_depthwise_BN[0][0]']
block_10_project (Conv2D) (None, 8, 8, 96) 36864 ['block_10_depthwise_relu[0][0]']
block_10_project_BN (BatchNorm (None, 8, 8, 96) 384 ['block_10_project[0][0]']
alization)
block_11_expand (Conv2D) (None, 8, 8, 576) 55296 ['block_10_project_BN[0][0]']
block_11_expand_BN (BatchNorma (None, 8, 8, 576) 2304 ['block_11_expand[0][0]']
lization)
block_11_expand_relu (ReLU) (None, 8, 8, 576) 0 ['block_11_expand_BN[0][0]']
block_11_depthwise (DepthwiseC (None, 8, 8, 576) 5184 ['block_11_expand_relu[0][0]']
onv2D)
block_11_depthwise_BN (BatchNo (None, 8, 8, 576) 2304 ['block_11_depthwise[0][0]']
rmalization)
block_11_depthwise_relu (ReLU) (None, 8, 8, 576) 0 ['block_11_depthwise_BN[0][0]']
block_11_project (Conv2D) (None, 8, 8, 96) 55296 ['block_11_depthwise_relu[0][0]']
block_11_project_BN (BatchNorm (None, 8, 8, 96) 384 ['block_11_project[0][0]']
alization)
block_11_add (Add) (None, 8, 8, 96) 0 ['block_10_project_BN[0][0]',
'block_11_project_BN[0][0]']
block_12_expand (Conv2D) (None, 8, 8, 576) 55296 ['block_11_add[0][0]']
block_12_expand_BN (BatchNorma (None, 8, 8, 576) 2304 ['block_12_expand[0][0]']
lization)
block_12_expand_relu (ReLU) (None, 8, 8, 576) 0 ['block_12_expand_BN[0][0]']
block_12_depthwise (DepthwiseC (None, 8, 8, 576) 5184 ['block_12_expand_relu[0][0]']
onv2D)
block_12_depthwise_BN (BatchNo (None, 8, 8, 576) 2304 ['block_12_depthwise[0][0]']
rmalization)
block_12_depthwise_relu (ReLU) (None, 8, 8, 576) 0 ['block_12_depthwise_BN[0][0]']
block_12_project (Conv2D) (None, 8, 8, 96) 55296 ['block_12_depthwise_relu[0][0]']
block_12_project_BN (BatchNorm (None, 8, 8, 96) 384 ['block_12_project[0][0]']
alization)
block_12_add (Add) (None, 8, 8, 96) 0 ['block_11_add[0][0]',
'block_12_project_BN[0][0]']
block_13_expand (Conv2D) (None, 8, 8, 576) 55296 ['block_12_add[0][0]']
block_13_expand_BN (BatchNorma (None, 8, 8, 576) 2304 ['block_13_expand[0][0]']
lization)
block_13_expand_relu (ReLU) (None, 8, 8, 576) 0 ['block_13_expand_BN[0][0]']
block_13_pad (ZeroPadding2D) (None, 9, 9, 576) 0 ['block_13_expand_relu[0][0]']
block_13_depthwise (DepthwiseC (None, 4, 4, 576) 5184 ['block_13_pad[0][0]']
onv2D)
block_13_depthwise_BN (BatchNo (None, 4, 4, 576) 2304 ['block_13_depthwise[0][0]']
rmalization)
block_13_depthwise_relu (ReLU) (None, 4, 4, 576) 0 ['block_13_depthwise_BN[0][0]']
block_13_project (Conv2D) (None, 4, 4, 160) 92160 ['block_13_depthwise_relu[0][0]']
block_13_project_BN (BatchNorm (None, 4, 4, 160) 640 ['block_13_project[0][0]']
alization)
block_14_expand (Conv2D) (None, 4, 4, 960) 153600 ['block_13_project_BN[0][0]']
block_14_expand_BN (BatchNorma (None, 4, 4, 960) 3840 ['block_14_expand[0][0]']
lization)
block_14_expand_relu (ReLU) (None, 4, 4, 960) 0 ['block_14_expand_BN[0][0]']
block_14_depthwise (DepthwiseC (None, 4, 4, 960) 8640 ['block_14_expand_relu[0][0]']
onv2D)
block_14_depthwise_BN (BatchNo (None, 4, 4, 960) 3840 ['block_14_depthwise[0][0]']
rmalization)
block_14_depthwise_relu (ReLU) (None, 4, 4, 960) 0 ['block_14_depthwise_BN[0][0]']
block_14_project (Conv2D) (None, 4, 4, 160) 153600 ['block_14_depthwise_relu[0][0]']
block_14_project_BN (BatchNorm (None, 4, 4, 160) 640 ['block_14_project[0][0]']
alization)
block_14_add (Add) (None, 4, 4, 160) 0 ['block_13_project_BN[0][0]',
'block_14_project_BN[0][0]']
block_15_expand (Conv2D) (None, 4, 4, 960) 153600 ['block_14_add[0][0]']
block_15_expand_BN (BatchNorma (None, 4, 4, 960) 3840 ['block_15_expand[0][0]']
lization)
block_15_expand_relu (ReLU) (None, 4, 4, 960) 0 ['block_15_expand_BN[0][0]']
block_15_depthwise (DepthwiseC (None, 4, 4, 960) 8640 ['block_15_expand_relu[0][0]']
onv2D)
block_15_depthwise_BN (BatchNo (None, 4, 4, 960) 3840 ['block_15_depthwise[0][0]']
rmalization)
block_15_depthwise_relu (ReLU) (None, 4, 4, 960) 0 ['block_15_depthwise_BN[0][0]']
block_15_project (Conv2D) (None, 4, 4, 160) 153600 ['block_15_depthwise_relu[0][0]']
block_15_project_BN (BatchNorm (None, 4, 4, 160) 640 ['block_15_project[0][0]']
alization)
block_15_add (Add) (None, 4, 4, 160) 0 ['block_14_add[0][0]',
'block_15_project_BN[0][0]']
block_16_expand (Conv2D) (None, 4, 4, 960) 153600 ['block_15_add[0][0]']
block_16_expand_BN (BatchNorma (None, 4, 4, 960) 3840 ['block_16_expand[0][0]']
lization)
block_16_expand_relu (ReLU) (None, 4, 4, 960) 0 ['block_16_expand_BN[0][0]']
block_16_depthwise (DepthwiseC (None, 4, 4, 960) 8640 ['block_16_expand_relu[0][0]']
onv2D)
block_16_depthwise_BN (BatchNo (None, 4, 4, 960) 3840 ['block_16_depthwise[0][0]']
rmalization)
block_16_depthwise_relu (ReLU) (None, 4, 4, 960) 0 ['block_16_depthwise_BN[0][0]']
block_16_project (Conv2D) (None, 4, 4, 320) 307200 ['block_16_depthwise_relu[0][0]']
block_16_project_BN (BatchNorm (None, 4, 4, 320) 1280 ['block_16_project[0][0]']
alization)
Conv_1 (Conv2D) (None, 4, 4, 1280) 409600 ['block_16_project_BN[0][0]']
Conv_1_bn (BatchNormalization) (None, 4, 4, 1280) 5120 ['Conv_1[0][0]']
out_relu (ReLU) (None, 4, 4, 1280) 0 ['Conv_1_bn[0][0]']
average_pooling2d_22 (AverageP (None, 1, 1, 1280) 0 ['out_relu[0][0]']
ooling2D)
flatten_9 (Flatten) (None, 1280) 0 ['average_pooling2d_22[0][0]']
dense_27 (Dense) (None, 256) 327936 ['flatten_9[0][0]']
dropout_9 (Dropout) (None, 256) 0 ['dense_27[0][0]']
dense_28 (Dense) (None, 64) 16448 ['dropout_9[0][0]']
dense_29 (Dense) (None, 3) 195 ['dense_28[0][0]']
==================================================================================================
Total params: 2,602,563
Trainable params: 344,579
Non-trainable params: 2,257,984
__________________________________________________________________________________________________

1301
train_model.ipynb Normal file

File diff suppressed because one or more lines are too long