{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":53666,"databundleVersionId":6589269,"sourceType":"competition"},{"sourceId":152463838,"sourceType":"kernelVersion"}],"dockerImageVersionId":30587,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport glob\n\nanglez_dir = \"/kaggle/input/imagedatageneration/images/anglez/\"\nenmo_dir = \"/kaggle/input/imagedatageneration/images/enmo/\"\nawake_dir = \"/kaggle/input/imagedatageneration/images/awake/\"\n\nbatch_size = 16\n\nseries_ids = [os.path.basename(_path).split('.', 1)[0] for _path in glob.glob(os.path.join(awake_dir, \"*\"))]\nseries_ids[:5]","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-12-01T21:55:53.036185Z","iopub.execute_input":"2023-12-01T21:55:53.036646Z","iopub.status.idle":"2023-12-01T21:55:53.050170Z","shell.execute_reply.started":"2023-12-01T21:55:53.036613Z","shell.execute_reply":"2023-12-01T21:55:53.048929Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(series_ids)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.052695Z","iopub.execute_input":"2023-12-01T21:55:53.053101Z","iopub.status.idle":"2023-12-01T21:55:53.060760Z","shell.execute_reply.started":"2023-12-01T21:55:53.053057Z","shell.execute_reply":"2023-12-01T21:55:53.059617Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import Image, display\ndisplay(Image(filename=os.path.join(anglez_dir, series_ids[0]+'.jpg')))","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.062153Z","iopub.execute_input":"2023-12-01T21:55:53.062532Z","iopub.status.idle":"2023-12-01T21:55:53.075314Z","shell.execute_reply.started":"2023-12-01T21:55:53.062500Z","shell.execute_reply":"2023-12-01T21:55:53.074476Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tensorflow.keras.preprocessing.image import load_img\nimg = load_img(os.path.join(anglez_dir, series_ids[0]+'.jpg'))\nprint(img.size)\nprint(type(img))\nprint(img.getextrema())\nimg","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.076644Z","iopub.execute_input":"2023-12-01T21:55:53.077607Z","iopub.status.idle":"2023-12-01T21:55:53.088686Z","shell.execute_reply.started":"2023-12-01T21:55:53.077574Z","shell.execute_reply":"2023-12-01T21:55:53.087580Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tensorflow.keras.preprocessing.image import load_img\nimg = load_img(os.path.join(awake_dir, series_ids[0]+'.jpg'))\nprint(img.size)\nprint(type(img))\nprint(img.getextrema())\nimg","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.091745Z","iopub.execute_input":"2023-12-01T21:55:53.092149Z","iopub.status.idle":"2023-12-01T21:55:53.102959Z","shell.execute_reply.started":"2023-12-01T21:55:53.092117Z","shell.execute_reply":"2023-12-01T21:55:53.101779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tensorflow.keras.preprocessing.image import load_img\nimg = load_img(os.path.join(anglez_dir, series_ids[1]+'.jpg'))\nprint(img.size)\nprint(type(img))\nimg","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.105100Z","iopub.execute_input":"2023-12-01T21:55:53.105583Z","iopub.status.idle":"2023-12-01T21:55:53.117947Z","shell.execute_reply.started":"2023-12-01T21:55:53.105550Z","shell.execute_reply":"2023-12-01T21:55:53.116662Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"crop_img = img.crop((0, 0, 288, 7))\nprint(crop_img.size)\nprint(type(crop_img))\ncrop_img","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.119766Z","iopub.execute_input":"2023-12-01T21:55:53.120780Z","iopub.status.idle":"2023-12-01T21:55:53.129926Z","shell.execute_reply.started":"2023-12-01T21:55:53.120737Z","shell.execute_reply":"2023-12-01T21:55:53.128740Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import random\nfrom tensorflow import keras\nimport numpy as np\n# from tensorflow.keras.preprocessing.image import load_img\n\nimg_size = (288, 32)\n\ndef load_img(path, img_size):\n    img = keras.preprocessing.image.load_img(path, color_mode=\"grayscale\")\n    if img.height > img_size[1]:\n        _r = random.randint(0, img.height-7)\n        img = img.crop((0, 0+_r, img_size[0], img_size[1]+_r))\n    if img.height < img_size[1]:\n        img = img.resize((img_size[0], img_size[1]))\n    return np.asarray(img).T\n\ndef get_x(series_id, img_size, anglez_dir, enmo_dir):\n    x = np.zeros(img_size + (3,), dtype=\"float32\")\n\n    _anglez_path = os.path.join(anglez_dir, series_id+'.jpg')\n    x[:,:,0] = load_img(_anglez_path, img_size)\n    _enmo_path = os.path.join(enmo_dir, series_id+'.jpg')\n    x[:,:,1] = load_img(_enmo_path, img_size)\n    x[:,:,2] = np.repeat(np.linspace(0., 255., img_size[0], dtype='float64')[:, None], img_size[1], axis=1)\n\n    return x\n\nclass MyGenerator(keras.utils.Sequence):\n    \"\"\"Helper to iterate over the data (as Numpy arrays).\"\"\"\n\n    def __init__(self, batch_size, img_size, series_ids, anglez_dir, enmo_dir, awake_dir):\n        self.batch_size = batch_size\n        self.img_size = img_size\n        self.series_ids = series_ids\n        self.anglez_dir = anglez_dir\n        self.enmo_dir = enmo_dir\n        self.awake_dir = awake_dir\n\n    def __len__(self):\n        return len(self.series_ids) // self.batch_size\n\n    def __getitem__(self, idx):\n        \"\"\"Returns tuple (input, target) correspond to batch #idx.\"\"\"\n        _i = idx * self.batch_size\n        batch_series_ids = self.series_ids[_i : _i + self.batch_size]\n        \n        # x = np.zeros((self.batch_size,) + (self.img_size[1], self.img_size[0]) + (3,), dtype=\"float32\")\n        # y = np.zeros((self.batch_size,) + (self.img_size[1], self.img_size[0]) + (1,), dtype=\"uint8\")\n        x = np.zeros((self.batch_size,) + self.img_size + (3,), dtype=\"float32\")\n        y = np.zeros((self.batch_size,) + self.img_size + (1,), dtype=\"uint8\")\n        for j, series_id in enumerate(batch_series_ids):\n            x[j,:,:,:] = get_x(series_id, self.img_size, self.anglez_dir, self.enmo_dir)\n                \n            _awake_path = os.path.join(self.awake_dir, series_id+'.jpg')\n            y[j,:,:,0] = load_img(_awake_path, img_size)\n            \n        x = x/255.\n        y[y<=int(255/2)] = 0\n        y[y>int(255/2)] = 1\n        return x, y","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.131868Z","iopub.execute_input":"2023-12-01T21:55:53.132300Z","iopub.status.idle":"2023-12-01T21:55:53.153990Z","shell.execute_reply.started":"2023-12-01T21:55:53.132262Z","shell.execute_reply":"2023-12-01T21:55:53.152627Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_generator = MyGenerator(batch_size, img_size, series_ids, anglez_dir, enmo_dir, awake_dir)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.226654Z","iopub.execute_input":"2023-12-01T21:55:53.227094Z","iopub.status.idle":"2023-12-01T21:55:53.232599Z","shell.execute_reply.started":"2023-12-01T21:55:53.227059Z","shell.execute_reply":"2023-12-01T21:55:53.231443Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_size","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.235218Z","iopub.execute_input":"2023-12-01T21:55:53.236603Z","iopub.status.idle":"2023-12-01T21:55:53.245568Z","shell.execute_reply.started":"2023-12-01T21:55:53.236566Z","shell.execute_reply":"2023-12-01T21:55:53.244655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for x, y in my_generator:\n    print(x.shape)\n    print(y.shape)\n    break","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.247171Z","iopub.execute_input":"2023-12-01T21:55:53.247570Z","iopub.status.idle":"2023-12-01T21:55:53.317738Z","shell.execute_reply.started":"2023-12-01T21:55:53.247530Z","shell.execute_reply":"2023-12-01T21:55:53.316455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.unique(x[0,:,:,0])","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.319282Z","iopub.execute_input":"2023-12-01T21:55:53.319890Z","iopub.status.idle":"2023-12-01T21:55:53.330665Z","shell.execute_reply.started":"2023-12-01T21:55:53.319858Z","shell.execute_reply":"2023-12-01T21:55:53.329593Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.unique(y[0,:,:,0])","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.334180Z","iopub.execute_input":"2023-12-01T21:55:53.334944Z","iopub.status.idle":"2023-12-01T21:55:53.342877Z","shell.execute_reply.started":"2023-12-01T21:55:53.334896Z","shell.execute_reply":"2023-12-01T21:55:53.341594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nplt.imshow(x[0,:,:,0].T)\nplt.show()\n\nplt.imshow(x[0,:,:,1].T)\nplt.show()\n\nplt.imshow(x[0,:,:,2].T)\nplt.show()\n\nplt.imshow(y[0,:,:,0].T)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:53.344994Z","iopub.execute_input":"2023-12-01T21:55:53.345788Z","iopub.status.idle":"2023-12-01T21:55:54.264680Z","shell.execute_reply.started":"2023-12-01T21:55:53.345728Z","shell.execute_reply":"2023-12-01T21:55:54.263451Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nplt.imshow(x[1,:,:,0].T)\nplt.show()\n\nplt.imshow(x[1,:,:,1].T)\nplt.show()\n\nplt.imshow(x[1,:,:,2].T)\nplt.show()\n\nplt.imshow(y[1,:,:,0].T)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T22:02:34.394162Z","iopub.execute_input":"2023-12-01T22:02:34.394591Z","iopub.status.idle":"2023-12-01T22:02:35.277085Z","shell.execute_reply.started":"2023-12-01T22:02:34.394558Z","shell.execute_reply":"2023-12-01T22:02:35.275645Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nplt.imshow(x[2,:,:,0].T)\nplt.show()\n\nplt.imshow(x[2,:,:,1].T)\nplt.show()\n\nplt.imshow(x[2,:,:,2].T)\nplt.show()\n\nplt.imshow(y[2,:,:,0].T)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T22:02:35.845832Z","iopub.execute_input":"2023-12-01T22:02:35.846265Z","iopub.status.idle":"2023-12-01T22:02:36.735575Z","shell.execute_reply.started":"2023-12-01T22:02:35.846230Z","shell.execute_reply":"2023-12-01T22:02:36.734407Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# from tensorflow.keras import layers\n\n# num_classes = 1\n\n# def get_model(img_size, num_classes):\n#     inputs = keras.Input(shape=img_size + (3,))\n\n#     ### [First half of the network: downsampling inputs] ###\n\n#     # Entry block\n#     x = layers.Conv2D(32, 3, strides=2, padding=\"same\")(inputs)\n#     x = layers.BatchNormalization()(x)\n#     x = layers.Activation(\"relu\")(x)\n\n#     previous_block_activation = x  # Set aside residual\n\n#     # Blocks 1, 2, 3 are identical apart from the feature depth.\n#     for filters in [64, 128, 256]:\n#         x = layers.Activation(\"relu\")(x)\n#         x = layers.SeparableConv2D(filters, 3, padding=\"same\")(x)\n#         x = layers.BatchNormalization()(x)\n\n#         x = layers.Activation(\"relu\")(x)\n#         x = layers.SeparableConv2D(filters, 3, padding=\"same\")(x)\n#         x = layers.BatchNormalization()(x)\n\n#         x = layers.MaxPooling2D(3, strides=2, padding=\"same\")(x)\n\n#         # Project residual\n#         residual = layers.Conv2D(filters, 1, strides=2, padding=\"same\")(\n#             previous_block_activation\n#         )\n#         x = layers.add([x, residual])  # Add back residual\n#         previous_block_activation = x  # Set aside next residual\n\n#     ### [Second half of the network: upsampling inputs] ###\n\n#     for filters in [256, 128, 64, 32]:\n#         x = layers.Activation(\"relu\")(x)\n#         x = layers.Conv2DTranspose(filters, 3, padding=\"same\")(x)\n#         x = layers.BatchNormalization()(x)\n\n#         x = layers.Activation(\"relu\")(x)\n#         x = layers.Conv2DTranspose(filters, 3, padding=\"same\")(x)\n#         x = layers.BatchNormalization()(x)\n\n#         x = layers.UpSampling2D(2)(x)\n\n#         # Project residual\n#         residual = layers.UpSampling2D(2)(previous_block_activation)\n#         residual = layers.Conv2D(filters, 1, padding=\"same\")(residual)\n#         x = layers.add([x, residual])  # Add back residual\n#         previous_block_activation = x  # Set aside next residual\n\n#     # Add a per-pixel classification layer\n#     outputs = layers.Conv2D(num_classes, 3, activation=\"softmax\", padding=\"same\")(x)\n\n#     # Define the model\n#     model = keras.Model(inputs, outputs)\n#     return model\n\n# # Free up RAM in case the model definition cells were run multiple times\n# keras.backend.clear_session()\n\n# # Build model\n# model = get_model(img_size, num_classes)\n# model.summary()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:54.266896Z","iopub.execute_input":"2023-12-01T21:55:54.267413Z","iopub.status.idle":"2023-12-01T21:55:54.275636Z","shell.execute_reply.started":"2023-12-01T21:55:54.267339Z","shell.execute_reply":"2023-12-01T21:55:54.274460Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install git+https://github.com/tensorflow/examples.git","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:55:54.277109Z","iopub.execute_input":"2023-12-01T21:55:54.277457Z","iopub.status.idle":"2023-12-01T21:56:14.276509Z","shell.execute_reply.started":"2023-12-01T21:55:54.277429Z","shell.execute_reply":"2023-12-01T21:56:14.274902Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom tensorflow_examples.models.pix2pix import pix2pix\n\nchannel = 3\nbase_model = tf.keras.applications.MobileNetV2(input_shape=img_size + (channel,), include_top=False)\n\n# Use the activations of these layers\nlayer_names = [\n    'block_1_expand_relu',   # 64x64\n    'block_3_expand_relu',   # 32x32\n    'block_6_expand_relu',   # 16x16\n    'block_13_expand_relu',  # 8x8\n    'block_16_project',      # 4x4\n]\nbase_model_outputs = [base_model.get_layer(name).output for name in layer_names]\n\n# Create the feature extraction model\ndown_stack = tf.keras.Model(inputs=base_model.input, outputs=base_model_outputs)\n\ndown_stack.trainable = False\n\nup_stack = [\n    pix2pix.upsample(512, 3),  # 4x4 -> 8x8\n    pix2pix.upsample(256, 3),  # 8x8 -> 16x16\n    pix2pix.upsample(128, 3),  # 16x16 -> 32x32\n    pix2pix.upsample(64, 3),   # 32x32 -> 64x64\n]\n\ndef unet_model(output_channels:int):\n    inputs = tf.keras.layers.Input(shape=img_size + (channel,))\n\n    # Downsampling through the model\n    skips = down_stack(inputs)\n    x = skips[-1]\n    skips = reversed(skips[:-1])\n\n    # Upsampling and establishing the skip connections\n    for up, skip in zip(up_stack, skips):\n        x = up(x)\n        concat = tf.keras.layers.Concatenate()\n        x = concat([x, skip])\n\n    # This is the last layer of the model\n    last = tf.keras.layers.Conv2DTranspose(\n        filters=output_channels, kernel_size=3, strides=2,\n        padding='same', activation=\"softmax\")  #64x64 -> 128x128\n\n    x = last(x)\n\n    return tf.keras.Model(inputs=inputs, outputs=x)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:58:31.328646Z","iopub.execute_input":"2023-12-01T21:58:31.329088Z","iopub.status.idle":"2023-12-01T21:58:32.956039Z","shell.execute_reply.started":"2023-12-01T21:58:31.329054Z","shell.execute_reply":"2023-12-01T21:58:32.955094Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"OUTPUT_CLASSES = 2\n\nmodel = unet_model(output_channels=OUTPUT_CLASSES)\nmodel.compile(\n    optimizer='adam',\n#     loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),\n    loss=\"sparse_categorical_crossentropy\",\n    metrics=['accuracy']\n)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:58:32.957840Z","iopub.execute_input":"2023-12-01T21:58:32.958634Z","iopub.status.idle":"2023-12-01T21:58:38.130113Z","shell.execute_reply.started":"2023-12-01T21:58:32.958590Z","shell.execute_reply":"2023-12-01T21:58:38.128876Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tf.keras.utils.plot_model(model, show_shapes=True)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:58:38.132195Z","iopub.execute_input":"2023-12-01T21:58:38.132666Z","iopub.status.idle":"2023-12-01T21:58:38.338545Z","shell.execute_reply.started":"2023-12-01T21:58:38.132625Z","shell.execute_reply":"2023-12-01T21:58:38.337269Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"EPOCHS = 200\n# VAL_SUBSPLITS = 5\n# VALIDATION_STEPS = info.splits['test'].num_examples//BATCH_SIZE//VAL_SUBSPLITS\n\nmodel_history = model.fit(\n    my_generator, \n    epochs=EPOCHS,\n    # steps_per_epoch=STEPS_PER_EPOCH,\n    # validation_steps=VALIDATION_STEPS,\n    # validation_data=test_batches,\n    # callbacks=[DisplayCallback()]\n)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:58:41.821225Z","iopub.execute_input":"2023-12-01T21:58:41.821637Z","iopub.status.idle":"2023-12-01T22:02:30.065157Z","shell.execute_reply.started":"2023-12-01T21:58:41.821607Z","shell.execute_reply":"2023-12-01T22:02:30.062213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"loss = model_history.history['loss']\n# val_loss = model_history.history['val_loss']\n\nplt.figure()\nplt.plot(model_history.epoch, loss, 'r', label='Training loss')\n# plt.plot(model_history.epoch, val_loss, 'bo', label='Validation loss')\n# plt.title('Training and Validation Loss')\nplt.xlabel('Epoch')\nplt.ylabel('Loss Value')\n# plt.ylim([0, 1])\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.617826Z","iopub.status.idle":"2023-12-01T21:57:04.618275Z","shell.execute_reply.started":"2023-12-01T21:57:04.618068Z","shell.execute_reply":"2023-12-01T21:57:04.618089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"series_id = series_ids[0]\nx = get_x(series_id, img_size, anglez_dir, enmo_dir)[None, :, :, :]\n\nx.shape","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.619709Z","iopub.status.idle":"2023-12-01T21:57:04.620141Z","shell.execute_reply.started":"2023-12-01T21:57:04.619938Z","shell.execute_reply":"2023-12-01T21:57:04.619959Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_mask = model.predict(x)","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.622994Z","iopub.status.idle":"2023-12-01T21:57:04.623524Z","shell.execute_reply.started":"2023-12-01T21:57:04.623270Z","shell.execute_reply":"2023-12-01T21:57:04.623291Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_mask","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.624830Z","iopub.status.idle":"2023-12-01T21:57:04.625528Z","shell.execute_reply.started":"2023-12-01T21:57:04.625223Z","shell.execute_reply":"2023-12-01T21:57:04.625255Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_mask.shape","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.627409Z","iopub.status.idle":"2023-12-01T21:57:04.627833Z","shell.execute_reply.started":"2023-12-01T21:57:04.627634Z","shell.execute_reply":"2023-12-01T21:57:04.627654Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.imshow(tf.transpose(tf.argmax(pred_mask, axis=-1)[0]))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.629507Z","iopub.status.idle":"2023-12-01T21:57:04.629921Z","shell.execute_reply.started":"2023-12-01T21:57:04.629723Z","shell.execute_reply":"2023-12-01T21:57:04.629742Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.imshow(tf.transpose(pred_mask[0,:,:,0]))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-01T21:57:04.632235Z","iopub.status.idle":"2023-12-01T21:57:04.632680Z","shell.execute_reply.started":"2023-12-01T21:57:04.632478Z","shell.execute_reply":"2023-12-01T21:57:04.632498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}