From 403122aa1c498713c1970a4c57c556d250a5d843 Mon Sep 17 00:00:00 2001 From: Lucas Iturriago <70216214+liturriago@users.noreply.github.com> Date: Mon, 5 Aug 2024 09:10:55 -0500 Subject: [PATCH] Add notebook TGCEss - ResUnet Backbone - OxfordPets --- notebooks/tgcess-resunet-backbone-oxfordpets.ipynb | 1 + 1 file changed, 1 insertion(+) create mode 100644 notebooks/tgcess-resunet-backbone-oxfordpets.ipynb diff --git a/notebooks/tgcess-resunet-backbone-oxfordpets.ipynb b/notebooks/tgcess-resunet-backbone-oxfordpets.ipynb new file mode 100644 index 0000000..0f1991e --- /dev/null +++ b/notebooks/tgcess-resunet-backbone-oxfordpets.ipynb @@ -0,0 +1 @@ +{"cells":[{"cell_type":"markdown","metadata":{},"source":["## Chained deep learning using generalized cross entropy for multiple annotators segmentation\n","\n","\n","\n","## Loss functions for segmentation in deep learning\n","\n","\n","Given a $k$ class multiple annotators segmentation problem with a dataset like the following'\n","\n","$$\\mathbf X \\in \\mathbb{R}^{W \\times H}, \\{ \\mathbf Y_r \\in \\{0,1\\}^{W \\times H \\times K} \\}_{r=1}^R; \\;\\; \\mathbf {\\hat Y} \\in [0,1]^{W\\times H \\times K} = f(\\mathbf X)$$\n","\n","The segmentation mask function will map input output as follows:\n","\n","$$f: \\mathbb R ^{W\\times H} \\to [0,1]^{W\\times H\\times K}$$\n","\n","$\\mathbf Y$ will satisfy the following condition for being a softmax-like representation:\n","\n","$$\\mathbf Y_r[w,h,:] \\mathbf{1} ^ \\top _ k = 1; \\;\\; w \\in W, h \\in H$$\n","\n","Now, let's suppose the existence of an annotators reliability map estimation $\\Lambda_r; \\; r \\in R$;\n","\n","\n","$$\\bigg\\{ \\Lambda_r (\\mathbf X; \\theta ) \\in [0,1] ^{W\\times H} \\bigg\\}_{r=1}^R $$\n","\n","\n","Then, our $TGCE_{SS}$:\n","\n","\n","$$TGCE_{SS}(\\mathbf{Y}_r,f(\\mathbf X;\\theta) | \\mathbf{\\Lambda}_r (\\mathbf X;\\theta)) =\\mathbb E_{r} \\left\\{ \\mathbb E_{w,h} \\left\\{ \\Lambda_r (\\mathbf X; \\theta) \\circ \\mathbb E_k \\bigg\\{ \\mathbf Y_r \\circ \\bigg( \\frac{\\mathbf 1 _{W\\times H \\times K} - f(\\mathbf X;\\theta) ^{\\circ q }}{q} \\bigg); k \\in K \\bigg\\} + \\\\ \\left(\\mathbf 1 _{W \\times H } - \\Lambda _r (\\mathbf X;\\theta)\\right) \\circ \\bigg( \\frac{\\mathbf 1_{W\\times H} - (\\frac {1}{k} \\mathbf 1_{W\\times H})^{\\circ q}}{q} \\bigg); w \\in W, h \\in H \\right\\};r\\in R\\right\\} $$\n","\n","\n","Where $q \\in (0,1)$\n","\n","Total Loss for a given batch holding $N$ samples:\n","\n","$$\\mathscr{L}\\left(\\mathbf{Y}_r[n],f(\\mathbf X[n];\\theta) | \\mathbf{\\Lambda}_r (\\mathbf X[n];\\theta)\\right) = \\frac{1}{N} \\sum_{n}^NTGCE_{SS}(\\mathbf{Y}_r[n],f(\\mathbf X[n];\\theta) | \\mathbf{\\Lambda}_r (\\mathbf X[n];\\theta))$$"]},{"cell_type":"markdown","metadata":{"id":"XxDpkCxi0jLy","papermill":{"duration":0.049804,"end_time":"2024-06-14T22:21:09.222219","exception":false,"start_time":"2024-06-14T22:21:09.172415","status":"completed"},"tags":[]},"source":["## Download and importing of libraries"]},{"cell_type":"code","execution_count":1,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:11:36.942330Z","iopub.status.busy":"2024-08-05T01:11:36.941741Z","iopub.status.idle":"2024-08-05T01:12:24.021107Z","shell.execute_reply":"2024-08-05T01:12:24.020038Z","shell.execute_reply.started":"2024-08-05T01:11:36.942299Z"},"id":"MwRAu5cpNQMr","papermill":{"duration":32.608581,"end_time":"2024-06-14T22:21:41.877358","exception":false,"start_time":"2024-06-14T22:21:09.268777","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["%%capture\n","!pip install --upgrade keras==2.15.0\n","!pip install -U git+https://github.com/UN-GCPDS/python-gcpds.image_segmentation.git >> /tmp/null\n","!pip install git+https://github.com/qubvel/classification_models.git"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:12:24.023859Z","iopub.status.busy":"2024-08-05T01:12:24.023452Z","iopub.status.idle":"2024-08-05T01:12:40.068996Z","shell.execute_reply":"2024-08-05T01:12:40.068183Z","shell.execute_reply.started":"2024-08-05T01:12:24.023823Z"},"id":"MwRAu5cpNQMr","papermill":{"duration":15.097782,"end_time":"2024-06-14T22:21:57.022679","exception":false,"start_time":"2024-06-14T22:21:41.924897","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# General Libraries\n","import os\n","import time\n","import shutil\n","import random\n","import warnings\n","import pandas as pd\n","import seaborn as sns\n","from enum import auto, Enum\n","from functools import partial\n","from datetime import datetime\n","\n","# Image Processing Libraries\n","import cv2\n","import numpy as np\n","import matplotlib.pyplot as plt\n","\n","# Deep Learning Libraries\n","import tensorflow as tf\n","from tensorflow import keras\n","from keras_tuner import Objective\n","from keras_tuner import HyperModel\n","import tensorflow.keras.backend as K\n","from keras.layers import Layer, Activation\n","from keras_tuner import BayesianOptimization\n","from tensorflow.keras.optimizers import Adam\n","from tensorflow.keras.callbacks import Callback\n","from tensorflow.keras.utils import to_categorical\n","from tensorflow.keras.utils import get_custom_objects\n","from keras_tuner.engine.hyperparameters import HyperParameters\n","from tensorflow.keras.preprocessing.image import ImageDataGenerator\n","from keras_tuner import BayesianOptimization as OriginalBayesianOptimization\n","from keras_tuner.oracles import BayesianOptimizationOracle as OriginalBayesianOptimizationOracle\n","\n","# Deep Learning Libraries - GCPDS\n","from gcpds.image_segmentation.datasets.segmentation import OxfordIiitPet\n","\n","# Machine Learning Libraries - Sklearn\n","import sklearn\n","from sklearn.gaussian_process import GaussianProcessRegressor\n","from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C, DotProduct, ExpSineSquared, Matern\n","\n","# Deep Learning Libraries - TensorFlow specific\n","from tensorflow.keras.losses import Loss\n","from tensorflow.keras.metrics import Metric\n","from tensorflow.keras import Model, layers, regularizers\n","\n","# Classification models \n","from classification_models.keras import Classifiers\n","\n","# Other Libraries\n","import gc\n","import json\n","import gdown\n","import itertools\n","import SimpleITK as sitk\n","from PIL import ImageFont\n","from dataclasses import dataclass\n","from matplotlib.style import available\n","from tensorflow.python.framework.ops import EagerTensor\n","\n","warnings.filterwarnings(\"ignore\") # Disable warnings"]},{"cell_type":"markdown","metadata":{"id":"JpW1HZlY0jL1","papermill":{"duration":0.046107,"end_time":"2024-06-14T22:21:57.116593","exception":false,"start_time":"2024-06-14T22:21:57.070486","status":"completed"},"tags":[]},"source":["## Download OxfordPet dataset and generation of synthetic annotators with the introduction of different signal-to-noise ratio values"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:12:40.071002Z","iopub.status.busy":"2024-08-05T01:12:40.070199Z","iopub.status.idle":"2024-08-05T01:13:53.092701Z","shell.execute_reply":"2024-08-05T01:13:53.091723Z","shell.execute_reply.started":"2024-08-05T01:12:40.070968Z"},"id":"DkiXYUlq0jL1","outputId":"1d24cdd3-24c9-4bb1-d5a7-3381b15a3beb","papermill":{"duration":66.97641,"end_time":"2024-06-14T22:23:04.138756","exception":false,"start_time":"2024-06-14T22:21:57.162346","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Download OxfordPet dataset\n","\n","dataset = OxfordIiitPet()\n","train_dataset, val_dataset, test_dataset = dataset()"]},{"cell_type":"markdown","metadata":{},"source":["## Original Masks"]},{"cell_type":"code","execution_count":4,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:13:53.095206Z","iopub.status.busy":"2024-08-05T01:13:53.094922Z","iopub.status.idle":"2024-08-05T01:13:53.342272Z","shell.execute_reply":"2024-08-05T01:13:53.341309Z","shell.execute_reply.started":"2024-08-05T01:13:53.095182Z"},"trusted":true},"outputs":[],"source":["BATCH_SIZE = 128\n","TARGET_SHAPE = 256, 256\n","\n","def fussion_mask(mask: EagerTensor) -> EagerTensor:\n"," \"\"\"Fuses the object and border masks into a single mask.\n","\n"," This function takes a mask tensor containing separate channels for the object, \n"," background, and border, and fuses the object and border channels into a single \n"," mask channel.\n","\n"," Parameters:\n"," mask (EagerTensor): A tensor representing the segmentation mask with \n"," object, background, and border channels.\n","\n"," Returns:\n"," EagerTensor: A tensor representing the fused mask containing the sum \n"," of the object and border channels.\n","\n"," \"\"\"\n"," obj, bg, border = tf.unstack(mask, axis=2)\n"," orig_shape = mask.shape\n"," new_shape = list(orig_shape)\n"," new_shape[-1] = 1\n"," return tf.reshape(tf.stack([obj + border]), new_shape)\n","\n","\n","def map_dataset(dataset, target_shape, batch_size):\n"," \"\"\"Preprocesses and batches a dataset for training or evaluation.\n","\n"," This function applies a series of transformations to each sample in the dataset \n"," to prepare it for training or evaluation. It resizes images and masks to the \n"," specified target shape, fuses mask channels if needed, and batches the dataset.\n","\n"," Args:\n"," dataset (tf.data.Dataset): The input dataset containing images, masks, labels, and IDs.\n"," target_shape (tuple): A tuple specifying the desired shape of images and masks.\n"," batch_size (int): The batch size to use for training or evaluation.\n","\n"," Returns:\n"," A preprocessed and batched dataset ready for training or evaluation.\n","\n"," \"\"\"\n"," # Resize images and masks to the target shape\n"," dataset_ = dataset.map(lambda img, mask, label, id_img: (img, mask),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n"," dataset_ = dataset_.map(lambda img, mask: (tf.image.resize(img, target_shape), \n"," tf.image.resize(mask, target_shape)),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n"," \n"," # Fuse mask channels if needed\n"," dataset_ = dataset_.map(lambda img, mask: (img, fussion_mask(mask)),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," # Batch the dataset\n"," dataset_ = dataset_.batch(batch_size)\n"," return dataset_\n","\n","original_train = map_dataset(train_dataset, TARGET_SHAPE, BATCH_SIZE)\n","original_val = map_dataset(val_dataset, TARGET_SHAPE, BATCH_SIZE)\n","original_test = map_dataset(test_dataset, TARGET_SHAPE, BATCH_SIZE)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:13:53.343930Z","iopub.status.busy":"2024-08-05T01:13:53.343504Z","iopub.status.idle":"2024-08-05T01:13:56.281108Z","shell.execute_reply":"2024-08-05T01:13:56.280209Z","shell.execute_reply.started":"2024-08-05T01:13:53.343904Z"},"trusted":true},"outputs":[],"source":["for img,mask in original_train.take(1):\n"," print(mask.shape)\n"," fig, axes = plt.subplots(1, 2 , figsize=(10,5))\n"," axes[0].imshow(img[110])\n"," axes[0].set_title('Image')\n"," axes[0].axis('off')\n"," axes[1].imshow(mask[110][:,:,0])\n"," axes[1].set_title('Original mask')\n"," axes[1].axis('off')"]},{"cell_type":"markdown","metadata":{},"source":["### Loading of the different parts of the dataset"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:13:56.282675Z","iopub.status.busy":"2024-08-05T01:13:56.282280Z","iopub.status.idle":"2024-08-05T01:13:59.981119Z","shell.execute_reply":"2024-08-05T01:13:59.980152Z","shell.execute_reply.started":"2024-08-05T01:13:56.282650Z"},"id":"JhLPCIzLsyu_","papermill":{"duration":109.153096,"end_time":"2024-06-14T22:25:20.086538","exception":false,"start_time":"2024-06-14T22:23:30.933442","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Loading of the training part of the database in a tensor manner\n","\n","original_X_train = []\n","original_y_train = []\n","\n","for img, mask in original_train.take(8):\n"," original_X_train.append(img)\n"," original_y_train.append(mask)\n","\n","original_X_train, original_y_train = tf.concat(original_X_train, axis=0), tf.concat(original_y_train, axis=0)\n","print(f'Tensor dimensions with training images: {original_X_train.shape} \\nTensor dimensions with training masks: {original_y_train.shape}')"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:13:59.982500Z","iopub.status.busy":"2024-08-05T01:13:59.982225Z","iopub.status.idle":"2024-08-05T01:14:01.033483Z","shell.execute_reply":"2024-08-05T01:14:01.032613Z","shell.execute_reply.started":"2024-08-05T01:13:59.982476Z"},"id":"5rhZCU_fsyu_","papermill":{"duration":29.01667,"end_time":"2024-06-14T22:25:49.153725","exception":false,"start_time":"2024-06-14T22:25:20.137055","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Loading of the validation part of the database in a tensor manner\n","\n","original_X_val = []\n","original_y_val = []\n","\n","for img, mask in original_val.take(2):\n"," original_X_val.append(img)\n"," original_y_val.append(mask)\n","\n","original_X_val, original_y_val = tf.concat(original_X_val, axis=0), tf.concat(original_y_val, axis=0)\n","print(f'Tensor dimensions with validation images: {original_X_val.shape}\\nTensor dimensions with validation masks: {original_y_val.shape}')"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:01.035001Z","iopub.status.busy":"2024-08-05T01:14:01.034706Z","iopub.status.idle":"2024-08-05T01:14:01.886235Z","shell.execute_reply":"2024-08-05T01:14:01.885323Z","shell.execute_reply.started":"2024-08-05T01:14:01.034978Z"},"id":"K-D-SCq3syvA","papermill":{"duration":28.751601,"end_time":"2024-06-14T22:26:17.957026","exception":false,"start_time":"2024-06-14T22:25:49.205425","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Loading of the testing part of the database in a tensor manner\n","\n","original_X_test = []\n","original_y_test = []\n","\n","for img, mask in original_test.take(2):\n"," original_X_test.append(img)\n"," original_y_test.append(mask)\n","\n","original_X_test, original_y_test = tf.concat(original_X_test, axis=0), tf.concat(original_y_test, axis=0)\n","print(f'Tensor dimensions with test images: {original_X_test.shape}\\nTensor dimensions with test masks: {original_y_test.shape}')"]},{"cell_type":"markdown","metadata":{},"source":["## Synthetics masks"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:01.887982Z","iopub.status.busy":"2024-08-05T01:14:01.887537Z","iopub.status.idle":"2024-08-05T01:14:07.846988Z","shell.execute_reply":"2024-08-05T01:14:07.846102Z","shell.execute_reply.started":"2024-08-05T01:14:01.887950Z"},"id":"Dq2aLCBetK2c","outputId":"e7742e0c-4ba9-415d-9f00-2d3b7ec2d5fb","papermill":{"duration":5.064584,"end_time":"2024-06-14T22:23:09.255815","exception":false,"start_time":"2024-06-14T22:23:04.191231","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Download trained Unet network for OxfordPet segmentation task from Drive\n","\n","model_url = \"https://drive.google.com/file/d/1x39L3QNDMye1SJhKh1gf4YS-HRFLTs6G/view?usp=drive_link\"\n","model_uri = model_url.split(\"/\")[5]\n","!gdown $model_uri\n","\n","model_extension = \"keras\"\n","paths = []\n","\n","for file in os.listdir(\".\"):\n"," if file.endswith(model_extension):\n"," paths.append(file)\n","\n","model_path = paths[0]\n","print(f\"Loading {model_path}...\")\n","model_ann = tf.keras.models.load_model(model_path, compile = False)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:07.852419Z","iopub.status.busy":"2024-08-05T01:14:07.852111Z","iopub.status.idle":"2024-08-05T01:14:07.861395Z","shell.execute_reply":"2024-08-05T01:14:07.860540Z","shell.execute_reply.started":"2024-08-05T01:14:07.852390Z"},"id":"nuj7o-lNtUI7","outputId":"e2f3cb25-f04b-43fc-865e-8b0cb2346130","papermill":{"duration":0.062229,"end_time":"2024-06-14T22:23:09.367378","exception":false,"start_time":"2024-06-14T22:23:09.305149","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Find last encoder convolution layer\n","\n","def find_last_encoder_conv_layer(model):\n"," '''\n"," Finds the index of the last convolutional layer in the encoder part of the model.\n","\n"," Parameters:\n"," model (keras.Model): The Keras model to search for the last encoder convolutional layer.\n","\n"," Returns:\n"," int: Index of the last convolutional layer in the encoder part of the model.\n"," '''\n","\n"," last_conv_encoder_layer = 0\n"," for i,layer in enumerate(model.layers):\n"," if (isinstance(layer, keras.layers.Conv2D)):\n"," last_conv_encoder_layer = i\n"," if (isinstance(layer, keras.layers.UpSampling2D)):\n"," break\n"," return last_conv_encoder_layer\n","\n","last_conv_encoder_layer = find_last_encoder_conv_layer(model_ann)\n","last_conv_encoder_layer"]},{"cell_type":"code","execution_count":11,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:07.863126Z","iopub.status.busy":"2024-08-05T01:14:07.862721Z","iopub.status.idle":"2024-08-05T01:14:08.526066Z","shell.execute_reply":"2024-08-05T01:14:08.524886Z","shell.execute_reply.started":"2024-08-05T01:14:07.863095Z"},"id":"_MILTfMrtWeg","papermill":{"duration":0.067872,"end_time":"2024-06-14T22:23:09.486854","exception":false,"start_time":"2024-06-14T22:23:09.418982","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Compute and add noise to the target layer\n","\n","def compute_snr(signal: float, noise_std: float) -> float:\n"," \"\"\"Compute the Signal-to-Noise Ratio (SNR) in decibels.\n","\n"," The Signal-to-Noise Ratio (SNR) measures the ratio of the power of a signal to the\n"," power of background noise. Higher SNR values indicate a stronger signal relative to\n"," the noise.\n","\n"," Parameters:\n"," signal (float): The signal power.\n"," noise_std (float): The standard deviation of the background noise.\n","\n"," Returns:\n"," float: The Signal-to-Noise Ratio (SNR) in decibels.\n","\n"," \"\"\"\n"," return 10 * np.log10(np.mean(signal ** 2) / noise_std ** 2)\n","\n","class SnrType(Enum):\n"," \"\"\"Enumeration representing different types of Signal-to-Noise Ratio (SNR) scales.\n","\n"," This enumeration defines two types of SNR scales: 'log' and 'linear'. These types\n"," indicate whether the SNR values are represented in logarithmic or linear scale.\n","\n"," Attributes:\n"," log (int): Represents the logarithmic scale for SNR values.\n"," linear (int): Represents the linear scale for SNR values.\n","\n"," \"\"\"\n"," log = 0\n"," linear = 1\n","\n","def add_noise_to_layer_weights(model, layer, noise_snr, snr_type: SnrType = SnrType.log, verbose=0):\n"," \"\"\"Adds noise to the weights of a specified layer in the model.\n","\n"," This function adds noise to the weights of a specified layer in the model,\n"," simulating a certain signal-to-noise ratio (SNR) either in linear or logarithmic scale.\n","\n"," Parameters:\n"," model (tf.keras.Model): The model to modify.\n"," layer (int): Index of the layer whose weights will be modified.\n"," noise_snr (float): Desired signal-to-noise ratio (SNR) for the added noise.\n"," snr_type (SnrType): Type of SNR scale to use, either 'log' (logarithmic) or 'linear'.\n"," Defaults to SnrType.log.\n"," verbose (int): Verbosity mode. If greater than 0, prints information about the noise\n"," and signal powers. Defaults to 0.\n","\n"," Returns:\n"," float: The computed signal-to-noise ratio (SNR) after adding noise to the layer weights.\n","\n"," \"\"\"\n"," layer_weights = model.layers[layer].get_weights()\n","\n"," sig_power = np.mean(layer_weights[0] ** 2)\n","\n"," if snr_type == SnrType.log:\n"," noise_power = sig_power / (10 ** (noise_snr / 10))\n"," elif snr_type == SnrType.linear:\n"," noise_power = sig_power / noise_snr\n","\n"," noise_std = noise_power ** (1 / 2)\n","\n"," snr = compute_snr(layer_weights[0], noise_std)\n","\n"," if verbose > 0:\n"," print(f\"Adding noise for SNR: {noise_snr}\\n\\n\")\n"," print(f\"Signal power: {sig_power}\")\n"," print(f\"Noise power: {noise_power}\\n\\n\")\n","\n"," for i in range(layer_weights[0].shape[0]):\n"," for j in range(layer_weights[0].shape[1]):\n"," layer_weights[0][i][j] += np.random.randn(128, 128) * noise_std\n","\n"," model.layers[last_conv_encoder_layer].set_weights(layer_weights)\n"," return snr"]},{"cell_type":"code","execution_count":12,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:08.527842Z","iopub.status.busy":"2024-08-05T01:14:08.527510Z","iopub.status.idle":"2024-08-05T01:14:10.317281Z","shell.execute_reply":"2024-08-05T01:14:10.316300Z","shell.execute_reply.started":"2024-08-05T01:14:08.527813Z"},"id":"U6JNeh5VtYaa","papermill":{"duration":1.935141,"end_time":"2024-06-14T22:23:11.474759","exception":false,"start_time":"2024-06-14T22:23:09.539618","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Define the signal-to-noise ratio values for each synthetic annotator\n","values_to_test = [20,0,-15]\n","\n","# Creation of the different models and their perturbations starting from the base model\n","def produce_disturbed_models(values_to_test, base_model_path):\n"," \"\"\"Produces a list of disturbed models by adding noise to layer weights.\n","\n"," This function loads a base model from the specified path and creates disturbed\n"," versions of it by adding noise to the weights of a specified layer. The noise\n"," level is controlled by the values provided in the `values_to_test` list.\n","\n"," Parameters:\n"," values_to_test (list): A list of values representing the noise levels to test.\n"," base_model_path (str): The file path to the base model to load.\n","\n"," Returns:\n"," Tuple containing two lists:\n"," - List of disturbed models, each with noise added to layer weights.\n"," - List of Signal-to-Noise Ratio (SNR) values corresponding to each disturbed model.\n","\n"," \"\"\"\n"," snr_values = []\n"," models = []\n","\n"," for value in values_to_test:\n"," model_ = tf.keras.models.load_model(base_model_path, compile=False)\n"," snr = add_noise_to_layer_weights(model_, last_conv_encoder_layer, value)\n"," snr_values.append(snr)\n"," models.append(model_)\n","\n"," return models, snr_values\n","\n","\n","disturbance_models, snr_values = produce_disturbed_models(values_to_test, model_path)"]},{"cell_type":"code","execution_count":13,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:10.319252Z","iopub.status.busy":"2024-08-05T01:14:10.318949Z","iopub.status.idle":"2024-08-05T01:14:12.930489Z","shell.execute_reply":"2024-08-05T01:14:12.929450Z","shell.execute_reply.started":"2024-08-05T01:14:10.319226Z"},"id":"a_53f05lN3xh","papermill":{"duration":2.79368,"end_time":"2024-06-14T22:23:14.329343","exception":false,"start_time":"2024-06-14T22:23:11.535663","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Disturbance processing with different SNR ratios values for each database partition using the modified networks\n","\n","BATCH_SIZE = 128\n","TARGET_SHAPE = (256, 256)\n","ORIGINAL_MODEL_SHAPE = 256, 256\n","NUM_ANNOTATORS = 3\n","\n","def disturb_mask(model, image, model_shape, target_shape):\n"," \"\"\"Disturbs a segmentation mask using a neural network model.\n","\n"," This function takes an input image and passes it through the given neural network model\n"," to generate a disturbed segmentation mask. The input image is resized to fit the model's\n"," input shape, and the output mask is resized to match the target shape.\n","\n"," Parameters:\n"," model (tf.keras.Model): A neural network model used to disturb the segmentation mask.\n"," image (tf.Tensor): Input image tensor.\n"," model_shape (tuple): Shape of the input expected by the model.\n"," target_shape (tuple): Target shape for the disturbed segmentation mask.\n","\n"," Returns:\n"," A disturbed segmentation mask tensor.\n","\n"," \"\"\"\n"," return tf.image.resize(model(tf.image.resize(image, model_shape)), target_shape)\n","\n","\n","def mix_channels(mask, num_annotators):\n"," \"\"\"Mixes the channels of a segmentation mask.\n","\n"," This function creates a new tensor by mixing the channels of the input segmentation mask.\n"," It is commonly used in scenarios where binary segmentation masks are represented with\n"," multiple channels, each indicating the annotation of a different annotator.\n","\n"," Parameters:\n"," mask (tensor): Input segmentation mask tensor with shape (batch_size, height, width, channels).\n"," num_annotators (int): Number of annotators whose annotations are included in the mask.\n","\n"," Returns:\n"," A tensor representing the mixed channels segmentation mask with shape\n"," (batch_size, height, width, num_annotators).\n","\n"," \"\"\"\n"," return tf.stack([mask, 1 - mask], axis=-2)\n","\n","\n","def add_noisy_annotators(img: EagerTensor, models, model_shape, target_shape) -> EagerTensor:\n"," \"\"\"Adds noise from multiple annotators to an input image.\n","\n"," This function applies noise to an input image from multiple annotator models,\n"," creating a set of noisy annotations. It iterates through each model in the\n"," provided list of models, applying noise to the input image based on the\n"," characteristics of each model.\n","\n"," Parameters:\n"," img (EagerTensor): The input image to which noise will be added.\n"," models (list): A list of annotator models used to generate noise.\n"," model_shape: The shape of the model's output.\n"," target_shape: The target shape of the output annotations.\n","\n"," Returns:\n"," EagerTensor: A tensor representing the noisy annotations generated by\n"," applying noise from multiple annotators to the input image.\n","\n"," \"\"\"\n"," return tf.transpose([disturb_mask(model, img, model_shape=model_shape, target_shape=target_shape) for model in models], [2, 3, 1, 4, 0])\n","\n","\n","def map_dataset_MA(dataset, target_shape, model_shape, batch_size, num_annotators):\n"," \"\"\"Preprocesses a dataset for multi-annotator segmentation tasks.\n","\n"," This function performs a series of mapping operations on the input dataset\n"," to prepare it for training or evaluation in a multi-annotator segmentation\n"," scenario. It resizes images and masks, adds noisy annotations, reshapes masks,\n"," mixes channels, and batches the data.\n","\n"," Parameters:\n"," dataset (tf.data.Dataset): Input dataset containing images, masks, labels, and image IDs.\n"," target_shape (tuple): Desired shape for the images and masks after resizing.\n"," model_shape (tuple): Shape required by the segmentation model.\n"," batch_size (int): Size of the batches to create.\n"," num_annotators (int): Number of annotators providing annotations for each image.\n","\n"," Returns:\n"," A preprocessed dataset ready for training or evaluation.\n","\n"," \"\"\"\n"," dataset_ = dataset.map(lambda img, mask, label, id_img: (img, mask),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," dataset_ = dataset_.map(lambda img, mask: (tf.image.resize(img, target_shape),\n"," tf.image.resize(mask, target_shape)),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," dataset_ = dataset_.map(lambda img, mask: (img, add_noisy_annotators(tf.expand_dims(img, 0),\n"," disturbance_models,\n"," model_shape=model_shape,\n"," target_shape=target_shape)),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," dataset_ = dataset_.map(lambda img, mask: (img, tf.reshape(mask, (mask.shape[0], mask.shape[1], 1, mask.shape[-1]))),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," dataset_ = dataset_.map(lambda img, mask: (img, mix_channels(mask, num_annotators)),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," dataset_ = dataset_.map(lambda img, mask: (img, tf.squeeze(mask, axis=2)),\n"," num_parallel_calls=tf.data.AUTOTUNE)\n","\n"," dataset_ = dataset_.batch(batch_size)\n"," return dataset_\n","\n","\n","\n","synthetic_train = map_dataset_MA(\n"," train_dataset,\n"," target_shape=TARGET_SHAPE,\n"," model_shape=ORIGINAL_MODEL_SHAPE,\n"," batch_size=BATCH_SIZE,\n"," num_annotators=NUM_ANNOTATORS)\n","synthetic_val = map_dataset_MA(\n"," val_dataset,\n"," target_shape=TARGET_SHAPE,\n"," model_shape=ORIGINAL_MODEL_SHAPE,\n"," batch_size=BATCH_SIZE,\n"," num_annotators=NUM_ANNOTATORS)\n","\n","synthetic_test = map_dataset_MA(\n"," test_dataset,\n"," target_shape=TARGET_SHAPE,\n"," model_shape=ORIGINAL_MODEL_SHAPE,\n"," batch_size=BATCH_SIZE,\n"," num_annotators=NUM_ANNOTATORS)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:12.931970Z","iopub.status.busy":"2024-08-05T01:14:12.931672Z","iopub.status.idle":"2024-08-05T01:14:28.155441Z","shell.execute_reply":"2024-08-05T01:14:28.154527Z","shell.execute_reply.started":"2024-08-05T01:14:12.931945Z"},"id":"jSHwxW7CKNm4","outputId":"9b01f669-ce65-438f-873f-57f654d7b36e","papermill":{"duration":16.400942,"end_time":"2024-06-14T22:23:30.781859","exception":false,"start_time":"2024-06-14T22:23:14.380917","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Plotting the different perturbations to a sample and the resulting dimensions\n","\n","for img,mask in synthetic_train.take(1):\n"," print(f\"Mask shape: {mask.shape} (batch_size * h * w * k * r) Img shape {img.shape}\")\n"," fig, axes = plt.subplots(2,NUM_ANNOTATORS)\n"," fig.set_size_inches(16,7)\n"," for i in range(NUM_ANNOTATORS):\n"," axes[0][i].imshow((mask)[0,:,:,0,i])\n"," axes[0][i].set_title(f\"Mask for annotator {i}\")\n"," axes[0][i].axis('off')\n"," axes[1][i].imshow((mask)[0,:,:,-1,i])\n"," axes[1][i].axis('off')"]},{"cell_type":"markdown","metadata":{"id":"vEVUXnbe0jL4","papermill":{"duration":0.049743,"end_time":"2024-06-14T22:23:30.882664","exception":false,"start_time":"2024-06-14T22:23:30.832921","status":"completed"},"tags":[]},"source":["### Loading of the different parts of the dataset"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:14:28.157017Z","iopub.status.busy":"2024-08-05T01:14:28.156691Z","iopub.status.idle":"2024-08-05T01:16:12.809283Z","shell.execute_reply":"2024-08-05T01:16:12.808346Z","shell.execute_reply.started":"2024-08-05T01:14:28.156986Z"},"id":"JhLPCIzLsyu_","papermill":{"duration":109.153096,"end_time":"2024-06-14T22:25:20.086538","exception":false,"start_time":"2024-06-14T22:23:30.933442","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Loading of the training part of the database in a tensor manner\n","\n","synthetic_X_train = []\n","synthetic_y_train = []\n","\n","for img, mask in synthetic_train.take(8):\n"," synthetic_X_train.append(img)\n"," synthetic_y_train.append(tf.reshape(mask,[BATCH_SIZE, TARGET_SHAPE[0], TARGET_SHAPE[1], NUM_ANNOTATORS*2]))\n","\n","synthetic_X_train, synthetic_y_train = tf.concat(synthetic_X_train, axis=0), tf.concat(synthetic_y_train, axis=0)\n","print(f'Tensor dimensions with training images: {synthetic_X_train.shape} \\nTensor dimensions with training masks: {synthetic_y_train.shape}')"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:16:12.811125Z","iopub.status.busy":"2024-08-05T01:16:12.810757Z","iopub.status.idle":"2024-08-05T01:16:40.183058Z","shell.execute_reply":"2024-08-05T01:16:40.182133Z","shell.execute_reply.started":"2024-08-05T01:16:12.811089Z"},"id":"5rhZCU_fsyu_","papermill":{"duration":29.01667,"end_time":"2024-06-14T22:25:49.153725","exception":false,"start_time":"2024-06-14T22:25:20.137055","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Loading of the validation part of the database in a tensor manner\n","\n","synthetic_X_val = []\n","synthetic_y_val = []\n","\n","for img, mask in synthetic_val.take(2):\n"," synthetic_X_val.append(img)\n"," synthetic_y_val.append(tf.reshape(mask,[BATCH_SIZE, TARGET_SHAPE[0], TARGET_SHAPE[1], NUM_ANNOTATORS*2]))\n","\n","synthetic_X_val, synthetic_y_val = tf.concat(synthetic_X_val, axis=0), tf.concat(synthetic_y_val, axis=0)\n","print(f'Tensor dimensions with validation images: {synthetic_X_val.shape}\\nTensor dimensions with validation masks: {synthetic_y_val.shape}')"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:16:40.185012Z","iopub.status.busy":"2024-08-05T01:16:40.184721Z","iopub.status.idle":"2024-08-05T01:17:07.401655Z","shell.execute_reply":"2024-08-05T01:17:07.400714Z","shell.execute_reply.started":"2024-08-05T01:16:40.184987Z"},"id":"K-D-SCq3syvA","papermill":{"duration":28.751601,"end_time":"2024-06-14T22:26:17.957026","exception":false,"start_time":"2024-06-14T22:25:49.205425","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Loading of the testing part of the database in a tensor manner\n","\n","synthetic_X_test = []\n","synthetic_y_test = []\n","\n","for img, mask in synthetic_test.take(2):\n"," synthetic_X_test.append(img)\n"," synthetic_y_test.append(tf.reshape(mask,[BATCH_SIZE, TARGET_SHAPE[0], TARGET_SHAPE[1], NUM_ANNOTATORS*2]))\n","\n","synthetic_X_test, synthetic_y_test = tf.concat(synthetic_X_test, axis=0), tf.concat(synthetic_y_test, axis=0)\n","print(f'Tensor dimensions with test images: {synthetic_X_test.shape}\\nTensor dimensions with test masks: {synthetic_y_test.shape}')"]},{"cell_type":"markdown","metadata":{},"source":["## Loss for Tuned Gradual Class-wise Ensemble for Semi-supervised Learning"]},{"cell_type":"markdown","metadata":{},"source":["$$TGCE_{SS}(\\mathbf{Y}_r,f(\\mathbf X;\\theta) | \\mathbf{\\Lambda}_r (\\mathbf X;\\theta)) =\\mathbb E_{r} \\left\\{ \\mathbb E_{w,h} \\left\\{ \\Lambda_r (\\mathbf X; \\theta) \\circ \\mathbb E_k \\bigg\\{ \\mathbf Y_r \\circ \\bigg( \\frac{\\mathbf 1 _{W\\times H \\times K} - f(\\mathbf X;\\theta) ^{\\circ q }}{q} \\bigg); k \\in K \\bigg\\} + \\\\ \\left(\\mathbf 1 _{W \\times H } - \\Lambda _r (\\mathbf X;\\theta) \\right) \\circ \\bigg( \\frac{\\mathbf 1_{W\\times H} - (\\frac {1}{k} \\mathbf 1_{W\\times H})^{\\circ q}}{q} \\bigg); w \\in W, h \\in H \\right\\};r\\in R\\right\\} $$"]},{"cell_type":"code","execution_count":18,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.403404Z","iopub.status.busy":"2024-08-05T01:17:07.403054Z","iopub.status.idle":"2024-08-05T01:17:07.419709Z","shell.execute_reply":"2024-08-05T01:17:07.418763Z","shell.execute_reply.started":"2024-08-05T01:17:07.403371Z"},"trusted":true},"outputs":[],"source":["# Custom loss function: TGCE SS\n","\n","class TGCE_SS(Loss):\n"," \"\"\"Tuned Gradual Class-wise Ensemble for Semi-supervised Learning Loss.\n","\n"," This loss function implements the Tuned Gradual Class-wise Ensemble (TGCE) loss for\n"," semi-supervised learning tasks. It is designed to improve the robustness of models\n"," against noisy annotations by considering the reliability of annotators. The loss function\n"," penalizes the disagreement between the model predictions and the ground truth labels,\n"," taking into account the reliability of annotators.\n","\n"," Methods\n"," ----------\n"," call(y_true, y_pred)\n"," get_config()\n","\n"," \"\"\"\n","\n"," def __init__(self, q=0.1, name='TGCE_SS', R=3, K_=2, smooth=1e-5, fill_channels=1, **kwargs):\n"," \"\"\"Initializes the TGCE_SS loss object.\n","\n"," Parameters:\n"," q (float): The tuning parameter for controlling the smoothness of the ensemble.\n"," Defaults to 0.1.\n"," name (str): Name of the loss function. Defaults to 'TGCE_SS'.\n"," R (int): Number of annotators. Defaults to NUM_ANNOTATORS.\n"," K_ (int): Number of classes. Defaults to 2.\n"," smooth (float): Smoothing parameter to avoid division by zero. Defaults to 1e-5.\n"," fill_channels (int): Number of filler channels. Defaults to 1.\n"," **kwargs: Additional arguments passed to the parent class.\n","\n"," \"\"\"\n"," self.q = q\n"," self.R = R\n"," self.K_ = K_\n"," self.smooth = smooth\n"," self.fill_channels = fill_channels\n"," super().__init__(name=name, **kwargs)\n","\n"," def call(self, y_true, y_pred):\n"," \"\"\"Computes the TGCE_SS loss.\n","\n"," Parameters:\n"," y_true (tensor): Ground truth labels.\n"," y_pred (tensor): Predicted probabilities.\n","\n"," Returns:\n"," Containing the loss value.\n"," \"\"\"\n"," y_pred = y_pred[..., :-self.fill_channels] # Disregarding backfill channels\n"," y_true = tf.reshape(y_true, tuple(y_true.shape[:-1])+(self.K_,self.R))\n"," Lambda_r = y_pred[..., self.K_:] # Annotators reliability -> extra cnn upsampling layer\n"," y_pred_ = y_pred[..., :self.K_] # Segmented images from unet\n"," N, W, H, _ = y_pred_.shape\n"," y_pred_ = y_pred_[..., tf.newaxis]\n"," y_pred_ = tf.repeat(y_pred_, repeats=[self.R], axis=-1) # Repeat f(x)\n"," \n"," epsilon = 1e-8 # Small constant to avoid divisions by zero\n"," y_pred_ = tf.clip_by_value(y_pred_, epsilon, 1.0 - epsilon) # Limiting values between epsilon and 1 - epsilon\n"," \n"," term_r = tf.math.reduce_mean(tf.math.multiply(y_true, (tf.ones([N, W, H, self.K_, self.R]) - tf.pow(y_pred_, self.q)) / (self.q + epsilon + self.smooth)), axis=-2)\n"," term_c = tf.math.multiply(tf.ones([N, W, H, self.R]) - Lambda_r, (tf.ones([N, W, H, self.R]) - tf.pow((1 / self.K_ + self.smooth) * tf.ones([N, W, H, self.R]), self.q)) / (self.q + epsilon + self.smooth))\n"," \n"," # Avoid NaN in final loss function\n"," TGCE_SS = tf.math.reduce_mean(tf.math.multiply(Lambda_r, term_r) + term_c)\n"," if tf.math.is_nan(TGCE_SS):\n"," TGCE_SS = tf.where(tf.math.is_nan(TGCE_SS), tf.constant(1e-8), TGCE_SS) # Replace NaN with 1e-8\n"," print(\"\\nInitializing TGCE_SS \\n\")\n"," \n"," return TGCE_SS / tf.constant(0.5857603) # Divided by the highest possible loss value \n","\n"," def get_config(self):\n"," \"\"\"Gets the configuration of the loss function.\n","\n"," Returns:\n"," A dictionary containing the configuration parameters of the loss function.\n","\n"," \"\"\"\n"," base_config = super().get_config()\n"," return {**base_config, \"q\": self.q}"]},{"cell_type":"markdown","metadata":{},"source":["## Layers definition"]},{"cell_type":"code","execution_count":19,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.421214Z","iopub.status.busy":"2024-08-05T01:17:07.420894Z","iopub.status.idle":"2024-08-05T01:17:07.434696Z","shell.execute_reply":"2024-08-05T01:17:07.433871Z","shell.execute_reply.started":"2024-08-05T01:17:07.421184Z"},"trusted":true},"outputs":[],"source":["# Definition of layers for the neural network structure\n","\n","DefaultConv2D = partial(layers.Conv2D,\n"," kernel_size=3, activation='relu', padding=\"same\")\n","\n","DilatedConv = partial(layers.Conv2D,\n"," kernel_size=3, activation='relu', padding=\"same\", dilation_rate=10, name=\"DilatedConv\")\n","\n","DefaultPooling = partial(layers.MaxPool2D,\n"," pool_size=2)\n","\n","upsample = partial(layers.UpSampling2D, (2,2))\n","\n","def residual_block(x, filters, kernel_initializer, block_name):\n"," shortcut = x\n"," x = DefaultConv2D(filters, kernel_initializer=kernel_initializer, name=f'Conv_{block_name}_1')(x)\n"," x = layers.BatchNormalization(name=f'Batch_{block_name}_1')(x)\n"," x = DefaultConv2D(filters, kernel_initializer=kernel_initializer, name=f'Conv_{block_name}_2')(x)\n"," x = layers.BatchNormalization(name=f'Batch_{block_name}_2')(x)\n"," x = layers.Add(name=f'ResAdd_{block_name}')([shortcut, x])\n"," x = layers.Activation('relu', name=f'ResAct_{block_name}')(x)\n"," return x"]},{"cell_type":"markdown","metadata":{},"source":["## Kernel initializers"]},{"cell_type":"code","execution_count":20,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.435887Z","iopub.status.busy":"2024-08-05T01:17:07.435628Z","iopub.status.idle":"2024-08-05T01:17:07.449094Z","shell.execute_reply":"2024-08-05T01:17:07.448363Z","shell.execute_reply.started":"2024-08-05T01:17:07.435865Z"},"trusted":true},"outputs":[],"source":["def kernel_initializer(seed):\n"," \"\"\"Returns a Glorot uniform initializer for kernel weights.\n","\n"," Glorot uniform initializer, also known as Xavier uniform initializer,\n"," is commonly used to initialize the weights of kernels in neural network layers.\n"," It draws samples from a uniform distribution within a certain range,\n"," calculated to keep the variance of the weights constant across layers.\n"," This initializer is useful for training deep neural networks.\n","\n"," Parameters:\n"," seed (int): Random seed for reproducibility.\n","\n"," Returns:\n"," A Glorot uniform initializer for kernel weights.\n","\n"," \"\"\"\n"," return tf.keras.initializers.GlorotUniform(seed=seed)"]},{"cell_type":"markdown","metadata":{},"source":["## Activation function: Sparse Softmax"]},{"cell_type":"markdown","metadata":{},"source":["$$\\text{SparseSoftmax}(x) = \\frac{\\exp(x - \\text{max}(x))}{\\text{sum}(\\exp(x - \\text{max}(x)))}$$\n","\n","Where:\n","\n","- $x$ is the input tensor.\n","- $\\text{max}(x)$ is the maximum value in the tensor $x$.\n","- $\\text{sum}$ is the sum of the exponential values of $x - \\text{max}(x)$."]},{"cell_type":"code","execution_count":21,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.450800Z","iopub.status.busy":"2024-08-05T01:17:07.450087Z","iopub.status.idle":"2024-08-05T01:17:07.460360Z","shell.execute_reply":"2024-08-05T01:17:07.459710Z","shell.execute_reply.started":"2024-08-05T01:17:07.450777Z"},"trusted":true},"outputs":[],"source":["class SparseSoftmax(Layer):\n"," \"\"\"Custom layer implementing the sparse softmax activation function.\n","\n"," This layer computes the softmax activation function for a given input tensor,\n"," handling sparse input efficiently.\n","\n"," Methods\n"," ----------\n"," build(input_shape)\n"," call(x)\n"," compute_output_shape(input_shape)\n","\n"," \"\"\"\n","\n"," def __init__(self, name='SparseSoftmax', **kwargs):\n"," \"\"\"Initializes the SparseSoftmax layer.\n","\n"," Parameters:\n"," **kwargs: Additional arguments to be passed to the parent class.\n","\n"," \"\"\"\n"," super(SparseSoftmax, self).__init__(name=name,**kwargs)\n","\n"," def build(self, input_shape):\n"," \"\"\"Builds the layer.\n","\n"," Parameters:\n"," input_shape (tuple): Shape of the input tensor.\n","\n"," \"\"\"\n"," super(SparseSoftmax, self).build(input_shape)\n","\n"," def call(self, x):\n"," \"\"\"Computes the output of the layer.\n","\n"," Parameters:\n"," x (tensor): Input tensor.\n","\n"," Returns:\n"," A tensor representing the output of the softmax activation function.\n","\n"," \"\"\"\n"," e_x = K.exp(x - K.max(x, axis=-1, keepdims=True))\n"," sum_e_x = K.sum(e_x, axis=-1, keepdims=True)\n"," output = e_x / (sum_e_x + K.epsilon())\n"," return output\n","\n"," def compute_output_shape(self, input_shape):\n"," \"\"\"Computes the output shape of the layer.\n","\n"," Parameters:\n"," input_shape (tuple): Shape of the input tensor.\n","\n"," Returns:\n"," The same shape as the input tensor.\n","\n"," \"\"\"\n"," return input_shape"]},{"cell_type":"code","execution_count":22,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.461639Z","iopub.status.busy":"2024-08-05T01:17:07.461320Z","iopub.status.idle":"2024-08-05T01:17:07.476250Z","shell.execute_reply":"2024-08-05T01:17:07.475411Z","shell.execute_reply.started":"2024-08-05T01:17:07.461612Z"},"trusted":true},"outputs":[],"source":["tf.keras.utils.get_custom_objects()['sparse_softmax'] = SparseSoftmax()"]},{"cell_type":"markdown","metadata":{},"source":["## Unet Model"]},{"cell_type":"markdown","metadata":{},"source":["![Unet-TGCELoss](https://lh3.googleusercontent.com/fife/ALs6j_FQpKDYXh1PSuK4B7zca2t-aLNDOGiHv3Cx4wnqrj5tDZp7LFygbkh3Pw0t3sIu7Fly0fC7BrL5I8HME3fXUAFPgKIkzPuTL8W1m6kBgaqQf8yMOt89R7PUO4PNgy0dG5DbixazOdTRquMcEzJ1WiYWf33c1gIK9_8eJhDmmhAYutY-HkMQBerxetLXEdSc2euRjPf7yKb44U9MwhfhX7UWt4Scndk6Pn6FQIczftrSXrAkpm1wQ3KqEuvtfRyffpoYAc48uZ2SYu9G22X9ZIyWBiGhQbuOe1MpW27lJ8SAtXcG5BIt6jy55NTFSWeh0AhuVM-3gwKhTOYqwy4C0lcbXQJ8XobTaWAQWxSyCPHkGfsccxwkILRi9-13j7Bd22ZReapWyu7w0Yrn4I2qxpvJ7kiVjElZWw8foKitEHsELCqLOKcJXrGQGr0qo9maTPzU_aLVYObrDrvndmdOSfkThd2hYswinp75TaoDSMOa3XJIK-02Rv9uS3S8w6VaWX3kggtxDeGlUyfLs8zBOj9SI0sZ8X8l0fd3nFUgOb1lTf29Eod57vzVICMMQvWO0sgabPavO7QxiMt5EvcJHrdZz0U1OYtC91SAszpd58JQSKPChrRaYjIiPNZPWdkFkztzFhClTMlgw8U6SUTSWHYJEDXFeb15Dnv4kNENTV0zpBT6PCdrdpqsNMnhGPGpaCeVPivt85Em8mz1I5YApYKKstjP-L5GG3cCSM3KSe2lu13cVZoBHDXAVUfmqlGgj37MGYsAi5V8U-S4G7Xtun40AYqxRC4OhptA2AdShQ6JOdPfKAlmhLy4rH9Ae1Euu3KrCcYuFY_-_x0POr45C7ouP5uyOAgtWDvM75yyAYkSBVqMYKV-VFnLW_piSQNsZiQXwqjiCGYTi4eYJVsn8TatuJW7o6L1MlO5qdtdgrWNN4lNTl1_CFB8b55wrzZgCxjuuUUGRKU1hA8cEtECtktWbUhfrwvgdCU7-fvuUMIZF7OBizlzGXQ-tYYbQjGpUzfSq19efU_9Wqj8Fep5fNRKuLRTLVP4d-GLy7ecoHbYR-bDx-Ln3oTiiEJ7n1_H6vrRskybpNN_eGhokwxNy3_9h2jWeEAxwWJn6tMf19lkpwdsYanf-VTp5SthSoWb7BA7_qGGXScorMXbbFlKGjAfYKLuXLapcO2wy1yvQe87fggoTkyECfNg_3ie_TdEZlmhdvjAX0oNNOFH6KOsck3WbRdB3cOyICd872hkS0QNB8TxdPVRAR_2ifRxBKOygqBYA0WKEVl2VPCnDDfmwJp401ORkk6AFEZssaKzWinP9Kt3Xo436vo_983b8oNLowlhfeJpHR9iWl9iaHxwU_LShYvCrG8L_eLeaPFAVVXgpPF31KGgeKOSFoaEDvO5OpMrPJ0HrDZPZSXw6KMNtf0B0t_1R6OJoD9OpJSAvUVrVd9xxnsVJxZGSGFr28MNrSJ1gl9PRPyLalFiakDhxYO2PwshZJrzf-GaUANkRx-lJpnzPkqlqcMxl1HNDYSnY73A3sb3kLJe7m_eq0EfCpJkTK4oNPF6-fS1YcQguS8BKnlMXdWfTTywv6Cjhb7ROe1qB83tCtU7syhVEuTzMohgcm-5jT-AOtGJX-WGQny3mboNKZU0j_y9sHAJD7UmTihwutj4Hr8eF1yFUbOTdw=w1632-h928)"]},{"cell_type":"code","execution_count":23,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.478034Z","iopub.status.busy":"2024-08-05T01:17:07.477364Z","iopub.status.idle":"2024-08-05T01:17:07.487026Z","shell.execute_reply":"2024-08-05T01:17:07.486184Z","shell.execute_reply.started":"2024-08-05T01:17:07.478005Z"},"trusted":true},"outputs":[],"source":["ResNet34, preprocess_input = Classifiers.get('resnet34')"]},{"cell_type":"code","execution_count":24,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:17:07.488311Z","iopub.status.busy":"2024-08-05T01:17:07.488044Z","iopub.status.idle":"2024-08-05T01:17:07.504858Z","shell.execute_reply":"2024-08-05T01:17:07.504018Z","shell.execute_reply.started":"2024-08-05T01:17:07.488290Z"},"trusted":true},"outputs":[],"source":["def unet_model(input_shape=(256,256,3), name='UNET', out_channels=2, out_filler_channels=1, n_scorers=3):\n"," \"\"\"\n"," Builds a U-Net model for image segmentation.\n","\n"," Parameters:\n"," - input_shape (tuple): Shape of the input images, default is (128, 128, 3).\n"," - name (str): Name of the model, default is 'UNET'.\n"," - out_channels (int): Number of output channels, default is 2.\n"," - out_filler_channels (int): Number of filler output channels, default is 1.\n"," - n_scorers (int): Number of scorer channels, default is 3.\n","\n"," Returns:\n"," - model (tensorflow.keras.Model): The constructed U-Net model.\n","\n"," The model consists of an encoder and decoder with multiple convolutional, batch normalization, and dropout layers. \n"," It also includes upsampling and concatenation steps to maintain spatial dimensions during decoding.\n"," \"\"\"\n"," # Backbone\n"," backbone = ResNet34(input_shape=input_shape, weights='imagenet', include_top=False)\n"," \n"," for layer in backbone.layers: # Freeze all layers except BatchNormalization layers\n"," if not isinstance(layer, layers.BatchNormalization): \n"," layer.trainable = False\n","\n"," input = backbone.input\n"," level_1 = backbone.layers[5].output #128x128x64\n"," level_2 = backbone.layers[37].output #64x64x64t\n"," level_3 = backbone.layers[74].output #32x32x128\n"," level_4 = backbone.layers[129].output #16x16x256\n"," x = backbone.layers[157].output #8x8x512\n","\n"," # Decoder\n"," x = upsample(name='Up60')(x) # 8x8 -> 16x16\n"," x = layers.Concatenate(name='Concat60')([level_4, x])\n"," x = DefaultConv2D(256, kernel_initializer=kernel_initializer(91), name='Conv60')(x)\n"," x = residual_block(x, 256, kernel_initializer(47), '60')\n","\n"," x = upsample(name='Up70')(x) # 16x16 -> 32x32\n"," x = layers.Concatenate(name='Concat70')([level_3, x])\n"," x = DefaultConv2D(128, kernel_initializer=kernel_initializer(21), name='Conv70')(x)\n"," x = residual_block(x, 128, kernel_initializer(96), '70')\n","\n"," x = upsample(name='Up80')(x) # 32x32 -> 64x64\n"," x = layers.Concatenate(name='Concat80')([level_2, x])\n"," x = DefaultConv2D(64, kernel_initializer=kernel_initializer(96), name='Conv80')(x)\n"," x = residual_block(x, 64, kernel_initializer(98), '80')\n","\n"," x = upsample(name='Up90')(x) # 64x64 -> 128x128\n"," x = layers.Concatenate(name='Concat90')([level_1, x])\n"," x = DefaultConv2D(32, kernel_initializer=kernel_initializer(35), name='Conv90')(x)\n"," x = residual_block(x, 32, kernel_initializer(7), '90')\n"," \n"," x = upsample(name='Up100')(x) # 128x128 -> 256x256\n"," x = layers.Concatenate(name='Concat100')([input, x])\n"," x = DefaultConv2D(16, kernel_initializer=kernel_initializer(45), name='Conv100')(x)\n"," x = residual_block(x, 16, kernel_initializer(7), '100')\n","\n"," xy = DefaultConv2D(out_channels, kernel_size=(1, 1), activation='sparse_softmax',\n"," kernel_initializer=kernel_initializer(42), name='Conv200')(x)\n"," x_lambda = DilatedConv(n_scorers, kernel_size=(1, 1), activation='sparse_softmax',\n"," kernel_initializer=kernel_initializer(42), name='DilatedConv200-Lambda')(x)\n"," xyy = DefaultConv2D(out_filler_channels, kernel_size=(1, 1),\n"," kernel_initializer=kernel_initializer(42),\n"," name='Conv201')(x)\n","\n"," y = layers.Concatenate(name='Concat200')([xy, x_lambda, xyy])\n"," model = Model(input, y, name=name)\n","\n"," return model"]},{"cell_type":"markdown","metadata":{},"source":["## Train model"]},{"cell_type":"code","execution_count":53,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T03:17:54.002902Z","iopub.status.busy":"2024-08-05T03:17:54.002142Z","iopub.status.idle":"2024-08-05T03:17:54.008290Z","shell.execute_reply":"2024-08-05T03:17:54.007366Z","shell.execute_reply.started":"2024-08-05T03:17:54.002868Z"},"trusted":true},"outputs":[],"source":["class ChangeLearningRateCallback(keras.callbacks.Callback):\n"," def on_epoch_end(self, epoch, logs=None):\n"," if epoch == 57:\n"," new_lr = 0.000493612 # New learning rate\n"," keras.backend.set_value(self.model.optimizer.lr, new_lr)\n"," print(f\"\\nSet learning rate a {new_lr}\")\n","change_lr_callback = ChangeLearningRateCallback()"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T03:17:55.960765Z","iopub.status.busy":"2024-08-05T03:17:55.959488Z","iopub.status.idle":"2024-08-05T03:49:36.243845Z","shell.execute_reply":"2024-08-05T03:49:36.243047Z","shell.execute_reply.started":"2024-08-05T03:17:55.960729Z"},"trusted":true},"outputs":[],"source":["model = unet_model()\n","\n","model.compile(optimizer=Adam(learning_rate=0.00093612),\n"," loss=TGCE_SS(q=0.48029, R=NUM_ANNOTATORS, K_=2, fill_channels=1))\n","\n","history = model.fit(synthetic_X_train,synthetic_y_train, epochs=100, validation_data=(synthetic_X_val,synthetic_y_val), callbacks=[change_lr_callback])"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:12:46.070444Z","iopub.status.busy":"2024-08-05T04:12:46.069559Z","iopub.status.idle":"2024-08-05T04:12:46.300544Z","shell.execute_reply":"2024-08-05T04:12:46.299655Z","shell.execute_reply.started":"2024-08-05T04:12:46.070407Z"},"trusted":true},"outputs":[],"source":["# Extract loss values\n","train_loss = history.history['loss']\n","val_loss = history.history['val_loss']\n","\n","# Create a list with the number of epochs\n","epochs = range(1, len(train_loss) + 1)\n","\n","# Create the chart\n","plt.figure(figsize=(12, 6))\n","plt.plot(epochs, train_loss, 'b', label='Training loss')\n","plt.plot(epochs, val_loss, 'r', label='Validation loss')\n","plt.title('Training and Validation Loss')\n","plt.xlabel('Epochs')\n","plt.ylabel('Loss')\n","plt.legend()\n","\n","# Show the graph\n","plt.show()"]},{"cell_type":"markdown","metadata":{},"source":["## Visualize performance"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:13:03.043703Z","iopub.status.busy":"2024-08-05T04:13:03.043326Z","iopub.status.idle":"2024-08-05T04:13:13.529059Z","shell.execute_reply":"2024-08-05T04:13:13.528247Z","shell.execute_reply.started":"2024-08-05T04:13:03.043674Z"},"trusted":true},"outputs":[],"source":["model_y_train = model.predict(synthetic_X_train)\n","model_y_val = model.predict(synthetic_X_val)\n","model_y_test = model.predict(synthetic_X_test)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:13:15.398822Z","iopub.status.busy":"2024-08-05T04:13:15.398460Z","iopub.status.idle":"2024-08-05T04:13:16.115563Z","shell.execute_reply":"2024-08-05T04:13:16.114605Z","shell.execute_reply.started":"2024-08-05T04:13:15.398795Z"},"trusted":true},"outputs":[],"source":["rows, columns = 4,3\n","sample = 333\n","fig, axes = plt.subplots(rows,columns,figsize=(15,8))\n","\n","axes[0,0].imshow(original_X_train[sample])\n","axes[0,0].set_title('Image in original train')\n","axes[0,2].imshow(synthetic_X_train[sample])\n","axes[0,2].set_title('Image in synthetic train')\n","\n","axes[1,1].imshow(original_y_train[sample])\n","axes[1,1].set_title('Original mask for image')\n","\n","axes[2,0].imshow(synthetic_y_train[sample,:,:,0])\n","axes[2,0].set_title('Annotator 1 mask for image')\n","axes[2,1].imshow(synthetic_y_train[sample,:,:,1])\n","axes[2,1].set_title('Annotator 2 mask for image')\n","axes[2,2].imshow(synthetic_y_train[sample,:,:,2])\n","axes[2,2].set_title('Annotator 3 mask for image')\n","\n","axes[3,1].imshow(model_y_train[sample,:,:,0])\n","axes[3,1].set_title('Model mask for image')\n","\n","[axes[i, k].axis('off') for i in range(rows) for k in range(columns)]"]},{"cell_type":"markdown","metadata":{"id":"v3wYQJGH0jL5","papermill":{"duration":0.051113,"end_time":"2024-06-14T22:26:20.598757","exception":false,"start_time":"2024-06-14T22:26:20.547644","status":"completed"},"tags":[]},"source":["## Definition of performance metrics"]},{"cell_type":"markdown","metadata":{"id":"z0Gtcw3m0jL5","papermill":{"duration":0.050743,"end_time":"2024-06-14T22:26:20.700381","exception":false,"start_time":"2024-06-14T22:26:20.649638","status":"completed"},"tags":[]},"source":["### DICE metric"]},{"cell_type":"markdown","metadata":{"id":"fnX2NgqG0jL5","papermill":{"duration":0.050022,"end_time":"2024-06-14T22:26:20.800816","exception":false,"start_time":"2024-06-14T22:26:20.750794","status":"completed"},"tags":[]},"source":["$$\\text{Dice} = {2 \\cdot |\\text{Intersection}| + \\text{smooth} \\over |\\text{Union}| + \\text{smooth}}$$\n","\n","Where:\n","\n","$|\\text{Intersection}| = \\sum_{i=1}^{N} y\\_{true\\_i} \\cdot y\\_{pred\\_i}$, $|\\text{Union}| = \\sum_{i=1}^{N} y\\_{true\\_i} + \\sum_{i=1}^{N} y\\_{pred\\_i}$\n","\n","\n","- $N$ is the total number of elements in the segmentation masks.\n","- $y\\_{true\\_i}$ and $y\\_{pred\\_i}$ represent the value of the i-th element in the ground truth and predicted segmentation masks, respectively.\n","- $\\text{smooth}$ is a smoothing parameter to avoid division by zero."]},{"cell_type":"code","execution_count":39,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T02:37:49.677913Z","iopub.status.busy":"2024-08-05T02:37:49.676946Z","iopub.status.idle":"2024-08-05T02:37:49.687341Z","shell.execute_reply":"2024-08-05T02:37:49.686200Z","shell.execute_reply.started":"2024-08-05T02:37:49.677872Z"},"id":"uYjk3Vj20jL5","papermill":{"duration":0.060715,"end_time":"2024-06-14T22:26:20.911909","exception":false,"start_time":"2024-06-14T22:26:20.851194","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Definition of the DiceCoefficientMetric\n","\n","def dice_metric(y_true, y_pred, axis=(1, 2), smooth=1e-5):\n"," \"\"\"Computes the Dice coefficient metric for evaluating semantic segmentation.\n","\n"," This function calculates the Dice coefficient metric, which measures the similarity\n"," between ground truth and predicted segmentation masks.\n","\n"," Parameters:\n"," y_true (tensor): Ground truth segmentation masks.\n"," y_pred (tensor): Predicted segmentation masks.\n"," axis (tuple of int): Axis along which to compute sums. Defaults to (1, 2).\n"," smooth (float): A smoothing parameter to avoid division by zero. Defaults to 1e-5.\n"," num_annotators (int): Number of annotators. Defaults to 3.\n","\n"," Returns:\n"," A scalar value representing the average Dice coefficient metric.\n"," \"\"\"\n"," y_true = tf.cast(tf.squeeze(y_true, axis=-1), tf.float32)\n"," y_pred = tf.cast(y_pred, tf.float32)\n"," y_pred = tf.where(y_pred> 0.5, tf.ones_like(y_pred), tf.zeros_like(y_pred))\n"," intersection = tf.reduce_sum(y_true * y_pred, axis=axis)\n"," union = tf.reduce_sum(y_true, axis=axis) + tf.reduce_sum(y_pred, axis=axis)\n"," dice = (2. * intersection + smooth) / (union + smooth)\n"," return tf.reduce_mean(dice)"]},{"cell_type":"markdown","metadata":{"id":"rRNiKRbB0jL5","papermill":{"duration":0.051593,"end_time":"2024-06-14T22:26:21.014806","exception":false,"start_time":"2024-06-14T22:26:20.963213","status":"completed"},"tags":[]},"source":["### Jaccard metric"]},{"cell_type":"markdown","metadata":{"id":"4oITKb_v0jL5","papermill":{"duration":0.053652,"end_time":"2024-06-14T22:26:21.120269","exception":false,"start_time":"2024-06-14T22:26:21.066617","status":"completed"},"tags":[]},"source":["$$\\text{Jaccard} = {|\\text{Intersection}| + \\text{smooth} \\over |\\text{Union}| + \\text{smooth}}$$\n","\n","Where:\n","\n","$|\\text{Intersection}| = \\sum_{i=1}^{N} y\\_{true\\_i} \\cdot y\\_{pred\\_i}$, $|\\text{Union}| = \\sum_{i=1}^{N} y\\_{true\\_i} + \\sum_{i=1}^{N} y\\_{pred\\_i} - |\\text{Intersection}|$\n","- $N$ is the total number of elements in the segmentation masks.\n","- $y\\_{true\\_i}$ and $y\\_{pred\\_i}$ represent the value of the i-th element in the ground truth and predicted segmentation masks, respectively.\n","- $\\text{smooth}$ is a small smoothing parameter to avoid division by zero."]},{"cell_type":"code","execution_count":29,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:38:02.535193Z","iopub.status.busy":"2024-08-05T01:38:02.534956Z","iopub.status.idle":"2024-08-05T01:38:02.548605Z","shell.execute_reply":"2024-08-05T01:38:02.547760Z","shell.execute_reply.started":"2024-08-05T01:38:02.535172Z"},"id":"0F8KNADG0jL5","papermill":{"duration":0.061982,"end_time":"2024-06-14T22:26:21.236628","exception":false,"start_time":"2024-06-14T22:26:21.174646","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Definition of the JaccardMetric\n","\n","def jaccard_metric(y_true, y_pred, axis=(1, 2), smooth=1e-5, num_annotators=3):\n"," \"\"\"Computes the Jaccard similarity coefficient as a metric for semantic segmentation.\n","\n"," The Jaccard similarity coefficient, also known as the Intersection over Union (IoU),\n"," measures the similarity between two sets by comparing their intersection to their union.\n"," In the context of semantic segmentation, it quantifies the overlap between the ground\n"," truth segmentation masks and the predicted segmentation masks.\n","\n"," Parameters:\n"," y_true (tensor): Ground truth segmentation masks.\n"," y_pred (tensor): Predicted segmentation masks.\n"," axis (tuple of int): Axes along which to compute sums. Defaults to (1, 2).\n"," smooth (float): A small smoothing parameter to avoid division by zero. Defaults to 1e-5.\n"," num_annotators (int): Number of annotators. Defaults to 3.\n","\n"," Returns:\n"," A tensor representing the mean Jaccard similarity coefficient.\n","\n"," \"\"\" \n"," y_true = tf.cast(tf.squeeze(y_true, axis=-1), tf.float32)\n"," y_pred = tf.cast(y_pred, tf.float32)\n"," y_pred = tf.where(y_pred> 0.5, tf.ones_like(y_pred), tf.zeros_like(y_pred))\n"," intersection = tf.reduce_sum(y_true * y_pred, axis=axis)\n"," union = tf.reduce_sum(y_true, axis=axis) + tf.reduce_sum(y_pred, axis=axis) - intersection\n"," jaccard = (intersection + smooth) / (union + smooth)\n"," return tf.reduce_mean(jaccard)"]},{"cell_type":"markdown","metadata":{"id":"bqmOPI3P0jL5","papermill":{"duration":0.050033,"end_time":"2024-06-14T22:26:21.336830","exception":false,"start_time":"2024-06-14T22:26:21.286797","status":"completed"},"tags":[]},"source":["### Sensitivity metric"]},{"cell_type":"markdown","metadata":{"id":"xfvJITFI0jL5","papermill":{"duration":0.050271,"end_time":"2024-06-14T22:26:21.438148","exception":false,"start_time":"2024-06-14T22:26:21.387877","status":"completed"},"tags":[]},"source":["$$\\text{Sensitivity} = {\\text{True Positives} \\over \\text{Actual Positives} + \\text{smooth}}$$\n","\n","Where:\n","\n","$\\text{True Positives} = \\sum_{i=1}^{N} y\\_{true\\_i} \\cdot y\\_{pred\\_i}$, $\\text{Actual Positives} = \\sum_{i=1}^{N} y\\_{true\\_i}$\n","\n","\n","- $N$ is the total number of elements in the labels.\n","- $y\\_{true\\_i}$ and $y\\_{pred\\_i}$ represent the value of the i-th element in the ground truth and predicted labels, respectively.\n","- $\\text{smooth}$ is a small value added to the denominator to avoid division by zero."]},{"cell_type":"code","execution_count":30,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:38:02.550211Z","iopub.status.busy":"2024-08-05T01:38:02.549754Z","iopub.status.idle":"2024-08-05T01:38:02.563467Z","shell.execute_reply":"2024-08-05T01:38:02.562623Z","shell.execute_reply.started":"2024-08-05T01:38:02.550187Z"},"id":"OOHnQM4S0jL5","papermill":{"duration":0.062947,"end_time":"2024-06-14T22:26:21.554380","exception":false,"start_time":"2024-06-14T22:26:21.491433","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Definition of the SensitivityMetric\n","\n","def sensitivity_metric(y_true, y_pred, axis=(1, 2), smooth=1e-5, num_annotators=3):\n"," \"\"\"Computes the sensitivity as a metric for semantic segmentation.\n","\n"," Sensitivity, also known as true positive rate or recall, measures the proportion\n"," of actual positives that are correctly identified by the model. It is computed\n"," as the ratio of true positives to the sum of true positives and false negatives.\n","\n"," Parameters:\n"," y_true (tensor): Ground truth labels.\n"," y_pred (tensor): Predicted probabilities or labels.\n"," axis (tuple): Axes over which to perform the reduction. Defaults to (1, 2).\n"," smooth (float): A small value added to the denominator to avoid division by zero. Defaults to 1e-5.\n"," num_annotators (int): Number of annotators. Defaults to 3.\n","\n"," Returns:\n"," The sensitivity metric averaged over the specified axes.\n","\n"," \"\"\"\n"," y_true = tf.cast(tf.squeeze(y_true, axis=-1), tf.float32)\n"," y_pred = tf.cast(y_pred, tf.float32)\n"," y_pred = tf.where(y_pred> 0.5, tf.ones_like(y_pred), tf.zeros_like(y_pred))\n"," true_positives = tf.reduce_sum(y_true * y_pred, axis=axis)\n"," actual_positives = tf.reduce_sum(y_true, axis=axis)\n"," sensitivity = true_positives / (actual_positives + smooth)\n"," return tf.reduce_mean(sensitivity)"]},{"cell_type":"markdown","metadata":{"id":"479663ou0jL6","papermill":{"duration":0.050162,"end_time":"2024-06-14T22:26:21.654744","exception":false,"start_time":"2024-06-14T22:26:21.604582","status":"completed"},"tags":[]},"source":["### Specificity metric"]},{"cell_type":"markdown","metadata":{"id":"QMxbXz880jL6","papermill":{"duration":0.051065,"end_time":"2024-06-14T22:26:21.757178","exception":false,"start_time":"2024-06-14T22:26:21.706113","status":"completed"},"tags":[]},"source":["$$\\text{Specificity} = {\\text{True Negatives} \\over \\text{Actual Negatives} + \\text{smooth}}$$\n","\n","Where:\n","\n","$\\text{True Negatives} = \\sum_{i=1}^{N} (1 - y\\_{true\\_i}) \\cdot (1 - y\\_{pred\\_i})$, $\\text{Actual Negatives} = \\sum_{i=1}^{N} (1 - y\\_{true\\_i})$\n","\n","- $N$ is the total number of samples.\n","- $y\\_{true\\_i}$ and $y\\_{pred\\_i}$ represent the ground truth label and predicted probability (or binary prediction) for the i-th sample, respectively.\n","- $\\text{smooth}$ is a smoothing term to avoid division by zero."]},{"cell_type":"code","execution_count":31,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T01:38:02.564931Z","iopub.status.busy":"2024-08-05T01:38:02.564608Z","iopub.status.idle":"2024-08-05T01:38:02.578124Z","shell.execute_reply":"2024-08-05T01:38:02.577193Z","shell.execute_reply.started":"2024-08-05T01:38:02.564902Z"},"id":"umqjCkUA0jL6","papermill":{"duration":0.060138,"end_time":"2024-06-14T22:26:21.868309","exception":false,"start_time":"2024-06-14T22:26:21.808171","status":"completed"},"tags":[],"trusted":true},"outputs":[],"source":["# Definition of the SpecificityMetric\n","\n","def specificity_metric(y_true, y_pred, axis=(1, 2), smooth=1e-5, num_annotators=3):\n"," \"\"\"Computes the specificity as a metric for semantic segmentation.\n","\n"," Specificity measures the proportion of actual negative cases that were correctly\n"," identified as such. It is complementary to sensitivity (recall).\n","\n"," Parameters:\n"," y_true (tensor): Ground truth binary labels.\n"," y_pred (tensor): Predicted probabilities or binary predictions.\n"," axis (tuple): Axes over which to perform reduction. Defaults to (1, 2).\n"," smooth (float): Smoothing term to avoid division by zero. Defaults to 1e-5.\n"," num_annotators (int): Number of annotators. Defaults to 3.\n","\n"," Returns:\n"," A tensor representing the specificity metric.\n","\n"," \"\"\"\n"," y_true = tf.cast(tf.squeeze(y_true, axis=-1), tf.float32)\n"," y_pred = tf.cast(y_pred, tf.float32)\n"," y_pred = tf.where(y_pred> 0.5, tf.ones_like(y_pred), tf.zeros_like(y_pred))\n"," true_negatives = tf.reduce_sum((1 - y_true) * (1 - y_pred), axis=axis)\n"," actual_negatives = tf.reduce_sum(1 - y_true, axis=axis)\n"," specificity = true_negatives / (actual_negatives + smooth)\n"," return tf.reduce_mean(specificity)"]},{"cell_type":"markdown","metadata":{},"source":["## Measuring performance with metrics for model's predictions"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:13:25.865739Z","iopub.status.busy":"2024-08-05T04:13:25.864996Z","iopub.status.idle":"2024-08-05T04:13:26.551052Z","shell.execute_reply":"2024-08-05T04:13:26.550109Z","shell.execute_reply.started":"2024-08-05T04:13:25.865706Z"},"trusted":true},"outputs":[],"source":["dice_model_y_train = dice_metric(original_y_train,model_y_train[:,:,:,0])\n","dice_model_y_val = dice_metric(original_y_val,model_y_val[:,:,:,0])\n","dice_model_y_test = dice_metric(original_y_test,model_y_test[:,:,:,0])\n","print(dice_model_y_train,dice_model_y_val,dice_model_y_test)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:13:29.446716Z","iopub.status.busy":"2024-08-05T04:13:29.446097Z","iopub.status.idle":"2024-08-05T04:13:30.128990Z","shell.execute_reply":"2024-08-05T04:13:30.127988Z","shell.execute_reply.started":"2024-08-05T04:13:29.446678Z"},"trusted":true},"outputs":[],"source":["jaccard_model_y_train = jaccard_metric(original_y_train,model_y_train[:,:,:,0])\n","jaccard_model_y_val = jaccard_metric(original_y_val,model_y_val[:,:,:,0])\n","jaccard_model_y_test = jaccard_metric(original_y_test,model_y_test[:,:,:,0])\n","print(jaccard_model_y_train,jaccard_model_y_val,jaccard_model_y_test)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:13:31.097227Z","iopub.status.busy":"2024-08-05T04:13:31.096807Z","iopub.status.idle":"2024-08-05T04:13:31.778734Z","shell.execute_reply":"2024-08-05T04:13:31.777684Z","shell.execute_reply.started":"2024-08-05T04:13:31.097199Z"},"trusted":true},"outputs":[],"source":["sensitivity_model_y_train = sensitivity_metric(original_y_train,model_y_train[:,:,:,0])\n","sensitivity_model_y_val = sensitivity_metric(original_y_val,model_y_val[:,:,:,0])\n","sensitivity_model_y_test = sensitivity_metric(original_y_test,model_y_test[:,:,:,0])\n","print(sensitivity_model_y_train,sensitivity_model_y_val,sensitivity_model_y_test)"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-08-05T04:13:32.682804Z","iopub.status.busy":"2024-08-05T04:13:32.682237Z","iopub.status.idle":"2024-08-05T04:13:33.365788Z","shell.execute_reply":"2024-08-05T04:13:33.364876Z","shell.execute_reply.started":"2024-08-05T04:13:32.682772Z"},"trusted":true},"outputs":[],"source":["specificity_model_y_train = specificity_metric(original_y_train,model_y_train[:,:,:,0])\n","specificity_model_y_val = specificity_metric(original_y_val,model_y_val[:,:,:,0])\n","specificity_model_y_test = specificity_metric(original_y_test,model_y_test[:,:,:,0])\n","print(specificity_model_y_train,specificity_model_y_val,specificity_model_y_test)"]}],"metadata":{"accelerator":"GPU","colab":{"machine_shape":"hm","provenance":[]},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[],"dockerImageVersionId":30747,"isGpuEnabled":true,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"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","version":"3.10.13"},"papermill":{"default_parameters":{},"duration":5295.356001,"end_time":"2024-06-14T23:49:21.644977","environment_variables":{},"exception":null,"input_path":"__notebook__.ipynb","output_path":"__notebook__.ipynb","parameters":{},"start_time":"2024-06-14T22:21:06.288976","version":"2.5.0"},"widgets":{"application/vnd.jupyter.widget-state+json":{"state":{"005606ee5a494faeaf1bf8e0270db84a":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"006ae15aaf3143648cdf15c646650fae":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_acde00af91a24ff5b4b0abc1edf43430","placeholder":"​","style":"IPY_MODEL_e59da96fd42b4a20b6db25749b73dc0d","value":" 2401/3669 [00:01<00:00, 2400.80 examples/s]"}},"0159f244200848f6945e7dfacaaa1abe":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_b4c2712b60304a4e8a799e7e003f6f8e","IPY_MODEL_532336458080415cbcbe5393aaf3f4f1","IPY_MODEL_1bda1de335764e94a0f0e42ebb7f6152"],"layout":"IPY_MODEL_77171776686f4194b7f84c19cec7978d"}},"026a366582bf42f8922bcaf9d30a99bb":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_502da723a63b45d2b19039f5d5054758","placeholder":"​","style":"IPY_MODEL_09587696dcab4455ad055af851ad49d3","value":"Extraction completed...: 100%"}},"09587696dcab4455ad055af851ad49d3":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"0a1425bfe4be4562bc3df43d6cfded6d":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"0bd46eea31e04dcba872dcddc7920808":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"0f72964af9cb4c6ea53afd0260720ad3":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"11f665dcd5b64e05aceee079c8dbd026":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_43ccee349b2747a0be87d5d3248737a0","placeholder":"​","style":"IPY_MODEL_80947d765a5044b2a6927e92677e3569","value":" 18473/18473 [01:00<00:00, 407.24 file/s]"}},"12d94750ffaf40cc8ada82d4333a934a":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"155bec38b5774dabb1357e5bcc0f9970":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":"hidden","width":null}},"1bda1de335764e94a0f0e42ebb7f6152":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_3d19a4862c614f9c99c3357094e6ce20","placeholder":"​","style":"IPY_MODEL_b3ae542f45bb43e99aadf046f46eef3d","value":" 2/2 [00:04<00:00,  2.03s/ splits]"}},"1e92482d195d497292dce5842c3fc0df":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"","description":"","description_tooltip":null,"layout":"IPY_MODEL_7549a9593dfc4724a5bfb9d71f304b1b","max":3680,"min":0,"orientation":"horizontal","style":"IPY_MODEL_be259e16a5e84b3c8877a3389fcb5084","value":3680}},"2647dc8f567e4dbc889335ac4aa89cc0":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"271f273764e0489dba9b12e88ffef6df":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"2b2688aa677649fe91b961c6c156253d":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"314ea283a51a4806bce462043b6d02f0":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_410ffd7887b840a88f6d2dbf88d86829","placeholder":"​","style":"IPY_MODEL_fd26d482d0e142e393a7862fb4f6a2f9","value":" 3504/3669 [00:00<00:00, 8937.57 examples/s]"}},"32ff97353bc94f0683a8cd59dadc326b":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_ddba3ee548e84591add61139cf4436d0","placeholder":"​","style":"IPY_MODEL_5baf563a35134c279cf058fb4f3ae36d","value":" 2177/3680 [00:01<00:00, 2176.22 examples/s]"}},"367954210a384b9fa0e663268a973e44":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"3839b7535fa54db48b6f782cbbbde60d":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_eef64ca4183e432e84723664c5b5b801","placeholder":"​","style":"IPY_MODEL_2b2688aa677649fe91b961c6c156253d","value":" 2/2 [01:00<00:00, 24.58s/ url]"}},"3d19a4862c614f9c99c3357094e6ce20":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"3dd19a09389d48e796980ea459462daa":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"40f8dc9830cd41a381294f36eeefb185":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_417050a8affd426eab336aa2cafee330","IPY_MODEL_b117e14474d54b3b89834543ab4a4727","IPY_MODEL_3839b7535fa54db48b6f782cbbbde60d"],"layout":"IPY_MODEL_84b547c8372c41618abe50d88cfaabc2"}},"410ffd7887b840a88f6d2dbf88d86829":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"417050a8affd426eab336aa2cafee330":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_8560465023024714ac3e3adaf1adcef4","placeholder":"​","style":"IPY_MODEL_4b1daed1cc5943c785c918de008b7bd9","value":"Dl Completed...: 100%"}},"43ccee349b2747a0be87d5d3248737a0":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"4ac60e4cc1f5495ea711eda916a6d616":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_0a1425bfe4be4562bc3df43d6cfded6d","placeholder":"​","style":"IPY_MODEL_80bd8aee73214d429eb039b4e90dd793","value":"Shuffling /root/tensorflow_datasets/oxford_iiit_pet/3.2.0.incompleteQ40T4C/oxford_iiit_pet-train.tfrecord*...:  81%"}},"4b1daed1cc5943c785c918de008b7bd9":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"4cb400ec99f4475a9aa90275377a5265":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"","description":"","description_tooltip":null,"layout":"IPY_MODEL_cb0fd86a7337486fa68ee270b4e8c446","max":3669,"min":0,"orientation":"horizontal","style":"IPY_MODEL_7f248c5edfd24242aee15bc14f756eff","value":3669}},"4d03ba4a13f0464080a10f3b6eef99d7":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"4d4506c10d024b3ab1cb98403e340eef":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"","description":"","description_tooltip":null,"layout":"IPY_MODEL_271f273764e0489dba9b12e88ffef6df","max":3680,"min":0,"orientation":"horizontal","style":"IPY_MODEL_c1a8ea16efed4556b46186ec9fd6b9d4","value":3680}},"502da723a63b45d2b19039f5d5054758":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"51434e7b15b04e69821d084a0f37d41e":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_eda3c04c93f44780bb7cb01c3af371d0","placeholder":"​","style":"IPY_MODEL_0bd46eea31e04dcba872dcddc7920808","value":" 2977/3680 [00:00<00:00, 9851.02 examples/s]"}},"523c897f21dc4db588171682b3d12767":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":"hidden","width":null}},"532336458080415cbcbe5393aaf3f4f1":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"","description":"","description_tooltip":null,"layout":"IPY_MODEL_8feb82cf26d743bd91c9e65db16f5b38","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_813ff9371f644e59b19451f36ea7b831","value":2}},"5609ded263824dd99e3e2ff5b1db27ac":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"59442a843bce4a9daf22bfc08d77f652":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_026a366582bf42f8922bcaf9d30a99bb","IPY_MODEL_bc1a5c556793481eaf77cce089e24e39","IPY_MODEL_11f665dcd5b64e05aceee079c8dbd026"],"layout":"IPY_MODEL_5609ded263824dd99e3e2ff5b1db27ac"}},"5baf563a35134c279cf058fb4f3ae36d":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"6632b0052b4b430bab478c7e08c86646":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":"hidden","width":null}},"6736a0ea3f1144c5ac0f31668159a6dc":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_905ac081406c4587b578de7f44279963","max":1,"min":0,"orientation":"horizontal","style":"IPY_MODEL_992e1e90ca24475a8a3c981757e2d746","value":1}},"6f0cce1c5b7a42159e77f84974d9c71a":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"71ca5c556b89433386c286823ea6d2ba":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"7549a9593dfc4724a5bfb9d71f304b1b":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"75bc54ba000941908926c94a6e8cdc1f":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_005606ee5a494faeaf1bf8e0270db84a","placeholder":"​","style":"IPY_MODEL_4d03ba4a13f0464080a10f3b6eef99d7","value":"Generating test examples...:  65%"}},"77171776686f4194b7f84c19cec7978d":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":"hidden","width":null}},"7db39eeb1ff04228b84445623ae48160":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_c261ff47f40a4e0ab43234791694096e","placeholder":"​","style":"IPY_MODEL_12d94750ffaf40cc8ada82d4333a934a","value":"Generating train examples...:  59%"}},"7df1eaac899b4587ae4e1ebcc9c233cb":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"7f248c5edfd24242aee15bc14f756eff":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"80947d765a5044b2a6927e92677e3569":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"80bd8aee73214d429eb039b4e90dd793":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"813ff9371f644e59b19451f36ea7b831":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"84b547c8372c41618abe50d88cfaabc2":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"8560465023024714ac3e3adaf1adcef4":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"8dcd8137666d4909b45d8b2bca7b8860":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_f2fd12ee0e314d99a04aba7041f173b9","IPY_MODEL_6736a0ea3f1144c5ac0f31668159a6dc","IPY_MODEL_b92f4640810a40ff821d709a52070f66"],"layout":"IPY_MODEL_367954210a384b9fa0e663268a973e44"}},"8feb82cf26d743bd91c9e65db16f5b38":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"905ac081406c4587b578de7f44279963":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":"20px"}},"992e1e90ca24475a8a3c981757e2d746":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"9b93289fae1b458f86d95b87f0c82e16":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"","description":"","description_tooltip":null,"layout":"IPY_MODEL_7df1eaac899b4587ae4e1ebcc9c233cb","max":3669,"min":0,"orientation":"horizontal","style":"IPY_MODEL_b6f6b369d39c4f82b8c89d7514114a80","value":3669}},"9c0270044a6049e584dbfe7ac7adf2fd":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"a82e6e4a018e4521a2d9ae5aa66148b0":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_fb8906e78d2040a79d431e5910544f5c","placeholder":"​","style":"IPY_MODEL_f5985967219f4b9db62fd2d4702575f0","value":"Shuffling /root/tensorflow_datasets/oxford_iiit_pet/3.2.0.incompleteQ40T4C/oxford_iiit_pet-test.tfrecord*...:  96%"}},"acde00af91a24ff5b4b0abc1edf43430":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"ad8f0215ae704367b94f87ab75cf5260":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":"hidden","width":null}},"b07e215ad3d645a986f44189665a3efb":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"b117e14474d54b3b89834543ab4a4727":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_c9cde6a23ad04c5bbfe96906eed8c579","max":1,"min":0,"orientation":"horizontal","style":"IPY_MODEL_6f0cce1c5b7a42159e77f84974d9c71a","value":1}},"b3ae542f45bb43e99aadf046f46eef3d":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"b49d966249ac479384ecb48cb9907ba5":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_4ac60e4cc1f5495ea711eda916a6d616","IPY_MODEL_4d4506c10d024b3ab1cb98403e340eef","IPY_MODEL_51434e7b15b04e69821d084a0f37d41e"],"layout":"IPY_MODEL_155bec38b5774dabb1357e5bcc0f9970"}},"b4c2712b60304a4e8a799e7e003f6f8e":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_3dd19a09389d48e796980ea459462daa","placeholder":"​","style":"IPY_MODEL_dac63a82bf6d4a7d85e246c9f74014f6","value":"Generating splits...: 100%"}},"b6f6b369d39c4f82b8c89d7514114a80":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"b7bd35f0329b40b39685a66ec47ee8be":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_7db39eeb1ff04228b84445623ae48160","IPY_MODEL_1e92482d195d497292dce5842c3fc0df","IPY_MODEL_32ff97353bc94f0683a8cd59dadc326b"],"layout":"IPY_MODEL_523c897f21dc4db588171682b3d12767"}},"b8d5f72b658d419db088d4c631c55982":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":"20px"}},"b92f4640810a40ff821d709a52070f66":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_2647dc8f567e4dbc889335ac4aa89cc0","placeholder":"​","style":"IPY_MODEL_71ca5c556b89433386c286823ea6d2ba","value":" 773/773 [01:00<00:00, 33.04 MiB/s]"}},"bb0dbf5efbde44c6ae6a4159b08b5377":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_75bc54ba000941908926c94a6e8cdc1f","IPY_MODEL_9b93289fae1b458f86d95b87f0c82e16","IPY_MODEL_006ae15aaf3143648cdf15c646650fae"],"layout":"IPY_MODEL_6632b0052b4b430bab478c7e08c86646"}},"bc1a5c556793481eaf77cce089e24e39":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_b8d5f72b658d419db088d4c631c55982","max":1,"min":0,"orientation":"horizontal","style":"IPY_MODEL_b07e215ad3d645a986f44189665a3efb","value":1}},"be259e16a5e84b3c8877a3389fcb5084":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"c1a8ea16efed4556b46186ec9fd6b9d4":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"c261ff47f40a4e0ab43234791694096e":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"c9cde6a23ad04c5bbfe96906eed8c579":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":"20px"}},"cb0fd86a7337486fa68ee270b4e8c446":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"dac63a82bf6d4a7d85e246c9f74014f6":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"ddb2baaab771402f91802870ee53c68f":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_a82e6e4a018e4521a2d9ae5aa66148b0","IPY_MODEL_4cb400ec99f4475a9aa90275377a5265","IPY_MODEL_314ea283a51a4806bce462043b6d02f0"],"layout":"IPY_MODEL_ad8f0215ae704367b94f87ab75cf5260"}},"ddba3ee548e84591add61139cf4436d0":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"e59da96fd42b4a20b6db25749b73dc0d":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"eda3c04c93f44780bb7cb01c3af371d0":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"eef64ca4183e432e84723664c5b5b801":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"f2fd12ee0e314d99a04aba7041f173b9":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_9c0270044a6049e584dbfe7ac7adf2fd","placeholder":"​","style":"IPY_MODEL_0f72964af9cb4c6ea53afd0260720ad3","value":"Dl Size...: 100%"}},"f5985967219f4b9db62fd2d4702575f0":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"fb8906e78d2040a79d431e5910544f5c":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"fd26d482d0e142e393a7862fb4f6a2f9":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}}},"version_major":2,"version_minor":0}}},"nbformat":4,"nbformat_minor":5}