wko-on-cloud-n/research/unet.ipynb
Maciej Sobkowiak 59fe53fa40 adsdfasdga
2022-02-17 03:04:00 +01:00

293 lines
40 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import shutil\n",
"import tensorflow as tf\n",
"from tensorflow.keras import backend as K\n",
"from tensorflow.keras.layers import Activation, Lambda, GlobalAveragePooling2D, concatenate\n",
"from tensorflow.keras.layers import UpSampling2D, Conv2D, Dropout, MaxPooling2D, Conv2DTranspose\n",
"from tensorflow.keras.layers import Dense, Flatten, Input\n",
"from tensorflow.keras.models import Model, Sequential, load_model\n",
"from tensorflow.keras.callbacks import ModelCheckpoint, ReduceLROnPlateau\n",
"from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import cv2\n",
"import pickle\n",
"import random\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from src.metrics import IOU\n",
"from src.consts import JPG_IMAGES, RGB_DIR, MASK_DIR\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n",
"Found 9399 images belonging to 1 classes.\n",
"Found 9399 images belonging to 1 classes.\n",
"Found 2349 images belonging to 1 classes.\n",
"Found 2349 images belonging to 1 classes.\n"
]
}
],
"source": [
"\n",
"# we create two instances with the same arguments\n",
"print(os.path.exists('./images/rgb'))\n",
"img_size = (512,512)\n",
"rgb_dir = os.path.join(\"images\", RGB_DIR)\n",
"mask_dir = os.path.join(\"images\", MASK_DIR)\n",
"\n",
"train_datagen = ImageDataGenerator(rescale=1 / 255.0,\n",
" horizontal_flip=True,\n",
" vertical_flip=True,\n",
" validation_split=0.2)\n",
"\n",
"# Provide the same seed and keyword arguments to the fit and flow methods\n",
"seed = 1\n",
"\n",
"image_generator = train_datagen.flow_from_directory(\n",
" './images/rgb',\n",
" class_mode=None,\n",
" # class_mode='binary',\n",
" seed=seed,\n",
" subset='training'\n",
" )\n",
"mask_generator = train_datagen.flow_from_directory(\n",
" './images/mask',\n",
" class_mode=None,\n",
" seed=seed,\n",
" subset='training'\n",
" )\n",
"image_generator_val = train_datagen.flow_from_directory(\n",
" './images/rgb',\n",
" class_mode=None,\n",
" # class_mode='binary',\n",
" seed=seed,\n",
" subset='validation'\n",
" )\n",
"mask_generator_val = train_datagen.flow_from_directory(\n",
" './images/mask',\n",
" class_mode=None,\n",
" seed=seed,\n",
" subset='validation'\n",
" )\n",
"\n",
"train_gen = zip(image_generator, mask_generator)\n",
"val_gen = zip(image_generator_val, mask_generator_val)\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"IMG_HEIGHT = 512\n",
"IMG_WIDTH = 512\n",
"# img_dir = '/images'"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"EPOCHS = 30\n",
"batch_size = 16"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Unet model"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"class Unet():\n",
" def __init__(self, num_classes=1):\n",
" self.num_classes=num_classes\n",
"\n",
" def build_model(self):\n",
" in1 = Input(shape=(IMG_HEIGHT, IMG_WIDTH, 3 ))\n",
"\n",
" conv1 = Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(in1)\n",
" conv1 = Dropout(0.2)(conv1)\n",
" conv1 = Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv1)\n",
" pool1 = MaxPooling2D((2, 2))(conv1)\n",
"\n",
" conv2 = Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(pool1)\n",
" conv2 = Dropout(0.2)(conv2)\n",
" conv2 = Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv2)\n",
" pool2 = MaxPooling2D((2, 2))(conv2)\n",
"\n",
" conv3 = Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(pool2)\n",
" conv3 = Dropout(0.2)(conv3)\n",
" conv3 = Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv3)\n",
" pool3 = MaxPooling2D((2, 2))(conv3)\n",
"\n",
" conv4 = Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(pool3)\n",
" conv4 = Dropout(0.2)(conv4)\n",
" conv4 = Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv4)\n",
"\n",
" up1 = concatenate([UpSampling2D((2, 2))(conv4), conv3], axis=-1)\n",
" conv5 = Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(up1)\n",
" conv5 = Dropout(0.2)(conv5)\n",
" conv5 = Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv5)\n",
" \n",
" up2 = concatenate([UpSampling2D((2, 2))(conv5), conv2], axis=-1)\n",
" conv6 = Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(up2)\n",
" conv6 = Dropout(0.2)(conv6)\n",
" conv6 = Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv6)\n",
"\n",
" up2 = concatenate([UpSampling2D((2, 2))(conv6), conv1], axis=-1)\n",
" conv7 = Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(up2)\n",
" conv7 = Dropout(0.2)(conv7)\n",
" conv7 = Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(conv7)\n",
" segmentation = Conv2D(self.num_classes, (1, 1), activation='sigmoid', name='seg')(conv7)\n",
" #segmentation = Conv2D(3, (1, 1), activation='sigmoid', name='seg')(conv7)\n",
" model = Model(inputs=[in1], outputs=[segmentation])\n",
"\n",
" return model\n",
"\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from src.loss import jaccard_loss"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"You must install pydot (`pip install pydot`) and install graphviz (see instructions at https://graphviz.gitlab.io/download/) for plot_model/model_to_dot to work.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\masob\\AppData\\Local\\Temp\\ipykernel_21092\\68410389.py:22: UserWarning: `Model.fit_generator` is deprecated and will be removed in a future version. Please use `Model.fit`, which supports generators.\n",
" history = model.fit_generator(train_gen,\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch 1/30\n"
]
},
{
"ename": "InvalidArgumentError",
"evalue": "Graph execution error:\n\nDetected at node 'gradient_tape/model_6/concatenate_18/ConcatOffset' defined at (most recent call last):\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\runpy.py\", line 197, in _run_module_as_main\n return _run_code(code, main_globals, None,\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel_launcher.py\", line 16, in <module>\n app.launch_new_instance()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\traitlets\\config\\application.py\", line 846, in launch_instance\n app.start()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelapp.py\", line 677, in start\n self.io_loop.start()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\tornado\\platform\\asyncio.py\", line 199, in start\n self.asyncio_loop.run_forever()\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\asyncio\\base_events.py\", line 596, in run_forever\n self._run_once()\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\asyncio\\base_events.py\", line 1890, in _run_once\n handle._run()\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\asyncio\\events.py\", line 80, in _run\n self._context.run(self._callback, *self._args)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 461, in dispatch_queue\n await self.process_one()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 450, in process_one\n await dispatch(*args)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 357, in dispatch_shell\n await result\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 652, in execute_request\n reply_content = await reply_content\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\ipkernel.py\", line 359, in do_execute\n res = shell.run_cell(code, store_history=store_history, silent=silent)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\zmqshell.py\", line 532, in run_cell\n return super().run_cell(*args, **kwargs)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2768, in run_cell\n result = self._run_cell(\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2814, in _run_cell\n return runner(coro)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\async_helpers.py\", line 129, in _pseudo_sync_runner\n coro.send(None)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3012, in run_cell_async\n has_raised = await self.run_ast_nodes(code_ast.body, cell_name,\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3191, in run_ast_nodes\n if await self.run_code(code, result, async_=asy):\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3251, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"C:\\Users\\masob\\AppData\\Local\\Temp\\ipykernel_21092\\68410389.py\", line 22, in <module>\n history = model.fit_generator(train_gen,\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 2209, in fit_generator\n return self.fit(\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\utils\\traceback_utils.py\", line 64, in error_handler\n return fn(*args, **kwargs)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1384, in fit\n tmp_logs = self.train_function(iterator)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1021, in train_function\n return step_function(self, iterator)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1010, in step_function\n outputs = model.distribute_strategy.run(run_step, args=(data,))\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1000, in run_step\n outputs = model.train_step(data)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 863, in train_step\n self.optimizer.minimize(loss, self.trainable_variables, tape=tape)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\optimizer_v2\\optimizer_v2.py\", line 530, in minimize\n grads_and_vars = self._compute_gradients(\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\optimizer_v2\\optimizer_v2.py\", line 583, in _compute_gradients\n grads_and_vars = self._get_gradients(tape, loss, var_list, grad_loss)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\optimizer_v2\\optimizer_v2.py\", line 464, in _get_gradients\n grads = tape.gradient(loss, var_list, grad_loss)\nNode: 'gradient_tape/model_6/concatenate_18/ConcatOffset'\nAll dimensions except 3 must match. Input 1 has shape [32 64 64 128] and doesn't match input 0 with shape [32 128 128 128].\n\t [[{{node gradient_tape/model_6/concatenate_18/ConcatOffset}}]] [Op:__inference_train_function_8358]",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mInvalidArgumentError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\unet.ipynb Cell 9'\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=13'>14</a>\u001b[0m model_name \u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mmodels/unet.h5\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=14'>15</a>\u001b[0m modelcheckpoint \u001b[39m=\u001b[39m ModelCheckpoint(model_name,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=15'>16</a>\u001b[0m monitor\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mval_loss\u001b[39m\u001b[39m'\u001b[39m,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=16'>17</a>\u001b[0m mode\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mauto\u001b[39m\u001b[39m'\u001b[39m,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=17'>18</a>\u001b[0m verbose\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=18'>19</a>\u001b[0m save_best_only\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m)\n\u001b[1;32m---> <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=21'>22</a>\u001b[0m history \u001b[39m=\u001b[39m model\u001b[39m.\u001b[39;49mfit_generator(train_gen,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=22'>23</a>\u001b[0m validation_data\u001b[39m=\u001b[39;49mval_gen,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=23'>24</a>\u001b[0m epochs\u001b[39m=\u001b[39;49mEPOCHS,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=24'>25</a>\u001b[0m steps_per_epoch\u001b[39m=\u001b[39;49m\u001b[39m100\u001b[39;49m,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=25'>26</a>\u001b[0m validation_steps \u001b[39m=\u001b[39;49m \u001b[39m100\u001b[39;49m,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=26'>27</a>\u001b[0m shuffle\u001b[39m=\u001b[39;49m\u001b[39mTrue\u001b[39;49;00m,\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/unet.ipynb#ch0000007?line=27'>28</a>\u001b[0m )\n",
"File \u001b[1;32mc:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py:2209\u001b[0m, in \u001b[0;36mModel.fit_generator\u001b[1;34m(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)\u001b[0m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2197'>2198</a>\u001b[0m \u001b[39m\"\"\"Fits the model on data yielded batch-by-batch by a Python generator.\u001b[39;00m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2198'>2199</a>\u001b[0m \n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2199'>2200</a>\u001b[0m \u001b[39mDEPRECATED:\u001b[39;00m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2200'>2201</a>\u001b[0m \u001b[39m `Model.fit` now supports generators, so there is no longer any need to use\u001b[39;00m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2201'>2202</a>\u001b[0m \u001b[39m this endpoint.\u001b[39;00m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2202'>2203</a>\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2203'>2204</a>\u001b[0m warnings\u001b[39m.\u001b[39mwarn(\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2204'>2205</a>\u001b[0m \u001b[39m'\u001b[39m\u001b[39m`Model.fit_generator` is deprecated and \u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2205'>2206</a>\u001b[0m \u001b[39m'\u001b[39m\u001b[39mwill be removed in a future version. \u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2206'>2207</a>\u001b[0m \u001b[39m'\u001b[39m\u001b[39mPlease use `Model.fit`, which supports generators.\u001b[39m\u001b[39m'\u001b[39m,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2207'>2208</a>\u001b[0m stacklevel\u001b[39m=\u001b[39m\u001b[39m2\u001b[39m)\n\u001b[1;32m-> <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2208'>2209</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mfit(\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2209'>2210</a>\u001b[0m generator,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2210'>2211</a>\u001b[0m steps_per_epoch\u001b[39m=\u001b[39;49msteps_per_epoch,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2211'>2212</a>\u001b[0m epochs\u001b[39m=\u001b[39;49mepochs,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2212'>2213</a>\u001b[0m verbose\u001b[39m=\u001b[39;49mverbose,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2213'>2214</a>\u001b[0m callbacks\u001b[39m=\u001b[39;49mcallbacks,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2214'>2215</a>\u001b[0m validation_data\u001b[39m=\u001b[39;49mvalidation_data,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2215'>2216</a>\u001b[0m validation_steps\u001b[39m=\u001b[39;49mvalidation_steps,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2216'>2217</a>\u001b[0m validation_freq\u001b[39m=\u001b[39;49mvalidation_freq,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2217'>2218</a>\u001b[0m class_weight\u001b[39m=\u001b[39;49mclass_weight,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2218'>2219</a>\u001b[0m max_queue_size\u001b[39m=\u001b[39;49mmax_queue_size,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2219'>2220</a>\u001b[0m workers\u001b[39m=\u001b[39;49mworkers,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2220'>2221</a>\u001b[0m use_multiprocessing\u001b[39m=\u001b[39;49muse_multiprocessing,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2221'>2222</a>\u001b[0m shuffle\u001b[39m=\u001b[39;49mshuffle,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/engine/training.py?line=2222'>2223</a>\u001b[0m initial_epoch\u001b[39m=\u001b[39;49minitial_epoch)\n",
"File \u001b[1;32mc:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\utils\\traceback_utils.py:67\u001b[0m, in \u001b[0;36mfilter_traceback.<locals>.error_handler\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/utils/traceback_utils.py?line=64'>65</a>\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mException\u001b[39;00m \u001b[39mas\u001b[39;00m e: \u001b[39m# pylint: disable=broad-except\u001b[39;00m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/utils/traceback_utils.py?line=65'>66</a>\u001b[0m filtered_tb \u001b[39m=\u001b[39m _process_traceback_frames(e\u001b[39m.\u001b[39m__traceback__)\n\u001b[1;32m---> <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/utils/traceback_utils.py?line=66'>67</a>\u001b[0m \u001b[39mraise\u001b[39;00m e\u001b[39m.\u001b[39mwith_traceback(filtered_tb) \u001b[39mfrom\u001b[39;00m \u001b[39mNone\u001b[39m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/utils/traceback_utils.py?line=67'>68</a>\u001b[0m \u001b[39mfinally\u001b[39;00m:\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/keras/utils/traceback_utils.py?line=68'>69</a>\u001b[0m \u001b[39mdel\u001b[39;00m filtered_tb\n",
"File \u001b[1;32mc:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\tensorflow\\python\\eager\\execute.py:54\u001b[0m, in \u001b[0;36mquick_execute\u001b[1;34m(op_name, num_outputs, inputs, attrs, ctx, name)\u001b[0m\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/tensorflow/python/eager/execute.py?line=51'>52</a>\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/tensorflow/python/eager/execute.py?line=52'>53</a>\u001b[0m ctx\u001b[39m.\u001b[39mensure_initialized()\n\u001b[1;32m---> <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/tensorflow/python/eager/execute.py?line=53'>54</a>\u001b[0m tensors \u001b[39m=\u001b[39m pywrap_tfe\u001b[39m.\u001b[39mTFE_Py_Execute(ctx\u001b[39m.\u001b[39m_handle, device_name, op_name,\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/tensorflow/python/eager/execute.py?line=54'>55</a>\u001b[0m inputs, attrs, num_outputs)\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/tensorflow/python/eager/execute.py?line=55'>56</a>\u001b[0m \u001b[39mexcept\u001b[39;00m core\u001b[39m.\u001b[39m_NotOkStatusException \u001b[39mas\u001b[39;00m e:\n\u001b[0;32m <a href='file:///c%3A/Users/masob/Desktop/STUDIA/WIDZENIE%20KOMPUTEROWE/Projekt%20ON%20CLOUD/cloud-detection-challenge/venv/lib/site-packages/tensorflow/python/eager/execute.py?line=56'>57</a>\u001b[0m \u001b[39mif\u001b[39;00m name \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n",
"\u001b[1;31mInvalidArgumentError\u001b[0m: Graph execution error:\n\nDetected at node 'gradient_tape/model_6/concatenate_18/ConcatOffset' defined at (most recent call last):\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\runpy.py\", line 197, in _run_module_as_main\n return _run_code(code, main_globals, None,\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel_launcher.py\", line 16, in <module>\n app.launch_new_instance()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\traitlets\\config\\application.py\", line 846, in launch_instance\n app.start()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelapp.py\", line 677, in start\n self.io_loop.start()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\tornado\\platform\\asyncio.py\", line 199, in start\n self.asyncio_loop.run_forever()\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\asyncio\\base_events.py\", line 596, in run_forever\n self._run_once()\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\asyncio\\base_events.py\", line 1890, in _run_once\n handle._run()\n File \"C:\\Users\\masob\\AppData\\Local\\Programs\\Python\\Python39\\lib\\asyncio\\events.py\", line 80, in _run\n self._context.run(self._callback, *self._args)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 461, in dispatch_queue\n await self.process_one()\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 450, in process_one\n await dispatch(*args)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 357, in dispatch_shell\n await result\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 652, in execute_request\n reply_content = await reply_content\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\ipkernel.py\", line 359, in do_execute\n res = shell.run_cell(code, store_history=store_history, silent=silent)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\ipykernel\\zmqshell.py\", line 532, in run_cell\n return super().run_cell(*args, **kwargs)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2768, in run_cell\n result = self._run_cell(\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2814, in _run_cell\n return runner(coro)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\async_helpers.py\", line 129, in _pseudo_sync_runner\n coro.send(None)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3012, in run_cell_async\n has_raised = await self.run_ast_nodes(code_ast.body, cell_name,\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3191, in run_ast_nodes\n if await self.run_code(code, result, async_=asy):\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3251, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"C:\\Users\\masob\\AppData\\Local\\Temp\\ipykernel_21092\\68410389.py\", line 22, in <module>\n history = model.fit_generator(train_gen,\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 2209, in fit_generator\n return self.fit(\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\utils\\traceback_utils.py\", line 64, in error_handler\n return fn(*args, **kwargs)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1384, in fit\n tmp_logs = self.train_function(iterator)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1021, in train_function\n return step_function(self, iterator)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1010, in step_function\n outputs = model.distribute_strategy.run(run_step, args=(data,))\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 1000, in run_step\n outputs = model.train_step(data)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\engine\\training.py\", line 863, in train_step\n self.optimizer.minimize(loss, self.trainable_variables, tape=tape)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\optimizer_v2\\optimizer_v2.py\", line 530, in minimize\n grads_and_vars = self._compute_gradients(\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\optimizer_v2\\optimizer_v2.py\", line 583, in _compute_gradients\n grads_and_vars = self._get_gradients(tape, loss, var_list, grad_loss)\n File \"c:\\Users\\masob\\Desktop\\STUDIA\\WIDZENIE KOMPUTEROWE\\Projekt ON CLOUD\\cloud-detection-challenge\\venv\\lib\\site-packages\\keras\\optimizer_v2\\optimizer_v2.py\", line 464, in _get_gradients\n grads = tape.gradient(loss, var_list, grad_loss)\nNode: 'gradient_tape/model_6/concatenate_18/ConcatOffset'\nAll dimensions except 3 must match. Input 1 has shape [32 64 64 128] and doesn't match input 0 with shape [32 128 128 128].\n\t [[{{node gradient_tape/model_6/concatenate_18/ConcatOffset}}]] [Op:__inference_train_function_8358]"
]
}
],
"source": [
"model = Unet(num_classes=1).build_model()\n",
"\n",
"compile_params ={\n",
" 'loss':jaccard_loss(smooth=90), \n",
" 'optimizer':'rmsprop',\n",
" 'metrics':[IOU]\n",
" }\n",
" \n",
" \n",
"model.compile(**compile_params)\n",
"\n",
"tf.keras.utils.plot_model(model, show_shapes=True)\n",
"\n",
"model_name = \"models/unet.h5\"\n",
"modelcheckpoint = ModelCheckpoint(model_name,\n",
" monitor='val_loss',\n",
" mode='auto',\n",
" verbose=1,\n",
" save_best_only=True)\n",
"\n",
"\n",
"history = model.fit_generator(train_gen,\n",
" validation_data=val_gen,\n",
" epochs=EPOCHS,\n",
" steps_per_epoch=100,\n",
" validation_steps = 100,\n",
" shuffle=True,\n",
")"
]
}
],
"metadata": {
"interpreter": {
"hash": "1be0d4179f0eed29061aece4de36a3b887fc5990f515aa1f08bfa33b9ed547bc"
},
"kernelspec": {
"display_name": "Python 3.9.7 64-bit ('widzenie-komputerowe-env': conda)",
"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.0"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}