{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd \n\nimport matplotlib.pyplot as plt\nimport matplotlib.image as img\n%matplotlib inline\nimport seaborn as sns\nfrom PIL import Image, ImageFilter, ImageEnhance\nimport cv2\n\nimport tensorflow as tf\nfrom tensorflow import keras\nfrom tensorflow.keras import layers\nfrom tensorflow.keras.layers.experimental import preprocessing\nimport os\nfrom numpy import asarray","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-10-22T10:45:19.825076Z","iopub.execute_input":"2022-10-22T10:45:19.825576Z","iopub.status.idle":"2022-10-22T10:45:28.152808Z","shell.execute_reply.started":"2022-10-22T10:45:19.825482Z","shell.execute_reply":"2022-10-22T10:45:28.151586Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import zipfile\n\nzip_files = ['test1', 'train']\n\nfor zip_file in zip_files:\n    with zipfile.ZipFile(\"../input/dogs-vs-cats/{}.zip\".format(zip_file),\"r\") as z:\n        z.extractall(\".\")\n        print(\"{} unzipped\".format(zip_file))","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:28.155156Z","iopub.execute_input":"2022-10-22T10:45:28.155825Z","iopub.status.idle":"2022-10-22T10:45:47.304724Z","shell.execute_reply.started":"2022-10-22T10:45:28.155763Z","shell.execute_reply":"2022-10-22T10:45:47.303604Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"TRAIN_DIR_PATH = './train'\nfile_names = os.listdir(TRAIN_DIR_PATH)\nprint('There are {} number of images in directory.'.format(len(file_names)))","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:47.306647Z","iopub.execute_input":"2022-10-22T10:45:47.307269Z","iopub.status.idle":"2022-10-22T10:45:47.329947Z","shell.execute_reply.started":"2022-10-22T10:45:47.307232Z","shell.execute_reply":"2022-10-22T10:45:47.328763Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def to_dataframe(file_names):\n    files, labels = list(), list()\n    for file in file_names:\n        files.append(file)\n        labels.append(file[:3])\n    df = pd.DataFrame({'filename':files, 'label':labels})\n    return df\n\ndf = to_dataframe(file_names)","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:47.333506Z","iopub.execute_input":"2022-10-22T10:45:47.333881Z","iopub.status.idle":"2022-10-22T10:45:47.356659Z","shell.execute_reply.started":"2022-10-22T10:45:47.333849Z","shell.execute_reply":"2022-10-22T10:45:47.355311Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:47.359108Z","iopub.execute_input":"2022-10-22T10:45:47.359999Z","iopub.status.idle":"2022-10-22T10:45:47.383419Z","shell.execute_reply.started":"2022-10-22T10:45:47.359948Z","shell.execute_reply":"2022-10-22T10:45:47.382237Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat = [file for file in file_names if file[:3]=='cat'] #cat images\ndog = [file for file in file_names if file[:3]=='dog'] #dog images","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:47.385177Z","iopub.execute_input":"2022-10-22T10:45:47.385586Z","iopub.status.idle":"2022-10-22T10:45:47.400655Z","shell.execute_reply.started":"2022-10-22T10:45:47.385537Z","shell.execute_reply":"2022-10-22T10:45:47.399396Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Number of cat images =',len(cat))\nprint('Number of dog images =',len(dog))","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:47.402273Z","iopub.execute_input":"2022-10-22T10:45:47.403015Z","iopub.status.idle":"2022-10-22T10:45:47.408953Z","shell.execute_reply.started":"2022-10-22T10:45:47.402979Z","shell.execute_reply":"2022-10-22T10:45:47.407716Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,7))\nfor i, c in enumerate(range(5), start=1):\n    im = img.imread('./train/'+cat[c])\n    plt.subplot(2,5,i)\n    plt.imshow(im)\n    \nfor i, c in enumerate(range(5), start=6):\n    im = img.imread('./train/'+dog[c])\n    plt.subplot(2,5,i)\n    plt.imshow(im)","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:47.410503Z","iopub.execute_input":"2022-10-22T10:45:47.410953Z","iopub.status.idle":"2022-10-22T10:45:49.010883Z","shell.execute_reply.started":"2022-10-22T10:45:47.410909Z","shell.execute_reply":"2022-10-22T10:45:49.009846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Resizing Images","metadata":{}},{"cell_type":"markdown","source":"#### Resizing images is a critical pre-processing step in computer vision. Principally, deep learning models train faster on small images. A larger input image requires the neural network to learn from four times as many pixels, and this increase the training time for the architecture. In this work, we presented the evolution of effects of image resizing on model training time and performance. Moreover, many deep learning model architectures require images of the same size","metadata":{}},{"cell_type":"code","source":"resized_images=[]\nfor file in file_names:\n    img=Image.open('./train/'+file)\n    resized_images.append(img.resize((224,224)))\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:45:49.012153Z","iopub.execute_input":"2022-10-22T10:45:49.013126Z","iopub.status.idle":"2022-10-22T10:48:21.695896Z","shell.execute_reply.started":"2022-10-22T10:45:49.013086Z","shell.execute_reply":"2022-10-22T10:48:21.694428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\nimg=Image.open('./train/'+file_names[0])\nax[0].imshow(img)\nax[1].imshow(resized_images[0])","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:21.699724Z","iopub.execute_input":"2022-10-22T10:48:21.700115Z","iopub.status.idle":"2022-10-22T10:48:22.191436Z","shell.execute_reply.started":"2022-10-22T10:48:21.700081Z","shell.execute_reply":"2022-10-22T10:48:22.190177Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\nimg=Image.open('./train/'+file_names[15])\nax[0].imshow(img)\nax[1].imshow(resized_images[15])","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:22.193320Z","iopub.execute_input":"2022-10-22T10:48:22.193732Z","iopub.status.idle":"2022-10-22T10:48:22.699626Z","shell.execute_reply.started":"2022-10-22T10:48:22.193692Z","shell.execute_reply":"2022-10-22T10:48:22.698397Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\nimg=Image.open('./train/'+file_names[100])\nax[0].imshow(img)\nax[1].imshow(resized_images[100])","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:22.701365Z","iopub.execute_input":"2022-10-22T10:48:22.701728Z","iopub.status.idle":"2022-10-22T10:48:23.299214Z","shell.execute_reply.started":"2022-10-22T10:48:22.701694Z","shell.execute_reply":"2022-10-22T10:48:23.297955Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(resized_images)","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:23.300987Z","iopub.execute_input":"2022-10-22T10:48:23.301409Z","iopub.status.idle":"2022-10-22T10:48:23.308474Z","shell.execute_reply.started":"2022-10-22T10:48:23.301371Z","shell.execute_reply":"2022-10-22T10:48:23.307422Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Convert images to grey scale","metadata":{}},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\n\nimg=resized_images[0]\nax[0].imshow(img);\n\ngrey_scale_img = img.convert('LA')\nax[1].imshow(grey_scale_img);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:23.310474Z","iopub.execute_input":"2022-10-22T10:48:23.310997Z","iopub.status.idle":"2022-10-22T10:48:23.788018Z","shell.execute_reply.started":"2022-10-22T10:48:23.310966Z","shell.execute_reply":"2022-10-22T10:48:23.787108Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\n\nimg=resized_images[5]\nax[0].imshow(img);\n\ngrey_scale_img = img.convert('LA')\nax[1].imshow(grey_scale_img);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:23.789444Z","iopub.execute_input":"2022-10-22T10:48:23.790397Z","iopub.status.idle":"2022-10-22T10:48:24.286568Z","shell.execute_reply.started":"2022-10-22T10:48:23.790361Z","shell.execute_reply":"2022-10-22T10:48:24.285457Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\n\nimg=resized_images[25]\nax[0].imshow(img);\n\ngrey_scale_img = img.convert('LA')\nax[1].imshow(grey_scale_img);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:24.288322Z","iopub.execute_input":"2022-10-22T10:48:24.289480Z","iopub.status.idle":"2022-10-22T10:48:24.736201Z","shell.execute_reply.started":"2022-10-22T10:48:24.289438Z","shell.execute_reply":"2022-10-22T10:48:24.735325Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Edge Detection","metadata":{}},{"cell_type":"markdown","source":"#### Edge detection is an image processing technique for finding the boundaries of objects within images. It works by detecting discontinuities in brightness.\n#### This could be very beneficial in extracting useful information from the image because most of the shape information is enclosed in the edges. Classic edge detection methods work by detecting discontinuities in the brightness. ","metadata":{}},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\n\nimg=resized_images[25]\nimage = img.convert(\"L\")\n\nimage = image.filter(ImageFilter.FIND_EDGES)\nax[0].imshow(img);\nax[1].imshow(image);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:24.737528Z","iopub.execute_input":"2022-10-22T10:48:24.738042Z","iopub.status.idle":"2022-10-22T10:48:25.265778Z","shell.execute_reply.started":"2022-10-22T10:48:24.738009Z","shell.execute_reply":"2022-10-22T10:48:25.262903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(15, 5));\n\nimg=resized_images[100]\nimage = img.convert(\"L\")\n\nimage = image.filter(ImageFilter.FIND_EDGES)\nax[0].imshow(img);\nax[1].imshow(image);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:25.267466Z","iopub.execute_input":"2022-10-22T10:48:25.267858Z","iopub.status.idle":"2022-10-22T10:48:25.740556Z","shell.execute_reply.started":"2022-10-22T10:48:25.267824Z","shell.execute_reply":"2022-10-22T10:48:25.739308Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\n# Read the original image\nimg=resized_images[105]\nimg=asarray(img)\n\n# Blur the image for better edge detection\nimg_blur = cv2.GaussianBlur(img, (3,3), 0) \n \n# Sobel Edge Detection\nsobelx = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=1, dy=0, ksize=3) # Sobel Edge Detection on the X axis\nsobely = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=0, dy=1, ksize=3) # Sobel Edge Detection on the Y axis\nsobelxy = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=1, dy=1, ksize=5) # Combined X and Y Sobel Edge Detection\n# Laplacian Edge detection\nlaplacian = cv2.Laplacian(img,ksize=3, ddepth=cv2.CV_16S)\n# Canny Edge Detection\ncanny = cv2.Canny(image=img_blur, threshold1=100, threshold2=200) # Canny Edge Detection\n\nplt.subplot(3,2,1),plt.imshow(img)\nplt.title('Original'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,2),plt.imshow(laplacian)\nplt.title('Laplacian'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,3),plt.imshow(canny)\nplt.title('Canny'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,4),plt.imshow(sobelxy)\nplt.title('Sobel XY'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,5),plt.imshow(sobelx)\nplt.title('Sobel X'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,6),plt.imshow(sobely)\nplt.title('Sobel Y'), plt.xticks([]), plt.yticks([]);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:59:43.259039Z","iopub.execute_input":"2022-10-22T10:59:43.259474Z","iopub.status.idle":"2022-10-22T10:59:43.962088Z","shell.execute_reply.started":"2022-10-22T10:59:43.259437Z","shell.execute_reply":"2022-10-22T10:59:43.960864Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\n# Read the original image\nimg=resized_images[63]\nimg=asarray(img)\n\n# Blur the image for better edge detection\nimg_blur = cv2.GaussianBlur(img, (3,3), 0) \n \n# Sobel Edge Detection\nsobelx = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=1, dy=0, ksize=3) # Sobel Edge Detection on the X axis\nsobely = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=0, dy=1, ksize=3) # Sobel Edge Detection on the Y axis\nsobelxy = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=1, dy=1, ksize=5) # Combined X and Y Sobel Edge Detection\n# Laplacian Edge detection\nlaplacian = cv2.Laplacian(img,ksize=3, ddepth=cv2.CV_16S)\n# Canny Edge Detection\ncanny = cv2.Canny(image=img_blur, threshold1=100, threshold2=200) # Canny Edge Detection\n\nplt.subplot(3,2,1),plt.imshow(img)\nplt.title('Original'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,2),plt.imshow(laplacian)\nplt.title('Laplacian'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,3),plt.imshow(canny)\nplt.title('Canny'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,4),plt.imshow(sobelxy)\nplt.title('Sobel XY'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,5),plt.imshow(sobelx)\nplt.title('Sobel X'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,6),plt.imshow(sobely)\nplt.title('Sobel Y'), plt.xticks([]), plt.yticks([]);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:59:00.121216Z","iopub.execute_input":"2022-10-22T10:59:00.122524Z","iopub.status.idle":"2022-10-22T10:59:00.773135Z","shell.execute_reply.started":"2022-10-22T10:59:00.122480Z","shell.execute_reply":"2022-10-22T10:59:00.771942Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\n# Read the original image\nimg=resized_images[30]\nimg=asarray(img)\n\n# Blur the image for better edge detection\nimg_blur = cv2.GaussianBlur(img, (3,3), 0) \n \n# Sobel Edge Detection\nsobelx = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=1, dy=0, ksize=3) # Sobel Edge Detection on the X axis\nsobely = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=0, dy=1, ksize=3) # Sobel Edge Detection on the Y axis\nsobelxy = cv2.Sobel(src=img_blur, ddepth=cv2.CV_16S, dx=1, dy=1, ksize=5) # Combined X and Y Sobel Edge Detection\n# Laplacian Edge detection\nlaplacian = cv2.Laplacian(img,ksize=3, ddepth=cv2.CV_16S)\n# Canny Edge Detection\ncanny = cv2.Canny(image=img_blur, threshold1=100, threshold2=200) # Canny Edge Detection\n\nplt.subplot(3,2,1),plt.imshow(img)\nplt.title('Original'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,2),plt.imshow(laplacian)\nplt.title('Laplacian'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,3),plt.imshow(canny)\nplt.title('Canny'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,4),plt.imshow(sobelxy)\nplt.title('Sobel XY'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,5),plt.imshow(sobelx)\nplt.title('Sobel X'), plt.xticks([]), plt.yticks([])\n\nplt.subplot(3,2,6),plt.imshow(sobely)\nplt.title('Sobel Y'), plt.xticks([]), plt.yticks([]);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:54:36.827584Z","iopub.execute_input":"2022-10-22T10:54:36.827994Z","iopub.status.idle":"2022-10-22T10:54:37.493141Z","shell.execute_reply.started":"2022-10-22T10:54:36.827962Z","shell.execute_reply":"2022-10-22T10:54:37.492305Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Blur","metadata":{}},{"cell_type":"markdown","source":"#### When we blur an image, we make the colour transition from one side of an edge in the image to another smooth rather than sudden. The effect is to average out rapid changes in pixel intensity. A blur is a very common operation we need to perform before other tasks such as thresholding.","metadata":{}},{"cell_type":"code","source":"img=resized_images[0]\nimg=asarray(img)\n\nblur = cv2.blur(img,(5,5))\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('BLUR IMAGE', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:27.830687Z","iopub.execute_input":"2022-10-22T10:48:27.831139Z","iopub.status.idle":"2022-10-22T10:48:28.337844Z","shell.execute_reply.started":"2022-10-22T10:48:27.831097Z","shell.execute_reply":"2022-10-22T10:48:28.336554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img=resized_images[25]\nimg=asarray(img)\n\nblur = cv2.blur(img,(5,5))\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('BLUR IMAGE', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:28.339658Z","iopub.execute_input":"2022-10-22T10:48:28.340837Z","iopub.status.idle":"2022-10-22T10:48:28.883933Z","shell.execute_reply.started":"2022-10-22T10:48:28.340769Z","shell.execute_reply":"2022-10-22T10:48:28.882653Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Gaussian Filtering","metadata":{}},{"cell_type":"markdown","source":"#### Gaussian blur which is also known as gaussian smoothing, is the result of blurring an image by a Gaussian function. It is used to reduce image noise and reduce details. The visual effect of this blurring technique is similar to looking at an image through the translucent screen.","metadata":{}},{"cell_type":"code","source":"img=resized_images[0]\nimg=asarray(img)\n\nblur = cv2.GaussianBlur(img,(5,5),0)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('GAUSSIAN BLUR', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:28.885599Z","iopub.execute_input":"2022-10-22T10:48:28.886076Z","iopub.status.idle":"2022-10-22T10:48:29.387800Z","shell.execute_reply.started":"2022-10-22T10:48:28.886015Z","shell.execute_reply":"2022-10-22T10:48:29.386633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img=resized_images[25]\nimg=asarray(img)\n\nblur = cv2.GaussianBlur(img,(5,5),0)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('GAUSSIAN BLUR', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:29.389499Z","iopub.execute_input":"2022-10-22T10:48:29.389907Z","iopub.status.idle":"2022-10-22T10:48:29.991330Z","shell.execute_reply.started":"2022-10-22T10:48:29.389869Z","shell.execute_reply":"2022-10-22T10:48:29.990185Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Median Filtering","metadata":{}},{"cell_type":"markdown","source":"#### Median filtering is a nonlinear operation often used in image processing to reduce \"salt and pepper\" noise. A median filter is more effective than convolution when the goal is to simultaneously reduce noise and preserve edges.","metadata":{}},{"cell_type":"code","source":"img=resized_images[0]\nimg=asarray(img)\n\nblur_image_median = cv2.medianBlur(img,5)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('MEDIAN BLUR', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur_image_median);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:29.993103Z","iopub.execute_input":"2022-10-22T10:48:29.993532Z","iopub.status.idle":"2022-10-22T10:48:30.588273Z","shell.execute_reply.started":"2022-10-22T10:48:29.993470Z","shell.execute_reply":"2022-10-22T10:48:30.587129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img=resized_images[25]\nimg=asarray(img)\n\nblur_image_median = cv2.medianBlur(img,5)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('MEDIAN BLUR', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur_image_median);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:30.589666Z","iopub.execute_input":"2022-10-22T10:48:30.590063Z","iopub.status.idle":"2022-10-22T10:48:31.233603Z","shell.execute_reply.started":"2022-10-22T10:48:30.590030Z","shell.execute_reply":"2022-10-22T10:48:31.232410Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Bilateral Filtering","metadata":{}},{"cell_type":"markdown","source":"#### The bilateral filter is a non-linear technique that can blur an image while respecting strong edges. ","metadata":{}},{"cell_type":"code","source":"img=resized_images[0]\nimg=asarray(img)\n\nblur_image_median = cv2.bilateralFilter(img,9,75,75)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('BILATERAL FILTER', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur_image_median);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:31.239851Z","iopub.execute_input":"2022-10-22T10:48:31.240453Z","iopub.status.idle":"2022-10-22T10:48:31.866173Z","shell.execute_reply.started":"2022-10-22T10:48:31.240414Z","shell.execute_reply":"2022-10-22T10:48:31.864932Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img=resized_images[25]\nimg=asarray(img)\n\nblur_image_median = cv2.bilateralFilter(img,9,75,75)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('BILATERAL FILTER', fontsize=12)\n\nax[0].imshow(img);\nax[1].imshow(blur_image_median);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:31.867911Z","iopub.execute_input":"2022-10-22T10:48:31.868375Z","iopub.status.idle":"2022-10-22T10:48:32.510168Z","shell.execute_reply.started":"2022-10-22T10:48:31.868326Z","shell.execute_reply":"2022-10-22T10:48:32.509114Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Sharpening ","metadata":{}},{"cell_type":"markdown","source":"#### Sharpening as name suggests is used to sharpen and highlight the edges and make the transitioning of features and details more significant. However sharpening doesn't take into account whether it is highlighting the original features of the image or the noise associated with it. It enhances both.","metadata":{}},{"cell_type":"code","source":"#sharpen the image\ndef sharpen_image(image):\n    image_blurred = cv2.GaussianBlur(image, (0, 0), 3)\n    image_sharp = cv2.addWeighted(image, 1.5, image_blurred, -0.5, 0)\n    return image_sharp","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:32.511993Z","iopub.execute_input":"2022-10-22T10:48:32.512764Z","iopub.status.idle":"2022-10-22T10:48:32.519864Z","shell.execute_reply.started":"2022-10-22T10:48:32.512720Z","shell.execute_reply":"2022-10-22T10:48:32.518446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#get an image\nimg = resized_images[3]\nimg=asarray(img)\n\n\n#sharpen the image\nimage_sharpen = sharpen_image(img)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('SHARPEN', fontsize=12)\n\nax[0].imshow(img/255);\nax[1].imshow(image_sharpen);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:32.521508Z","iopub.execute_input":"2022-10-22T10:48:32.521873Z","iopub.status.idle":"2022-10-22T10:48:33.166011Z","shell.execute_reply.started":"2022-10-22T10:48:32.521838Z","shell.execute_reply":"2022-10-22T10:48:33.164713Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#get an image\nimg = resized_images[25]\nimg=asarray(img)\n\n\n#sharpen the image\nimage_sharpen = sharpen_image(img)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('SHARPEN', fontsize=12)\n\nax[0].imshow(img/255);\nax[1].imshow(image_sharpen);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:33.170137Z","iopub.execute_input":"2022-10-22T10:48:33.170510Z","iopub.status.idle":"2022-10-22T10:48:33.803259Z","shell.execute_reply.started":"2022-10-22T10:48:33.170477Z","shell.execute_reply":"2022-10-22T10:48:33.802334Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#get an image\nimg = resized_images[40]\nimg=asarray(img)\n\n\n#sharpen the image\nimage_sharpen = sharpen_image(img)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('SHARPEN', fontsize=12)\n\nax[0].imshow(img/255);\nax[1].imshow(image_sharpen);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:33.804769Z","iopub.execute_input":"2022-10-22T10:48:33.805896Z","iopub.status.idle":"2022-10-22T10:48:34.472019Z","shell.execute_reply.started":"2022-10-22T10:48:33.805859Z","shell.execute_reply":"2022-10-22T10:48:34.471094Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#get an image\nimg = resized_images[60]\nimg=asarray(img)\n\n\n#sharpen the image\nimage_sharpen = sharpen_image(img)\n\nfig, ax = plt.subplots(1, 2, figsize=(15, 5));\nplt.suptitle('RESULT', x=0.5, y=0.8)\nplt.tight_layout()\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('SHARPEN', fontsize=12)\n\nax[0].imshow(img/255);\nax[1].imshow(image_sharpen);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:34.473353Z","iopub.execute_input":"2022-10-22T10:48:34.474223Z","iopub.status.idle":"2022-10-22T10:48:35.138798Z","shell.execute_reply.started":"2022-10-22T10:48:34.474186Z","shell.execute_reply":"2022-10-22T10:48:35.137660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Thresholding","metadata":{}},{"cell_type":"markdown","source":"####  In thresholding, we convert an image from colour or grayscale into a binary image, i.e., one that is simply black and white. Most frequently, we use thresholding as a way to select areas of interest of an image, while ignoring the parts we are not concerned with","metadata":{}},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(17, 8));\n\nimg = resized_images[0]\nimg=asarray(img)\n\n\nimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\nret,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)\nth2 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\nth3 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\n\ntitles = ['Grey Scale Image', 'Global Thresholding (v = 127)',\n            'Adaptive Mean Thresholding', 'Adaptive Gaussian Thresholding']\nimages = [img, th1, th2, th3]\nfor i in range(4):\n    plt.subplot(2,2,i+1),plt.imshow(images[i],'gray')\n    plt.title(titles[i])\n    plt.xticks([]),plt.yticks([])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:35.140351Z","iopub.execute_input":"2022-10-22T10:48:35.141245Z","iopub.status.idle":"2022-10-22T10:48:35.523709Z","shell.execute_reply.started":"2022-10-22T10:48:35.141210Z","shell.execute_reply":"2022-10-22T10:48:35.522599Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(17, 8));\n\nimg = resized_images[25]\nimg=asarray(img)\n\n\nimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\noriginal =img.copy()\n\nret,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)\nth2 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\nth3 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\n\ntitles = ['Grey Scale Image', 'Global Thresholding (v = 127)',\n            'Adaptive Mean Thresholding', 'Adaptive Gaussian Thresholding']\nimages = [img, th1, th2, th3]\nfor i in range(4):\n    plt.subplot(2,2,i+1),plt.imshow(images[i],'gray')\n    plt.title(titles[i])\n    plt.xticks([]),plt.yticks([])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:35.525450Z","iopub.execute_input":"2022-10-22T10:48:35.525780Z","iopub.status.idle":"2022-10-22T10:48:36.220578Z","shell.execute_reply.started":"2022-10-22T10:48:35.525749Z","shell.execute_reply":"2022-10-22T10:48:36.219393Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(17, 8));\n\nimg = resized_images[15]\nimg=asarray(img)\n\n\nimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\n\nret,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)\nth2 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\nth3 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\n\ntitles = ['Grey Scale Image', 'Global Thresholding (v = 127)',\n            'Adaptive Mean Thresholding', 'Adaptive Gaussian Thresholding']\nimages = [img, th1, th2, th3]\nfor i in range(4):\n    plt.subplot(2,2,i+1),plt.imshow(images[i],'gray')\n    plt.title(titles[i])\n    plt.xticks([]),plt.yticks([])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:36.222551Z","iopub.execute_input":"2022-10-22T10:48:36.222927Z","iopub.status.idle":"2022-10-22T10:48:36.582456Z","shell.execute_reply.started":"2022-10-22T10:48:36.222894Z","shell.execute_reply":"2022-10-22T10:48:36.580850Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 2, figsize=(17, 8));\n\nimg = resized_images[60]\nimg=asarray(img)\n\n\nimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\noriginal =img.copy()\n\nret,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)\nth2 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\nth3 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\n                                          cv2.THRESH_BINARY, 199, 5)\n\ntitles = ['Grey Scale Image', 'Global Thresholding (v = 127)',\n            'Adaptive Mean Thresholding', 'Adaptive Gaussian Thresholding']\nimages = [img, th1, th2, th3]\nfor i in range(4):\n    plt.subplot(2,2,i+1),plt.imshow(images[i],'gray')\n    plt.title(titles[i])\n    plt.xticks([]),plt.yticks([])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:36.583882Z","iopub.execute_input":"2022-10-22T10:48:36.584228Z","iopub.status.idle":"2022-10-22T10:48:36.949583Z","shell.execute_reply.started":"2022-10-22T10:48:36.584196Z","shell.execute_reply":"2022-10-22T10:48:36.948072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Contrast ","metadata":{}},{"cell_type":"markdown","source":"#### The term contrast refers to the amount of color or grayscale differentiation that exists between various image features in both analog and digital images. Images having a higher contrast level generally display a greater degree of color or grayscale variation than those of lower contrast.","metadata":{}},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\n\nimg=resized_images[10]\n# img=asarray(img)\n\nenhancer = ImageEnhance.Contrast(img)\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Low Contrast', fontsize=12)\nax[2].set_title('High Contrast', fontsize=12)\n\nfactor = 1 #gives original image\nim_output = enhancer.enhance(factor)\nax[0].imshow(im_output);\n\n\nfactor = 0.5 #decrease constrast\nim_output = enhancer.enhance(factor)\nax[1].imshow(im_output);\n\n\nfactor = 1.5 #increase contrast\nim_output = enhancer.enhance(factor)\nax[2].imshow(im_output);\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:36.951054Z","iopub.execute_input":"2022-10-22T10:48:36.951395Z","iopub.status.idle":"2022-10-22T10:48:37.602000Z","shell.execute_reply.started":"2022-10-22T10:48:36.951363Z","shell.execute_reply":"2022-10-22T10:48:37.600866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\n\nimg=resized_images[22]\n\nenhancer = ImageEnhance.Contrast(img)\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Low Contrast', fontsize=12)\nax[2].set_title('High Contrast', fontsize=12)\n\nfactor = 1 #gives original image\nim_output = enhancer.enhance(factor)\nax[0].imshow(im_output);\n\n\nfactor = 0.5 #decrease constrast\nim_output = enhancer.enhance(factor)\nax[1].imshow(im_output);\n\n\nfactor = 1.5 #increase contrast\nim_output = enhancer.enhance(factor)\nax[2].imshow(im_output);\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:57:24.379629Z","iopub.execute_input":"2022-10-22T10:57:24.380033Z","iopub.status.idle":"2022-10-22T10:57:25.029575Z","shell.execute_reply.started":"2022-10-22T10:57:24.380001Z","shell.execute_reply":"2022-10-22T10:57:25.028346Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\n\nimg=resized_images[50]\n\nenhancer = ImageEnhance.Contrast(img)\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Low Contrast', fontsize=12)\nax[2].set_title('High Contrast', fontsize=12)\n\nfactor = 1 #gives original image\nim_output = enhancer.enhance(factor)\nax[0].imshow(im_output);\n\n\nfactor = 0.5 #decrease constrast\nim_output = enhancer.enhance(factor)\nax[1].imshow(im_output);\n\n\nfactor = 1.5 #increase contrast\nim_output = enhancer.enhance(factor)\nax[2].imshow(im_output);\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:38.275348Z","iopub.execute_input":"2022-10-22T10:48:38.275950Z","iopub.status.idle":"2022-10-22T10:48:38.941652Z","shell.execute_reply.started":"2022-10-22T10:48:38.275902Z","shell.execute_reply":"2022-10-22T10:48:38.940348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Dilation and Erosion","metadata":{}},{"cell_type":"markdown","source":"#### Dilation operation adds pixels to the boundaries of the object in an image\n- In cases like noise removal, erosion is followed by dilation. Because, erosion removes white noises, but it also shrinks our object. So we dilate it. Since noise is gone, they won’t come back, but our object area increases.\n- It is also useful in joining broken parts of an object.\n\n#### Erosion operation removes the pixels from the object boundaries. \n- It is useful for removing small white noises.\n- Used to detach two connected objects etc.","metadata":{}},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\n\nimg= resized_images[51]\nimg= asarray(img)\n\nkernel = np.ones((5, 5), np.uint8)\n \n# The first parameter is the original image,\n# kernel is the matrix with which image is\n# convolved and third parameter is the number\n# of iterations, which will determine how much\n# you want to erode/dilate a given image.\n\nimg_erosion = cv2.erode(img, kernel, iterations=1)\nimg_dilation = cv2.dilate(img, kernel, iterations=1)\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Erosion', fontsize=12)\nax[2].set_title('Dilation', fontsize=12)\n \nax[0].imshow(img);\nax[1].imshow(img_erosion);\nax[2].imshow(img_dilation);\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:53:35.906232Z","iopub.execute_input":"2022-10-22T10:53:35.906665Z","iopub.status.idle":"2022-10-22T10:53:36.563007Z","shell.execute_reply.started":"2022-10-22T10:53:35.906628Z","shell.execute_reply":"2022-10-22T10:53:36.561891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\n\nimg= resized_images[43]\nimg= asarray(img)\n\nkernel = np.ones((5, 5), np.uint8)\n\nimg_erosion = cv2.erode(img, kernel, iterations=1)\nimg_dilation = cv2.dilate(img, kernel, iterations=1)\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Erosion', fontsize=12)\nax[2].set_title('Dilation', fontsize=12)\n \nax[0].imshow(img);\nax[1].imshow(img_erosion);\nax[2].imshow(img_dilation);\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:57:00.084834Z","iopub.execute_input":"2022-10-22T10:57:00.085265Z","iopub.status.idle":"2022-10-22T10:57:00.717205Z","shell.execute_reply.started":"2022-10-22T10:57:00.085228Z","shell.execute_reply":"2022-10-22T10:57:00.715984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\n\nimg= resized_images[19]\nimg= asarray(img)\n\nkernel = np.ones((5, 5), np.uint8)\n\nimg_erosion = cv2.erode(img, kernel, iterations=1)\nimg_dilation = cv2.dilate(img, kernel, iterations=1)\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Erosion', fontsize=12)\nax[2].set_title('Dilation', fontsize=12)\n \nax[0].imshow(img);\nax[1].imshow(img_erosion);\nax[2].imshow(img_dilation);\n","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:40.233958Z","iopub.execute_input":"2022-10-22T10:48:40.234285Z","iopub.status.idle":"2022-10-22T10:48:40.841248Z","shell.execute_reply.started":"2022-10-22T10:48:40.234254Z","shell.execute_reply":"2022-10-22T10:48:40.840186Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(1, 3, figsize=(15, 7));\n\nimg= resized_images[45]\nimg= asarray(img)\n\nkernel = np.ones((5, 5), np.uint8)\n\nimg_erosion = cv2.erode(img, kernel, iterations=1)\nimg_dilation = cv2.dilate(img, kernel, iterations=1)\n\nax[0].set_title('ORIGINAL', fontsize=12)\nax[1].set_title('Erosion', fontsize=12)\nax[2].set_title('Dilation', fontsize=12)\n \nax[0].imshow(img);\nax[1].imshow(img_erosion);\nax[2].imshow(img_dilation);","metadata":{"execution":{"iopub.status.busy":"2022-10-22T10:48:40.843440Z","iopub.execute_input":"2022-10-22T10:48:40.843841Z","iopub.status.idle":"2022-10-22T10:48:41.463222Z","shell.execute_reply.started":"2022-10-22T10:48:40.843804Z","shell.execute_reply":"2022-10-22T10:48:41.462165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}