2021-12-19 23:09:15 +01:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 1,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import os\n",
|
|
|
|
"import numpy as np\n",
|
|
|
|
"import tensorflow as tf\n",
|
|
|
|
"from tensorflow.keras.models import Sequential\n",
|
|
|
|
"from tensorflow.keras.layers import Dense, Dropout, Flatten, Activation, Conv2D, MaxPooling2D\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"from keras.preprocessing.image import ImageDataGenerator\n",
|
|
|
|
"from tensorflow.keras.optimizers import RMSprop\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"from tensorflow.keras.utils import plot_model\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"import matplotlib.image as mpimg\n",
|
|
|
|
"import keras_tuner as kt\n",
|
|
|
|
"import keras"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"## Konfiguracja"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 2,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"train_data_dir=\"./Trees\"\n",
|
|
|
|
"validation_data_dir=\"./Trees\"\n",
|
|
|
|
"batch_size=16\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"img_height, img_width = 60,80"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
2021-12-20 06:53:12 +01:00
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"## Generowanie zdjęć"
|
|
|
|
]
|
|
|
|
},
|
2021-12-19 23:09:15 +01:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 3,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"Found 759 images belonging to 3 classes.\n",
|
|
|
|
"Found 187 images belonging to 3 classes.\n"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"train_datagen = ImageDataGenerator(\n",
|
|
|
|
" rescale=1./255, \n",
|
|
|
|
" shear_range=0.2, # view images from various angles\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
" zoom_range=0.2,\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
" horizontal_flip=True, # randomly flip img horizontally\n",
|
|
|
|
" vertical_flip=True, # randomly flip img vertically\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
" validation_split=0.2) # set validation split\n",
|
|
|
|
"\n",
|
|
|
|
"train_generator = train_datagen.flow_from_directory(\n",
|
|
|
|
" train_data_dir,\n",
|
|
|
|
" target_size=(img_height, img_width),\n",
|
|
|
|
" batch_size=batch_size,\n",
|
|
|
|
" class_mode='categorical',\n",
|
|
|
|
" subset='training') # set as training data\n",
|
|
|
|
"\n",
|
|
|
|
"validation_generator = train_datagen.flow_from_directory(\n",
|
|
|
|
" validation_data_dir, # same directory as training data\n",
|
|
|
|
" target_size=(img_height, img_width),\n",
|
|
|
|
" batch_size=batch_size,\n",
|
|
|
|
" class_mode='categorical',\n",
|
|
|
|
" subset='validation')"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 4,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlYAAACqCAYAAABvagFUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9ebAtyX3fiX0ya686+zl3f/fdt/W+oLEQIEGApEiKi4YzlG1ZljVyyArFTMjhCXtCM+HROMKOCXtkK8bjCIc9M/ZoHLKkWSWZ0kgiRVGUCAgAiR2N3vv1W++767lnP6dO7ZXpP+q8168b3UADbKCb8P1G1L2ntqysrPxVffO3pdBac45znOMc5zjHOc5xjj885AddgXOc4xznOMc5znGOHxecE6tznOMc5zjHOc5xjvcJ58TqHOc4xznOcY5znON9wjmxOsc5znGOc5zjHOd4n3BOrM5xjnOc4xznOMc53iecE6tznOMc5zjHOc5xjvcJ58TqHOc4xznOcY5znON9wjmx+j4hhPizQohvCCFCIcSJEOK3hRCfeY/naiHEtR92Hd8PCCH+j0KIl4QQhRDiP/g+z31aCPE7QoihEOI8UdqPOc5l4j2d++eFEN8UQsyFEIdCiP9ICGH+kKp6jg8Y5zLxns79M0KI60KImRDiTAjxt4QQjR9SVX+kOCdW3weEEH8Z+L8B/ydgA7gI/GfAr3+A1fqe+AFf4DeB/w3wWz/AuTnwd4G/+AOce44/QjiXifcMH/i3gR7wKeAXgH/3ByjnHB9ynMvEe8bvAz+ttW4CVwAT+A9/gHI+fNBany/vYQGaQAj8j7/LMZ8EvgxMgRPgPwHs1b4vABpYrsr5n6y2/xrw7dU5fwA8+1B5HwOeBxbA3wP+DvAfPrT/36Dq2GPgHwHbD+3TwP8SuAHcAf5T4P/6tvr+Y+Df/h73/V8B/8EP2GbXqi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0juMiDYkQAqXVqr+UlKXGMA3QIKSgLApUqatra83qFtBao0qFYRoUeYHt2ORZ8aAFDUNiGAZlUVKqKrpbq/vh2wLDlEgpKEtFWVTnSyko8hLDlLiuh+PaGIZESklZKrTSFEVJnuXkWY5f8wHNfLagVArDqCqnlX5wPEKA1piWQa1eQxoSz/OIoog4SsiyHCkFaJBGVR/DMKrT0JS5QutqW7PZxLJNPM8niWPiJGE2W1CWVfsJIRBCo7V40Gk8z8EwJVmar/q+wLbN6j0oBEppbMdGo0milLIsq3YrS/zAxVm1a5rmq/cW2LZJluVkaY5pG1W75CVaQ5amFHnxfsrE95QHeKtMSCk/7vouQlTvco2m020RxynxMkFpDVohpMSQEmnI+2H9KKXvl4cQUJYKyzJWfVXi2BZJkiClxLRMsjTHtm1qNZ9wGZMmKUKIVR+u2ktrjes5OI6FNAQq1yAVQgpmkxAhJTW/juvYTKchmgKtSoqi6keWbSGFrN7FQiCERKvqHaRFVQ5CIDEwpIFWrN4H1flKl6hV/7RMGykNylJV/U5UciSkpCxLyjIDJKZpVm2nNW96ASmkrORB66L6NgoT07LQWlMW1XWkkEhpICQopVBaIcR93UwlD2VZVnK9avtKliVCQlkUaKHQaGzTochLsrx48P7RaAzTxLHtBzJdPasCYUiyLAcNZV6itcZYvWeqb3VVJykFlmUipECK6ktY5CWqVJhW1adLpbl/82+2gX7wfLWu2leu5Oh+txQC7rvyS9MgjRPyLH9HmfhhEatD3pr99QJVBtgH0Fr/daq8FXi+p3evbsDDn5BKeh5sEkJgWBZCGGilKIusIkKrljEMk2ZvA9utMz47IssSVFki0Ag0UggMw0BKSa3Vo8gVhZZYliQO59SbbRSSNE2RwGJyvErKIeDhzo+g1egQNC/Q2X6OUf8m0/512utX8Gpr1Fo7HN34F9R714jDMf17X8ert0m
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 720x360 with 3 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},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Wj/2oKofewC1tmtqjG3Pu4IxVx9RyDm1Pch1TyLX3xtqVYwR6pvnpp0X5uP792Yv1+dA3+y/AoIx7WTf+H7zo3bc1zvX9vep37z5+5Mzbb+r9ZPzN8Z82/V7c23eXANjTPOH60b06id6Pf4356JVMdZ8+3V983uR67uH6zP6yedvrsOb2/hmda0Vru+KN9dTVRHz6bP5tMkv9uG/47f6HcegtVJrew/WUq6fvXkvCuXqP7XUNw8KIJSccc5yulyYLpfvp0/8kv4A/85xYhe6j38o0sYKAJXre0sEMRajtPvP1TeAak17ZlQxpX7sB1zfO6qAde39eTWjHz9lfDJKCNR63V5b983TaBBsrWgtqLFUATH242fV5PzxeKa1Xt/JoNai0vZHqejHL0GhGouU8sm783r11Lg2RihovW7XmE+eW0Bzbsdm7XWcamOZGHM9Xm3vQSMf3xIRQWNs31/HMCvm42epou2YRa7bNW3/b26rvHknNI+1taJa23loRY391I3+ZCwFxUi7Du29cB03rmPNx3dABGsM5XpvBGn34DtfjbXC9V6KSDsXoJbStvQm3iiljS9vjkcEcvnkcXzzPNSKOH/1DVjXhZjzL+oTP6jA6ht8u/rrj9EUYD82Vf2HaboVPBtH/ff/e/59nLvhOvCBiINasLWQagXfUbXijHAMnnmdqAg5x+ZAtkN8h5SV7XJ/faose99xXGcizQnPt29TKfTbzHg5k33HY+cxVlAM1Q34muitZTOGqobj+YSPG+fDkSiCpJna75Dabo6qYqdHTEqocxgXKJ1nXyzl8hrjeoZuz2KEizdUgf3lET+f2YyjIthcWHcjmxXE7+hqIaihbhOhVpJxGC3U3R7GG4YlUj/8ebJA2u0w/YDmiDGWZB25FlQ
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 720x360 with 3 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSU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DkF30EKg5E+mVG4KiaOklGfNBlKKbT0qBQkQQJK5ERxhm1bFFRCewgIhTQRwqQ4tiKlgC1zLJVTrBQYdPoAhInAdyTlokUc5wyjjDQDQYoWLkmSjvouoJREmgyERBuBEKCEpuTbGGETJpochyyLcaQmiUMsywbLx/UUg0FKEke4MgNlUyj4mCxBCU0/zBAChFS3nxsCjNZoWURLD2kSjAEjnbfxWt/uEd/5IAE4SqOUIM81eRKAyUZtNdmbeo8ZfWwAkGi7CtJB6xxpMiQJeRKDAGl5oHNEHoxqGhBCIpSFMfnoe4fCcRR5mmD0iLvcD1KiJP9eysSfKg/wrTIhhHjAdV2ElBhtRmcwIJSFlKNvt9Y5htE3UykbRYKyXbQq3T6nzlOSoINtCWxlkFKgZQEjPUDiqZhGOacX2QyCnDTNiKMAKSXGGKSU+MUSSZww2bDZb0WkaYrvOcRJSq5Ht6d1jpQKYzRCyDfuhzeyHGitRw9BAEaDGH0fa2WbesUmjnPiKEVIgbRcwiilVFRYhQrN/SEiG2KMQZvRN1oqhSVhNBJqtAYhD2wn0sXoGEsJjHDIck2a5ijbweQJtgLXEiglSDIoOIYs1wxjA9JB6BisEkgblH8wNpqDxguMydFZiDQpwnJBeiC+k91GfMdfJu1hkh6iMI2Q30ktGb3scNghiwMEAqks8iwBqQ5OMhq3HAtSrfBKY0hlH4jG6Eomj9BRC/JkNA4fvA9hIMnBcktIk6BIQUikVIBGWAU0Ch22AIFQiv4wIozS7ygT3y/Fap1vzf46zygD7G0YY36JUd4KJsdr5i996F48OyFODO2+5s7zd3Dy3vv41V/5DMcmFHncYWZ2ksl
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 720x360 with 3 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"def plot_image(fname, label, col):\n",
|
|
|
|
" img = mpimg.imread(train_data_dir + '/' + fname)\n",
|
|
|
|
" plt.subplot(1,3,col)\n",
|
|
|
|
" plt.title(label)\n",
|
|
|
|
" plt.imshow(img)\n",
|
|
|
|
" \n",
|
|
|
|
"plt.figure(figsize=(10,5))\n",
|
|
|
|
"cat1_files = ['AS12_7/18.png','AS12_7/103.png','AS12_7/225.png']\n",
|
|
|
|
"for idx, f in enumerate(cat1_files):\n",
|
|
|
|
" plot_image(f, f'Category 1: {idx+1}', idx + 1)\n",
|
|
|
|
"plt.show()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure(figsize=(10,5))\n",
|
|
|
|
"cat2_files = ['EA01a/15.png','EA01a/5.png','EA01a/12.png']\n",
|
|
|
|
"for idx, f in enumerate(cat2_files):\n",
|
|
|
|
" plot_image(f, f'Category 2: {idx+1}', idx + 1)\n",
|
|
|
|
"plt.show()\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure(figsize=(10,5))\n",
|
|
|
|
"cat3_files = ['EU43_6/135.png','EU43_6/195.png','EU43_6/16.png']\n",
|
|
|
|
"for idx, f in enumerate(cat3_files):\n",
|
|
|
|
" plot_image(f, f'Category 2: {idx+1}', idx + 1)\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"## CNN"
|
2021-12-20 04:58:55 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 5,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"model = Sequential()\n",
|
|
|
|
"\n",
|
|
|
|
"model.add(Conv2D(32, (3,3), activation='relu', input_shape=(img_height, img_width, 3)))\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.add(MaxPooling2D((2,2)))\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.add(Conv2D(64, (3,3), activation='relu'))\n",
|
|
|
|
"model.add(MaxPooling2D((2,2)))\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.add(Conv2D(64, (3,3), activation='relu'))\n",
|
|
|
|
"model.add(MaxPooling2D((2,2)))\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.add(Flatten())\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.add(Dense(512, activation='relu'))\n",
|
|
|
|
"model.add(Dense(512, activation='relu'))\n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.add(Dense(3, activation='softmax'))"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 6,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
2021-12-20 06:53:12 +01:00
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlQAAAScCAIAAADCkYadAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nOy9X2wb15n/fcaxg269LbVuVspfJygKu2lQKGgBR27RGFa0COzF0OhGskXXTLoL2qCADeBEvKgNEoJXgpICZGJgC0SghF1oBYSS4isSrW9MAtKFyRZoSu7W2FgXgqk6RjlJG7LBLop4m/ldPK/Oe3KGHA7/zZCc7+dC4JyZeeY5Z6jz8JzznOdRdF1nAAAAgJvY47QCAAAA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++3Vpo0ul2KiFGL1o2f+ZewVr2MrWGSFI0/SPpCmgPjB3odtxs/+i1f9ZSUgJisETeNJh0WdeK8h0qn08bcyqqqStF6quY77qjxa+VGi8rYpo8VDYvFIg+lTyX0pmhcpet6NBrlhrBqHhaLDxK1atH4mX8Ja9WrlpKUFE2sMsf4hTRnfHzc2D4A9BauDm+m1I6FYzwllkhnpUNayqLBXCQSkVwxV1dXP/300/Pnz1t/nPVamCjWdI2sa2Iup3P61NVwcXGR8sgcPnxYvHJqamphYYGMyk9+8hPuZFtLYKNNYSW8WSs1rVovEyW3trakFmA1vpDmTExM3L1797XXXrN+S29x5syZixcvHj161GlFQKd4++23H3/8cftCYHbYuP7/NDTyM47M+CkxaiqrvawiHdKkWTabLRaL0joK/fo2Ps7YPtZbTLzSRLGqj7BSo4benXnLdEifWhqSNHodNKqTruTD9GQyKQ596DLj8lijTdHiyM/8S1irXuZKGlugidDPmPYEvY7N3+Gu8/akzmVhYYEc4WjPL51qOsMWY4xykSwvL9+8efP555/n5Zq
|
|
|
|
"text/plain": [
|
|
|
|
"<IPython.core.display.Image object>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 6,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
2021-12-19 23:09:15 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2021-12-20 04:59:37 +01:00
|
|
|
"plot_model(model, to_file='model1_plot.png', show_shapes=True,show_dtype=True, show_layer_names=True, expand_nested=True,)"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 7,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"Model: \"sequential\"\n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
|
|
|
"Layer (type) Output Shape Param # \n",
|
|
|
|
"=================================================================\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"conv2d (Conv2D) (None, 58, 78, 32) 896 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"max_pooling2d (MaxPooling2D) (None, 29, 39, 32) 0 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"conv2d_1 (Conv2D) (None, 27, 37, 64) 18496 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"max_pooling2d_1 (MaxPooling2 (None, 13, 18, 64) 0 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"conv2d_2 (Conv2D) (None, 11, 16, 64) 36928 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"max_pooling2d_2 (MaxPooling2 (None, 5, 8, 64) 0 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"flatten (Flatten) (None, 2560) 0 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"dense (Dense) (None, 512) 1311232 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"dense_1 (Dense) (None, 512) 262656 \n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"_________________________________________________________________\n",
|
2021-12-20 06:53:12 +01:00
|
|
|
"dense_2 (Dense) (None, 3) 1539 \n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"=================================================================\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
"Total params: 1,631,747\n",
|
|
|
|
"Trainable params: 1,631,747\n",
|
2021-12-19 23:09:15 +01:00
|
|
|
"Non-trainable params: 0\n",
|
|
|
|
"_________________________________________________________________\n",
|
|
|
|
"None\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"print(model.summary())"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 8,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2021-12-20 04:59:37 +01:00
|
|
|
"model.compile(optimizer=RMSprop(learning_rate=0.0001),\n",
|
|
|
|
" loss=tf.keras.losses.CategoricalCrossentropy(),\n",
|
2021-12-19 23:09:15 +01:00
|
|
|
" metrics=['accuracy'])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 9,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {
|
|
|
|
"scrolled": false
|
|
|
|
},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"Epoch 1/16\n",
|
|
|
|
"48/48 [==============================] - 21s 419ms/step - loss: 0.8317 - accuracy: 0.6440 - val_loss: 0.7841 - val_accuracy: 0.8125\n",
|
|
|
|
"Epoch 2/16\n",
|
|
|
|
"48/48 [==============================] - 18s 376ms/step - loss: 0.6134 - accuracy: 0.7810 - val_loss: 0.3542 - val_accuracy: 0.8438\n",
|
|
|
|
"Epoch 3/16\n",
|
|
|
|
"48/48 [==============================] - 18s 377ms/step - loss: 0.4492 - accuracy: 0.8211 - val_loss: 0.2147 - val_accuracy: 0.9531\n",
|
|
|
|
"Epoch 4/16\n",
|
|
|
|
"48/48 [==============================] - 18s 367ms/step - loss: 0.2990 - accuracy: 0.9016 - val_loss: 0.4539 - val_accuracy: 0.8125\n",
|
|
|
|
"Epoch 5/16\n",
|
|
|
|
"48/48 [==============================] - 18s 379ms/step - loss: 0.2767 - accuracy: 0.8925 - val_loss: 0.0954 - val_accuracy: 0.9531\n",
|
|
|
|
"Epoch 6/16\n",
|
|
|
|
"48/48 [==============================] - 17s 364ms/step - loss: 0.2011 - accuracy: 0.9363 - val_loss: 0.1089 - val_accuracy: 0.9688\n",
|
|
|
|
"Epoch 7/16\n",
|
|
|
|
"48/48 [==============================] - 17s 362ms/step - loss: 0.2036 - accuracy: 0.9311 - val_loss: 0.0708 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 8/16\n",
|
|
|
|
"48/48 [==============================] - 17s 361ms/step - loss: 0.1124 - accuracy: 0.9751 - val_loss: 0.5785 - val_accuracy: 0.7500\n",
|
|
|
|
"Epoch 9/16\n",
|
|
|
|
"48/48 [==============================] - 17s 360ms/step - loss: 0.1146 - accuracy: 0.9699 - val_loss: 0.0354 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 10/16\n",
|
|
|
|
"48/48 [==============================] - 16s 341ms/step - loss: 0.1671 - accuracy: 0.9596 - val_loss: 0.0151 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 11/16\n",
|
|
|
|
"48/48 [==============================] - 16s 327ms/step - loss: 0.0743 - accuracy: 0.9792 - val_loss: 0.0216 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 12/16\n",
|
|
|
|
"48/48 [==============================] - 16s 332ms/step - loss: 0.0752 - accuracy: 0.9779 - val_loss: 0.0099 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 13/16\n",
|
|
|
|
"48/48 [==============================] - 16s 328ms/step - loss: 0.1131 - accuracy: 0.9679 - val_loss: 0.0610 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 14/16\n",
|
|
|
|
"48/48 [==============================] - 15s 318ms/step - loss: 0.1129 - accuracy: 0.9591 - val_loss: 0.0253 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 15/16\n",
|
|
|
|
"48/48 [==============================] - 16s 329ms/step - loss: 0.0445 - accuracy: 0.9877 - val_loss: 0.0213 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 16/16\n",
|
|
|
|
"48/48 [==============================] - 17s 346ms/step - loss: 0.0665 - accuracy: 0.9746 - val_loss: 0.0353 - val_accuracy: 0.9844\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"history = model.fit(train_generator, epochs=16, verbose=1,\n",
|
|
|
|
" validation_data = validation_generator, validation_steps = 4)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 10,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<matplotlib.legend.Legend at 0x17d175c4e20>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 10,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAA6HUlEQVR4nO3deXxU9bn48c+TPSQhCRASwg6yBULYBCuyCO6iQOuCWq/aitdWrdXbarW12tve/npvd+uKu7cu9Sqi4o5rF0VWScImsiYhIYQsBLLn+f1xJiGEhEySOZlJ5nm/XrySOXPmnCcTcp45z3cTVcUYY0zwCvF3AMYY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CZEk9w7ioiwnrvwYGiIEB8d7t17fhLVtfWNiaTMkyzCQoQJA+OJCg/1UbTdhyUC466KYtjqmYFx50fOxT9hKHzjZmdulQGT3JlzJyTU+fTd0HffCzV19XyyrZDlG3JYtfkA1XX1nNI/lh+fO4ZpQxNJS+1NXFQHL0D5mT4fPyAi9ImJoE9MRNs7m+NEhIXQJ8zeuwaWCIzvVZQcm37364+c2n/CEPjGTc68L6mTu2bCtZQJkPmK0w7RyvlUlazcMl5Zn8MbX+ZRdKSaPjERXDljCN+aMogJA3t3uuGR6iPOQKj0yzp3HGNcYonA+EZlKWx727n47/jAufjHD4HTbnSG/qdO6frZNlPSnakpSvaeMA5hf2kFKzbksXx9Dl8dKCciNISz0vrzzcmDmDMmybeNgQWbAT024tmYAGOJwHRcZdmxi//XH0BdNcQPhhn/DuO/CQP9cPFvqmmDceJQjlTV8m52PsvX5/LPrw+iClOHJvJfiyewID2V+F4urR7VMD+OTS1hApQlAtM+lWWw/Z1jn/z
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 432x288 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"plt.plot(history.history['accuracy'], label='accuracy')\n",
|
|
|
|
"plt.plot(history.history['val_accuracy'], label = 'val_accuracy')\n",
|
|
|
|
"plt.xlabel('Epoch')\n",
|
|
|
|
"plt.ylabel('Accuracy')\n",
|
|
|
|
"plt.ylim([0.5, 1])\n",
|
|
|
|
"plt.legend(loc='lower right')"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"## CNN + hyperparameter tuning"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 15,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"def build_model(hp):\n",
|
|
|
|
" inputs = keras.Input(shape=(img_height, img_width, 3))\n",
|
|
|
|
" x = inputs\n",
|
|
|
|
" for i in range(hp.Int(\"cnn_layers\", 1, 3)):\n",
|
|
|
|
" x = Conv2D(\n",
|
|
|
|
" hp.Int(f\"filters_{i}\", 32, 128, step=32),\n",
|
|
|
|
" kernel_size=(3, 3),\n",
|
|
|
|
" activation=\"relu\",\n",
|
|
|
|
" )(x)\n",
|
|
|
|
" x = MaxPooling2D(pool_size=(2, 2))(x)\n",
|
|
|
|
" x = Flatten()(x)\n",
|
|
|
|
"\n",
|
|
|
|
" # A hyperparamter for whether to use dropout layer.\n",
|
|
|
|
" if hp.Boolean(\"dropout\"):\n",
|
|
|
|
" x = Dropout(0.5)(x)\n",
|
|
|
|
"\n",
|
|
|
|
" outputs = Dense(units=3, activation=\"softmax\")(x)\n",
|
|
|
|
" model = keras.Model(inputs=inputs, outputs=outputs)\n",
|
|
|
|
"\n",
|
|
|
|
" # Compile the model.\n",
|
|
|
|
" model.compile(\n",
|
|
|
|
" optimizer=RMSprop(learning_rate=0.0001),\n",
|
|
|
|
" loss=tf.keras.losses.CategoricalCrossentropy(),\n",
|
|
|
|
" metrics=['accuracy'],\n",
|
|
|
|
" )\n",
|
|
|
|
" return model\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 17,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"hp = kt.HyperParameters()\n",
|
|
|
|
"model = build_model(hp)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 18,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUg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dfZdXOkrPP2HE0gbvwOu+xLaWPCrMnVUHqqS6nOaLEJG280v453aUfMa0hLSBhfScsw8hUxisUiT5/WKEcavV1aDqORjgQ/8zRvjXbNeEBMkqLxDxLDqpU6u+7CYR2Cnx+48Tvssi9lV4NfO280ISbN6k3wa2dHrNSwXC7zdfRpC4VbvqfJZJIHwkY50lo6FB0JfuZp3hrtWqN6NkqKpuu6qqrG5aOa1hnA1VwX/BTdVf/3lpeXT5482bTOdL+HXib+bf5UO29sJJ/PB4NBvvKs9TeaV6B7O9K0hul0mpLIPPPMM+IrJycn5+bmKKL88z//89WrV80LbOlQWDzvbe5s3V0zqefm5qZ0EBhj2Wz2iy++OHv2rJX94tU4f/78oUOHrL/FRTY2Nq5cuUI/X8CrTp48ubS0dOLECacr0ooeBNgO6kHLr9HNHvM3mtfE3mE3qUD3dqRR9ag06sOkVp30Smr8ZTKZXC4ntnvoZcZ7Yy19/TrS8qM2qLh0r3iUGu2aeT2NB8HG6s/Mhb+arUO3px+48TvswdGetnUj1Zl0uPnGDn6EUcd3pFAoHD58mO3k2OQNWVEwGIxGo+FwOJ1Oi6MibeRI6xLzNG8mu9aIlBRN07Rbt27xCaalUolyAwFAH/Jg8Ot9qjPbTKY68KrymNGDHam7AmShUDh06NCzzz7LX7+9vc2nUohvOXPmDDMM+q+bI61LS03yFSCpetLKliZp3kx2TTxEJknRNE2LRCKxWIxP/Hj++eddkTMWwKecaG7aZ6ULxWR
|
|
|
|
"text/plain": [
|
|
|
|
"<IPython.core.display.Image object>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 18,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"plot_model(model, to_file='model2_plot.png', show_shapes=True,show_dtype=True, show_layer_names=True, expand_nested=True,)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 19,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"Epoch 1/16\n",
|
|
|
|
"48/48 [==============================] - 17s 342ms/step - loss: 0.7536 - accuracy: 0.6303 - val_loss: 0.5446 - val_accuracy: 0.9375\n",
|
|
|
|
"Epoch 2/16\n",
|
|
|
|
"48/48 [==============================] - 18s 369ms/step - loss: 0.4898 - accuracy: 0.8538 - val_loss: 0.3223 - val_accuracy: 0.9531\n",
|
|
|
|
"Epoch 3/16\n",
|
|
|
|
"48/48 [==============================] - 17s 362ms/step - loss: 0.3330 - accuracy: 0.8921 - val_loss: 0.1827 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 4/16\n",
|
|
|
|
"48/48 [==============================] - 18s 380ms/step - loss: 0.2685 - accuracy: 0.9094 - val_loss: 0.2703 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 5/16\n",
|
|
|
|
"48/48 [==============================] - 19s 403ms/step - loss: 0.2051 - accuracy: 0.9460 - val_loss: 0.2149 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 6/16\n",
|
|
|
|
"48/48 [==============================] - 19s 403ms/step - loss: 0.1838 - accuracy: 0.9561 - val_loss: 0.1424 - val_accuracy: 0.9531\n",
|
|
|
|
"Epoch 7/16\n",
|
|
|
|
"48/48 [==============================] - 19s 394ms/step - loss: 0.1609 - accuracy: 0.9720 - val_loss: 0.1484 - val_accuracy: 0.9688\n",
|
|
|
|
"Epoch 8/16\n",
|
|
|
|
"48/48 [==============================] - 19s 404ms/step - loss: 0.1325 - accuracy: 0.9680 - val_loss: 0.0957 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 9/16\n",
|
|
|
|
"48/48 [==============================] - 19s 406ms/step - loss: 0.1129 - accuracy: 0.9808 - val_loss: 0.1412 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 10/16\n",
|
|
|
|
"48/48 [==============================] - 19s 401ms/step - loss: 0.1178 - accuracy: 0.9695 - val_loss: 0.0513 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 11/16\n",
|
|
|
|
"48/48 [==============================] - 20s 408ms/step - loss: 0.0963 - accuracy: 0.9795 - val_loss: 0.0421 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 12/16\n",
|
|
|
|
"48/48 [==============================] - 18s 387ms/step - loss: 0.0932 - accuracy: 0.9893 - val_loss: 0.0515 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 13/16\n",
|
|
|
|
"48/48 [==============================] - 20s 416ms/step - loss: 0.0915 - accuracy: 0.9801 - val_loss: 0.1114 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 14/16\n",
|
|
|
|
"48/48 [==============================] - 17s 356ms/step - loss: 0.0663 - accuracy: 0.9935 - val_loss: 0.0428 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 15/16\n",
|
|
|
|
"48/48 [==============================] - 17s 360ms/step - loss: 0.0889 - accuracy: 0.9767 - val_loss: 0.0825 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 16/16\n",
|
|
|
|
"48/48 [==============================] - 17s 347ms/step - loss: 0.0807 - accuracy: 0.9835 - val_loss: 0.0292 - val_accuracy: 1.0000\n"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"history = model.fit(train_generator, verbose=1, epochs=16,\n",
|
2021-12-20 04:59:37 +01:00
|
|
|
" validation_data = validation_generator, validation_steps = 4)"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 20,
|
2021-12-19 23:09:15 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
2021-12-20 04:59:37 +01:00
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
2021-12-20 06:53:12 +01:00
|
|
|
"<matplotlib.legend.Legend at 0x17d1769efd0>"
|
2021-12-20 04:59:37 +01:00
|
|
|
]
|
|
|
|
},
|
2021-12-20 06:53:12 +01:00
|
|
|
"execution_count": 20,
|
2021-12-20 04:59:37 +01:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
2021-12-20 06:53:12 +01:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAtKElEQVR4nO3deXxV9bnv8c+TARICJAwBmUFkFlGI4FAFpSIqiraOx9pKqx691WP1tNrqseppT29vh9trj9PBU7W2DqfFWVGcoa3WMkqYQcZAgBDISEKm5/6xdsImJLAD2dlJ9vf9euWVvdZea+0nCfy+a/3WWr9l7o6IiMSvhFgXICIisaUgEBGJcwoCEZE4pyAQEYlzCgIRkTinIBARiXNRCwIze9rMdpvZikbeNzP7rZltMLPlZjY+WrWIiEjjonlE8Cww/QjvXwQMC33dAjwRxVpERKQRUQsCd18A7D3CIjOB5zzwdyDDzPpEqx4REWlYUgw/ux+wLWw6JzQvt/6CZnYLwVEDaWlpE0aOHNkiBYq0WgdKoHwflBVCTWWsq4lccidIzYCUDEjqGNtaKvdDWQGUF0DVgWCeJUBKelBfStdgOla8BsqLgr9zeVEwnZYJ6f2PaXOLFy/e4+6ZDb0XyyCwBuY1ON6Fu88GZgNkZWX5okWLolmXSOtTUw1bP4OVr8Gq16F0NySlwvBrYMwV0G9CbButo6ncD+vmwcpXYfsioAj6nApjLofRl0P3IdGvwR12Lg9qWPka7NsOlggnTg/qSB8Aq9+E1W9AaR4kl8LwC4Pf70kXQIdO0a+xohTWvxf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CAcGGnhf74Y1FWiE
|
2021-12-20 04:59:37 +01:00
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 432x288 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
2021-12-19 23:09:15 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2021-12-20 04:59:37 +01:00
|
|
|
"plt.plot(history.history['accuracy'], label='accuracy')\n",
|
|
|
|
"plt.plot(history.history['val_accuracy'], label = 'val_accuracy')\n",
|
|
|
|
"plt.xlabel('Epoch')\n",
|
|
|
|
"plt.ylabel('Accuracy')\n",
|
|
|
|
"plt.ylim([0.5, 1])\n",
|
|
|
|
"plt.legend(loc='lower right')"
|
2021-12-19 23:09:15 +01:00
|
|
|
]
|
|
|
|
},
|
2021-12-20 06:53:12 +01:00
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# MLP"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 21,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"model = Sequential()\n",
|
|
|
|
"model.add(Flatten(input_shape=(img_height, img_width, 3), name=\"Input_layer\"))\n",
|
|
|
|
"model.add(Dense(350, activation='relu'))\n",
|
|
|
|
"model.add(Dense(50, activation='relu'))\n",
|
|
|
|
"model.add(Dense(3, activation='softmax'))"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 22,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAIECAYAAADsLa/XAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO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o7xpYmxl7O5RKpYJQKIRoNGoMpKNpGiqVipEmn88bj43Nw0k7PfK3L1NV1fhl5kX1gPyilduSAyDJQYXky/yL0bzOfIxyeTQaNR6Hm49d13XMzMz01P7FXr7DUt79tuMZlvz3YtivkV61K7N2dF1HqVQy0uXz+ZaGrO3KCHA+B/aGh3JgM/Ngae3mmeHw/0R7WA+D0nQE2wA4coAnmAZGklOGJ5NJy3vMaczTpctp3+UAS+btm6cfb5eHneRf5qHRaLTkWw4EJP82UxTFGCCo0WgYA1sJ8WSqevMAWfLYq9Wq4/baMb/f/ref5e12kK5hvl7cXkfDfo30O2ie0/E7LVMUReRyOctxKIpiGRysUxm1265kHrxMnlsnzWbTMphcLzhIqHschJH81mnQvIEFM26XOaWRI1mqqrrjbfWbfzkSYrv1qqoKAJbRIavVqnFTEkKIYrHomGd5s5fbdBoZsp88B7m8hyn/bo9r2K+RQQYzMugyj+wpAzjz8XUro3ZlbQ4+7efWbnV1tSWIcovBjHsMZshvgQtm3KYb9M1ViO0vVXlTMq+XN1D5y1SI7ZuX+cZl/mVtf+00v07vD3p5D0v+ez2uYb1GBhnMyCcuZvIJidNQ6O3KqNvxVatV4+mMuRzNFEVpO5x6N/L7ji+++ArOy4F30xk4DU3sZlm7IY3dpHO7rX7zn8/njWnnX3rppZb1MzMzWFx
|
|
|
|
"text/plain": [
|
|
|
|
"<IPython.core.display.Image object>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 22,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"plot_model(model, to_file='model3_plot.png', show_shapes=True,show_dtype=True, show_layer_names=True, expand_nested=True,)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 23,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"model.compile(\n",
|
|
|
|
" optimizer=RMSprop(learning_rate=0.0001),\n",
|
|
|
|
" loss=tf.keras.losses.CategoricalCrossentropy(),\n",
|
|
|
|
" metrics=['accuracy'],\n",
|
|
|
|
" )"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:58 +01:00
|
|
|
"execution_count": 24,
|
2021-12-20 06:53:12 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"Epoch 1/16\n",
|
|
|
|
"48/48 [==============================] - 19s 388ms/step - loss: 1.2904 - accuracy: 0.5216 - val_loss: 0.6917 - val_accuracy: 0.6562\n",
|
|
|
|
"Epoch 2/16\n",
|
|
|
|
"48/48 [==============================] - 19s 404ms/step - loss: 0.6465 - accuracy: 0.7112 - val_loss: 0.7890 - val_accuracy: 0.6719\n",
|
|
|
|
"Epoch 3/16\n",
|
|
|
|
"48/48 [==============================] - 18s 383ms/step - loss: 0.5448 - accuracy: 0.7737 - val_loss: 0.4680 - val_accuracy: 0.8594\n",
|
|
|
|
"Epoch 4/16\n",
|
|
|
|
"48/48 [==============================] - 18s 368ms/step - loss: 0.4313 - accuracy: 0.8452 - val_loss: 0.5577 - val_accuracy: 0.7500\n",
|
|
|
|
"Epoch 5/16\n",
|
|
|
|
"48/48 [==============================] - 24s 501ms/step - loss: 0.4464 - accuracy: 0.8121 - val_loss: 0.2900 - val_accuracy: 0.7969\n",
|
|
|
|
"Epoch 6/16\n",
|
|
|
|
"48/48 [==============================] - 21s 438ms/step - loss: 0.3362 - accuracy: 0.8622 - val_loss: 0.2690 - val_accuracy: 0.7969\n",
|
|
|
|
"Epoch 7/16\n",
|
|
|
|
"48/48 [==============================] - 20s 426ms/step - loss: 0.3143 - accuracy: 0.8954 - val_loss: 0.3525 - val_accuracy: 0.8438\n",
|
|
|
|
"Epoch 8/16\n",
|
|
|
|
"48/48 [==============================] - 20s 426ms/step - loss: 0.2822 - accuracy: 0.9002 - val_loss: 0.2506 - val_accuracy: 0.9688\n",
|
|
|
|
"Epoch 9/16\n",
|
|
|
|
"48/48 [==============================] - 19s 398ms/step - loss: 0.2282 - accuracy: 0.9134 - val_loss: 0.3262 - val_accuracy: 0.9219\n",
|
|
|
|
"Epoch 10/16\n",
|
|
|
|
"48/48 [==============================] - 20s 409ms/step - loss: 0.1698 - accuracy: 0.9452 - val_loss: 0.3116 - val_accuracy: 0.9375\n",
|
|
|
|
"Epoch 11/16\n",
|
|
|
|
"48/48 [==============================] - 20s 409ms/step - loss: 0.2168 - accuracy: 0.9184 - val_loss: 0.2565 - val_accuracy: 0.9062\n",
|
|
|
|
"Epoch 12/16\n",
|
|
|
|
"48/48 [==============================] - 20s 409ms/step - loss: 0.2145 - accuracy: 0.9224 - val_loss: 0.1434 - val_accuracy: 1.0000\n",
|
|
|
|
"Epoch 13/16\n",
|
|
|
|
"48/48 [==============================] - 20s 425ms/step - loss: 0.2573 - accuracy: 0.9295 - val_loss: 0.1047 - val_accuracy: 0.9688\n",
|
|
|
|
"Epoch 14/16\n",
|
|
|
|
"48/48 [==============================] - 19s 405ms/step - loss: 0.1623 - accuracy: 0.9460 - val_loss: 0.1506 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 15/16\n",
|
2021-12-20 06:53:58 +01:00
|
|
|
"48/48 [==============================] - 19s 395ms/step - loss: 0.1781 - accuracy: 0.9512 - val_loss: 0.0769 - val_accuracy: 0.9844\n",
|
|
|
|
"Epoch 16/16\n",
|
|
|
|
"48/48 [==============================] - 18s 383ms/step - loss: 0.2260 - accuracy: 0.9164 - val_loss: 0.2339 - val_accuracy: 0.9844\n"
|
2021-12-20 06:53:12 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"history = model.fit(train_generator, verbose=1, epochs=16,\n",
|
|
|
|
" validation_data = validation_generator, validation_steps = 4)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-12-20 06:53:58 +01:00
|
|
|
"execution_count": 25,
|
2021-12-20 06:53:12 +01:00
|
|
|
"metadata": {},
|
2021-12-20 06:53:58 +01:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<matplotlib.legend.Legend at 0x17d195eb6d0>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 25,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAA5JklEQVR4nO3dd3zV9fX48dfJIBNCWCFhBZA9whJUFBUcWEFERLDWQVXUWuuoq9ZZW2u/1p/VarVYFa2iVRBF3CBTESHI3iNACCMESAhk5/z++NyEEDJuwr25N7nn+Xjkkfv53M84SeBz7nuLqmKMMSZwBfk6AGOMMb5licAYYwKcJQJjjAlwlgiMMSbAWSIwxpgAZ4nAGGMCnNcSgYi8KSIHRGRtJe+LiLwkIltFZLWIDPBWLMYYYyrnzRLBVGBkFe9fBnRxfU0GXvViLMYYYyrhtUSgqguBQ1UcMgZ4Rx0/Ak1FJN5b8RhjjKlYiA/v3QbYXWY71bVvb/kDRWQyTqmBqKiogd27d6+TAI0xHpCbBYe2QXAoxLSH8Ca+jiggJScnH1TVlhW958tEIBXsq3C+C1WdAkwBGDRokC5fvtybcRljPEUVXh8O2aEQ1hjSN0C/i2HkMxAe4+voAoqI7KzsPV/2GkoF2pXZbguk+SgWY4w3bPkW0lbA+Q/CbQvg3Ptg1TT419mwdY6vozMuvkwEs4AbXL2Hzg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MyezFwmDGrHw5d1Jzaqisbs4mL4aYqT3EIawWX/B30nnF5113/HOm0f96w5db1g41VpR3KY+kMK05buYtLQRH5/Se1WyrNEYExVts6Fd6+C8VOdtW69Yc8KeOdKiIx1kkFM2xO
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 432x288 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
2021-12-20 06:53:12 +01:00
|
|
|
"source": [
|
|
|
|
"plt.plot(history.history['accuracy'], label='accuracy')\n",
|
|
|
|
"plt.plot(history.history['val_accuracy'], label = 'val_accuracy')\n",
|
|
|
|
"plt.xlabel('Epoch')\n",
|
|
|
|
"plt.ylabel('Accuracy')\n",
|
|
|
|
"plt.ylim([0.5, 1])\n",
|
|
|
|
"plt.legend(loc='lower right')"
|
|
|
|
]
|
|
|
|
},
|
2021-12-19 23:09:15 +01:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "Python 3",
|
|
|
|
"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",
|
2021-12-20 06:53:12 +01:00
|
|
|
"version": "3.8.5"
|
2021-12-19 23:09:15 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 5
|
|
|
|
}
|