{"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":"nvidiaTeslaT4","dataSources":[{"sourceId":8089,"databundleVersionId":44321,"sourceType":"competition"}],"dockerImageVersionId":30627,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\nimport numpy as np \nimport pandas as pd \nimport os\n\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-12-14T08:01:42.860669Z","iopub.execute_input":"2023-12-14T08:01:42.861583Z","iopub.status.idle":"2023-12-14T08:01:43.205392Z","shell.execute_reply.started":"2023-12-14T08:01:42.861545Z","shell.execute_reply":"2023-12-14T08:01:43.204503Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nimport os\nimport random\nimport numpy as np\n \nfrom tqdm import tqdm \n\nfrom skimage.io import imread, imshow\nfrom skimage.transform import resize\nimport matplotlib.pyplot as plt\n%matplotlib inline","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:01:45.494389Z","iopub.execute_input":"2023-12-14T08:01:45.494859Z","iopub.status.idle":"2023-12-14T08:01:58.657705Z","shell.execute_reply.started":"2023-12-14T08:01:45.494828Z","shell.execute_reply":"2023-12-14T08:01:58.656815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import zipfile\n\n# Path to the ZIP file\nTRAIN_PATH = '/kaggle/input/data-science-bowl-2018/stage1_train.zip'\nTEST_PATH = '/kaggle/input/data-science-bowl-2018/stage1_test.zip'\n\n# Destination directory to extract the contents\nextracted_path1 = '/kaggle/working/stage1_train/'\nextracted_path2 = '/kaggle/working/stage1_test/'\n\n# Unzipping the file\nwith zipfile.ZipFile(TRAIN_PATH, 'r') as zip_ref:\n    zip_ref.extractall(extracted_path1)\nwith zipfile.ZipFile(TEST_PATH, 'r') as zip_ref:\n    zip_ref.extractall(extracted_path2)\nprint(extracted_path1)\nprint(extracted_path2)\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:01:58.659175Z","iopub.execute_input":"2023-12-14T08:01:58.659719Z","iopub.status.idle":"2023-12-14T08:02:03.723995Z","shell.execute_reply.started":"2023-12-14T08:01:58.659689Z","shell.execute_reply":"2023-12-14T08:02:03.723060Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"extracted_path1","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:02:03.725174Z","iopub.execute_input":"2023-12-14T08:02:03.725455Z","iopub.status.idle":"2023-12-14T08:02:03.731946Z","shell.execute_reply.started":"2023-12-14T08:02:03.725430Z","shell.execute_reply":"2023-12-14T08:02:03.731064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# print(extracted_path)\n## Setting a random seed for reproducibility\nseed = 42\nnp.random.seed = seed\n\n# Setting image dimensions\nIMG_WIDTH = 128\nIMG_HEIGHT = 128\nIMG_CHANNELS = 3\n\n# Defining paths to the training and test datasets\nTRAIN_PATH = extracted_path1\nTEST_PATH = extracted_path2\n\n# Listing the IDs of the training and test samples\ntrain_ids = next(os.walk(TRAIN_PATH))[1]\ntest_ids = next(os.walk(TEST_PATH))[1]\n\n# Displaying paths and information about the training data\nprint(TRAIN_PATH)\nprint(TEST_PATH)\nprint(os.walk(TRAIN_PATH))\n\n# Initializing arrays to store training data and corresponding masks\nX_train = np.zeros((len(train_ids), IMG_HEIGHT, IMG_WIDTH, IMG_CHANNELS), dtype=np.uint8)\nY_train = np.zeros((len(train_ids), IMG_HEIGHT, IMG_WIDTH, 1), dtype=np.bool_)","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:02:26.749908Z","iopub.execute_input":"2023-12-14T08:02:26.750288Z","iopub.status.idle":"2023-12-14T08:02:26.759649Z","shell.execute_reply.started":"2023-12-14T08:02:26.750259Z","shell.execute_reply":"2023-12-14T08:02:26.758670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train_ids)","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:02:53.067058Z","iopub.execute_input":"2023-12-14T08:02:53.067438Z","iopub.status.idle":"2023-12-14T08:02:53.073145Z","shell.execute_reply.started":"2023-12-14T08:02:53.067409Z","shell.execute_reply":"2023-12-14T08:02:53.072278Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(train_ids))","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:03:00.819410Z","iopub.execute_input":"2023-12-14T08:03:00.820280Z","iopub.status.idle":"2023-12-14T08:03:00.824754Z","shell.execute_reply.started":"2023-12-14T08:03:00.820244Z","shell.execute_reply":"2023-12-14T08:03:00.823839Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(test_ids)","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:04:10.809302Z","iopub.execute_input":"2023-12-14T08:04:10.809710Z","iopub.status.idle":"2023-12-14T08:04:10.814649Z","shell.execute_reply.started":"2023-12-14T08:04:10.809679Z","shell.execute_reply":"2023-12-14T08:04:10.813799Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(test_ids))","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:04:14.852670Z","iopub.execute_input":"2023-12-14T08:04:14.853457Z","iopub.status.idle":"2023-12-14T08:04:14.857985Z","shell.execute_reply.started":"2023-12-14T08:04:14.853426Z","shell.execute_reply":"2023-12-14T08:04:14.857097Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X_train)","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:04:17.536066Z","iopub.execute_input":"2023-12-14T08:04:17.536706Z","iopub.status.idle":"2023-12-14T08:04:17.546667Z","shell.execute_reply.started":"2023-12-14T08:04:17.536674Z","shell.execute_reply":"2023-12-14T08:04:17.545753Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.shape","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:04:43.072350Z","iopub.execute_input":"2023-12-14T08:04:43.073314Z","iopub.status.idle":"2023-12-14T08:04:43.079240Z","shell.execute_reply.started":"2023-12-14T08:04:43.073276Z","shell.execute_reply":"2023-12-14T08:04:43.078332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"This Shape of the X_train shows us the Basic Structure of our X_train repositry which concludes that we have 670 images of Height 128, Width 128 and they have 3 Channels.","metadata":{}},{"cell_type":"code","source":"print(Y_train)","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:05:24.548061Z","iopub.execute_input":"2023-12-14T08:05:24.548448Z","iopub.status.idle":"2023-12-14T08:05:24.555271Z","shell.execute_reply.started":"2023-12-14T08:05:24.548421Z","shell.execute_reply":"2023-12-14T08:05:24.554328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Y_train.shape","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:05:37.448576Z","iopub.execute_input":"2023-12-14T08:05:37.448956Z","iopub.status.idle":"2023-12-14T08:05:37.455220Z","shell.execute_reply.started":"2023-12-14T08:05:37.448926Z","shell.execute_reply":"2023-12-14T08:05:37.454245Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Display a message indicating the resizing process for training images and masks\nprint('Resizing training images and masks')\n\n# Iterate over each training sample\nfor n, id_ in tqdm(enumerate(train_ids), total=len(train_ids)):   \n    # Construct the path to the current training sample\n    path = TRAIN_PATH + id_\n\n    # Load and resize the training image\n    img = imread(path + '/images/' + id_ + '.png')[:,:,:IMG_CHANNELS]  \n    img = resize(img, (IMG_HEIGHT, IMG_WIDTH), mode='constant', preserve_range=True)\n    \n    # Fill the X_train array with the resized image\n    X_train[n] = img\n\n    # Initialize an empty mask for the current training sample\n    mask = np.zeros((IMG_HEIGHT, IMG_WIDTH, 1), dtype=np.bool_)\n\n    # Iterate over each mask file in the 'masks' directory for the current sample\n    for mask_file in next(os.walk(path + '/masks/'))[2]:\n        # Load and resize the current mask\n        mask_ = imread(path + '/masks/' + mask_file)\n        mask_ = np.expand_dims(resize(mask_, (IMG_HEIGHT, IMG_WIDTH), mode='constant',  \n                                      preserve_range=True), axis=-1)\n        \n        # Update the mask by taking the element-wise maximum with the current mask\n        mask = np.maximum(mask, mask_)  \n\n    # Fill the Y_train array with the final mask for the current training sample\n    Y_train[n] = mask\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:06:53.253862Z","iopub.execute_input":"2023-12-14T08:06:53.254237Z","iopub.status.idle":"2023-12-14T08:10:58.049050Z","shell.execute_reply.started":"2023-12-14T08:06:53.254211Z","shell.execute_reply":"2023-12-14T08:10:58.048065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Randomly select an index for visualization\nimage_x = random.randint(0, len(train_ids))\n\n# Display the randomly selected original image from X_train\nimshow(X_train[image_x])\nplt.show()\n\n# Display the corresponding mask image (after squeezing to remove single-dimensional entries) from Y_train\nimshow(np.squeeze(Y_train[image_x]))\nplt.show()\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:18:26.347128Z","iopub.execute_input":"2023-12-14T08:18:26.347508Z","iopub.status.idle":"2023-12-14T08:18:27.003570Z","shell.execute_reply.started":"2023-12-14T08:18:26.347469Z","shell.execute_reply":"2023-12-14T08:18:27.002559Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Create an array to store resized test images\nX_test = np.zeros((len(test_ids), IMG_HEIGHT, IMG_WIDTH, IMG_CHANNELS), dtype=np.uint8)\n\n# Create an empty list to store sizes of test images\nsizes_test = []\n\n# Display a message indicating the resizing process for test images\nprint('Resizing test images')\n\n# Iterate over each test sample\nfor n, id_ in tqdm(enumerate(test_ids), total=len(test_ids)):\n    # Construct the path to the current test sample\n    path = TEST_PATH + id_\n\n    # Load the test image\n    img = imread(path + '/images/' + id_ + '.png')[:,:,:IMG_CHANNELS]\n\n    # Store the original size of the test image\n    sizes_test.append([img.shape[0], img.shape[1]])\n\n    # Resize the test image and fill the X_test array\n    img = resize(img, (IMG_HEIGHT, IMG_WIDTH), mode='constant', preserve_range=True)\n    X_test[n] = img\n\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:20:29.806319Z","iopub.execute_input":"2023-12-14T08:20:29.806703Z","iopub.status.idle":"2023-12-14T08:20:31.228954Z","shell.execute_reply.started":"2023-12-14T08:20:29.806675Z","shell.execute_reply":"2023-12-14T08:20:31.227830Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X_test)","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:20:34.383427Z","iopub.execute_input":"2023-12-14T08:20:34.384351Z","iopub.status.idle":"2023-12-14T08:20:34.392098Z","shell.execute_reply.started":"2023-12-14T08:20:34.384305Z","shell.execute_reply":"2023-12-14T08:20:34.391063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.shape","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:20:52.192849Z","iopub.execute_input":"2023-12-14T08:20:52.193258Z","iopub.status.idle":"2023-12-14T08:20:52.199590Z","shell.execute_reply.started":"2023-12-14T08:20:52.193227Z","shell.execute_reply":"2023-12-14T08:20:52.198486Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"This matrices gave us some intuition that there are some colored images in test directory so lets print some of them and Check.","metadata":{}},{"cell_type":"code","source":"# Randomly select an index for visualization\nimage_x = random.randint(0, len(test_ids))\n\n# Display the randomly selected original image from X_test\nimshow(X_test[image_x])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:22:31.869890Z","iopub.execute_input":"2023-12-14T08:22:31.870249Z","iopub.status.idle":"2023-12-14T08:22:32.190516Z","shell.execute_reply.started":"2023-12-14T08:22:31.870222Z","shell.execute_reply":"2023-12-14T08:22:32.189614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Build the model\ninputs = tf.keras.layers.Input((IMG_HEIGHT, IMG_WIDTH, IMG_CHANNELS))\ns = tf.keras.layers.Lambda(lambda x: x / 255)(inputs)\n\n#Contraction path\nc1 = tf.keras.layers.Conv2D(16, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(s)\nc1 = tf.keras.layers.Dropout(0.1)(c1)\nc1 = tf.keras.layers.Conv2D(16, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c1)\np1 = tf.keras.layers.MaxPooling2D((2, 2))(c1)\n\nc2 = tf.keras.layers.Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(p1)\nc2 = tf.keras.layers.Dropout(0.1)(c2)\nc2 = tf.keras.layers.Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c2)\np2 = tf.keras.layers.MaxPooling2D((2, 2))(c2)\n \nc3 = tf.keras.layers.Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(p2)\nc3 = tf.keras.layers.Dropout(0.2)(c3)\nc3 = tf.keras.layers.Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c3)\np3 = tf.keras.layers.MaxPooling2D((2, 2))(c3)\n \nc4 = tf.keras.layers.Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(p3)\nc4 = tf.keras.layers.Dropout(0.2)(c4)\nc4 = tf.keras.layers.Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c4)\np4 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(c4)\n \nc5 = tf.keras.layers.Conv2D(256, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(p4)\nc5 = tf.keras.layers.Dropout(0.3)(c5)\nc5 = tf.keras.layers.Conv2D(256, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c5)\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:26:00.640875Z","iopub.execute_input":"2023-12-14T08:26:00.641825Z","iopub.status.idle":"2023-12-14T08:26:05.024017Z","shell.execute_reply.started":"2023-12-14T08:26:00.641750Z","shell.execute_reply":"2023-12-14T08:26:05.023202Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"the expansive path (decoder) of a U-Net model, combines it with the contraction path, and completes the U-Net architecture. ","metadata":{}},{"cell_type":"code","source":"#Expansive path \nu6 = tf.keras.layers.Conv2DTranspose(128, (2, 2), strides=(2, 2), padding='same')(c5)\nu6 = tf.keras.layers.concatenate([u6, c4])\nc6 = tf.keras.layers.Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(u6)\nc6 = tf.keras.layers.Dropout(0.2)(c6)\nc6 = tf.keras.layers.Conv2D(128, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c6)\n \nu7 = tf.keras.layers.Conv2DTranspose(64, (2, 2), strides=(2, 2), padding='same')(c6)\nu7 = tf.keras.layers.concatenate([u7, c3])\nc7 = tf.keras.layers.Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(u7)\nc7 = tf.keras.layers.Dropout(0.2)(c7)\nc7 = tf.keras.layers.Conv2D(64, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c7)\n \nu8 = tf.keras.layers.Conv2DTranspose(32, (2, 2), strides=(2, 2), padding='same')(c7)\nu8 = tf.keras.layers.concatenate([u8, c2])\nc8 = tf.keras.layers.Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(u8)\nc8 = tf.keras.layers.Dropout(0.1)(c8)\nc8 = tf.keras.layers.Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c8)\n \nu9 = tf.keras.layers.Conv2DTranspose(16, (2, 2), strides=(2, 2), padding='same')(c8)\nu9 = tf.keras.layers.concatenate([u9, c1], axis=3)\nc9 = tf.keras.layers.Conv2D(16, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(u9)\nc9 = tf.keras.layers.Dropout(0.1)(c9)\nc9 = tf.keras.layers.Conv2D(16, (3, 3), activation='relu', kernel_initializer='he_normal', padding='same')(c9)\n\n# Output layer\noutputs = tf.keras.layers.Conv2D(1, (1, 1), activation='sigmoid')(c9)\n\n\n# Create the U-Net model\nmodel = tf.keras.Model(inputs=[inputs], outputs=[outputs])\n\n# Compile the model with Adam optimizer, binary crossentropy loss, and accuracy metric\nmodel.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n\n# Display the summary of the model architecture\nmodel.summary()\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:28:14.718144Z","iopub.execute_input":"2023-12-14T08:28:14.719091Z","iopub.status.idle":"2023-12-14T08:28:15.040415Z","shell.execute_reply.started":"2023-12-14T08:28:14.719058Z","shell.execute_reply":"2023-12-14T08:28:15.034286Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Training the U-Net Model","metadata":{}},{"cell_type":"code","source":"# Model Training\nresults = model.fit(X_train, Y_train, validation_split=0.1, batch_size=16, epochs=100)\n\n# Randomly select an index for visualization\nidx = random.randint(0, len(X_train))\n\n# Predictions on training, validation, and test sets\npreds_train = model.predict(X_train[:int(X_train.shape[0]*0.9)], verbose=1)\npreds_val = model.predict(X_train[int(X_train.shape[0]*0.9):], verbose=1)\npreds_test = model.predict(X_test, verbose=1)\n\n# Threshold predictions to obtain binary masks\npreds_train_t = (preds_train > 0.5).astype(np.uint8)\npreds_val_t = (preds_val > 0.5).astype(np.uint8)\npreds_test_t = (preds_test > 0.5).astype(np.uint8)\n\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:30:45.267718Z","iopub.execute_input":"2023-12-14T08:30:45.268121Z","iopub.status.idle":"2023-12-14T08:34:00.053560Z","shell.execute_reply.started":"2023-12-14T08:30:45.268095Z","shell.execute_reply":"2023-12-14T08:34:00.052371Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Extract training history from results\nhistory = results.history\n\n# Plot training and validation accuracy values\nplt.figure(figsize=(12, 4))\nplt.subplot(1, 2, 1)\nplt.plot(history['accuracy'], label='Training Accuracy')\nplt.plot(history['val_accuracy'], label='Validation Accuracy')\nplt.title('Training and Validation Accuracy')\nplt.xlabel('Epoch')\nplt.ylabel('Accuracy')\nplt.legend()\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:36:50.158623Z","iopub.execute_input":"2023-12-14T08:36:50.159332Z","iopub.status.idle":"2023-12-14T08:36:50.448520Z","shell.execute_reply.started":"2023-12-14T08:36:50.159297Z","shell.execute_reply":"2023-12-14T08:36:50.447620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Plot training and validation loss values\nplt.plot(history['loss'], label='Training Loss')\nplt.plot(history['val_loss'], label='Validation Loss')\nplt.title('Training and Validation Loss')\nplt.xlabel('Epoch')\nplt.ylabel('Loss')\nplt.legend()\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:37:36.577131Z","iopub.execute_input":"2023-12-14T08:37:36.577511Z","iopub.status.idle":"2023-12-14T08:37:36.893094Z","shell.execute_reply.started":"2023-12-14T08:37:36.577481Z","shell.execute_reply":"2023-12-14T08:37:36.891944Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Perform a sanity check on some random training samples\nix = random.randint(0, len(preds_train_t))\nimshow(X_train[ix])\nplt.show()\nimshow(np.squeeze(Y_train[ix]))\nplt.show()\nimshow(np.squeeze(preds_train_t[ix]))\nplt.show()\n\n# Perform a sanity check on some random validation samples\nix = random.randint(0, len(preds_val_t))\nimshow(X_train[int(X_train.shape[0]*0.9):][ix])\nplt.show()\nimshow(np.squeeze(Y_train[int(Y_train.shape[0]*0.9):][ix]))\nplt.show()\nimshow(np.squeeze(preds_val_t[ix]))\nplt.show()\n\n\n","metadata":{"execution":{"iopub.status.busy":"2023-12-14T08:38:52.551385Z","iopub.execute_input":"2023-12-14T08:38:52.551781Z","iopub.status.idle":"2023-12-14T08:38:53.300438Z","shell.execute_reply.started":"2023-12-14T08:38:52.551741Z","shell.execute_reply":"2023-12-14T08:38:53.299232Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}