{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":4104,"databundleVersionId":46661,"sourceType":"competition"}],"dockerImageVersionId":30804,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport os\nimport matplotlib.pyplot as plt\nimport cv2\n\nfrom skimage.feature import local_binary_pattern","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:44.748996Z","iopub.execute_input":"2024-12-14T10:04:44.749379Z","iopub.status.idle":"2024-12-14T10:04:46.778032Z","shell.execute_reply.started":"2024-12-14T10:04:44.749323Z","shell.execute_reply":"2024-12-14T10:04:46.776792Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!unzip /kaggle/input/diabetic-retinopathy-detection/trainLabels.csv.zip","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:46.780296Z","iopub.execute_input":"2024-12-14T10:04:46.781075Z","iopub.status.idle":"2024-12-14T10:04:48.039079Z","shell.execute_reply.started":"2024-12-14T10:04:46.781012Z","shell.execute_reply":"2024-12-14T10:04:48.037415Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"os.listdir()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.041053Z","iopub.execute_input":"2024-12-14T10:04:48.041454Z","iopub.status.idle":"2024-12-14T10:04:48.052063Z","shell.execute_reply.started":"2024-12-14T10:04:48.041413Z","shell.execute_reply":"2024-12-14T10:04:48.050711Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df = pd.read_csv(r'trainLabels.csv')\ndf.head","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.055182Z","iopub.execute_input":"2024-12-14T10:04:48.056289Z","iopub.status.idle":"2024-12-14T10:04:48.121553Z","shell.execute_reply.started":"2024-12-14T10:04:48.056230Z","shell.execute_reply":"2024-12-14T10:04:48.120289Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.123239Z","iopub.execute_input":"2024-12-14T10:04:48.123565Z","iopub.status.idle":"2024-12-14T10:04:48.137651Z","shell.execute_reply.started":"2024-12-14T10:04:48.123531Z","shell.execute_reply":"2024-12-14T10:04:48.136443Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"_ , b = np.unique(df.image.apply(lambda x : x.split(\"_\")[0]) , return_counts = True)\nb","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.139166Z","iopub.execute_input":"2024-12-14T10:04:48.139521Z","iopub.status.idle":"2024-12-14T10:04:48.192957Z","shell.execute_reply.started":"2024-12-14T10:04:48.139486Z","shell.execute_reply":"2024-12-14T10:04:48.191466Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"np.unique(b)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.194399Z","iopub.execute_input":"2024-12-14T10:04:48.194794Z","iopub.status.idle":"2024-12-14T10:04:48.202566Z","shell.execute_reply.started":"2024-12-14T10:04:48.194755Z","shell.execute_reply":"2024-12-14T10:04:48.201579Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.level.unique()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.204249Z","iopub.execute_input":"2024-12-14T10:04:48.204727Z","iopub.status.idle":"2024-12-14T10:04:48.222983Z","shell.execute_reply.started":"2024-12-14T10:04:48.204658Z","shell.execute_reply":"2024-12-14T10:04:48.221546Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"stages , stage_frequency = np.unique(df.level , return_counts = True)\nstages","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.225120Z","iopub.execute_input":"2024-12-14T10:04:48.225574Z","iopub.status.idle":"2024-12-14T10:04:48.239145Z","shell.execute_reply.started":"2024-12-14T10:04:48.225526Z","shell.execute_reply":"2024-12-14T10:04:48.237773Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"stage_frequency","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.243308Z","iopub.execute_input":"2024-12-14T10:04:48.243756Z","iopub.status.idle":"2024-12-14T10:04:48.252055Z","shell.execute_reply.started":"2024-12-14T10:04:48.243720Z","shell.execute_reply":"2024-12-14T10:04:48.250771Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"stage_names = [\"No DR\" , \"Mild\" , \"Moderate\" , \"Severe\" , \"Proliferative\"]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.254110Z","iopub.execute_input":"2024-12-14T10:04:48.254507Z","iopub.status.idle":"2024-12-14T10:04:48.263528Z","shell.execute_reply.started":"2024-12-14T10:04:48.254449Z","shell.execute_reply":"2024-12-14T10:04:48.262239Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"stage_mapping = dict(zip(stages , stage_names))\nstage_mapping","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.265350Z","iopub.execute_input":"2024-12-14T10:04:48.265766Z","iopub.status.idle":"2024-12-14T10:04:48.281686Z","shell.execute_reply.started":"2024-12-14T10:04:48.265708Z","shell.execute_reply":"2024-12-14T10:04:48.280543Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.bar(stage_names , stage_frequency , color = plt.cm.Set3(np.arange(len(stage_names))))\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.283198Z","iopub.execute_input":"2024-12-14T10:04:48.283647Z","iopub.status.idle":"2024-12-14T10:04:48.581639Z","shell.execute_reply.started":"2024-12-14T10:04:48.283601Z","shell.execute_reply":"2024-12-14T10:04:48.580060Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(\"Lowest: \" , np.round((stage_frequency.min() / stage_frequency.sum()) * 100 , 2))\nprint(\"Highest: \" , np.round((stage_frequency.max() / stage_frequency.sum()) * 100 , 2))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.583525Z","iopub.execute_input":"2024-12-14T10:04:48.584765Z","iopub.status.idle":"2024-12-14T10:04:48.591472Z","shell.execute_reply.started":"2024-12-14T10:04:48.584707Z","shell.execute_reply":"2024-12-14T10:04:48.590195Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!unzip /kaggle/input/diabetic-retinopathy-detection/sample.zip","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:48.592843Z","iopub.execute_input":"2024-12-14T10:04:48.593226Z","iopub.status.idle":"2024-12-14T10:04:50.063142Z","shell.execute_reply.started":"2024-12-14T10:04:48.593178Z","shell.execute_reply":"2024-12-14T10:04:50.061767Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"left1 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/10_left.jpeg\") , cv2.COLOR_BGR2RGB) \nright1 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/10_right.jpeg\") , cv2.COLOR_BGR2RGB) \nleft2 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/13_left.jpeg\") , cv2.COLOR_BGR2RGB) \nright2 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/13_right.jpeg\") , cv2.COLOR_BGR2RGB) \nleft3 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/15_left.jpeg\") , cv2.COLOR_BGR2RGB) \nright3 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/15_right.jpeg\") , cv2.COLOR_BGR2RGB) \nleft4 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/16_left.jpeg\") , cv2.COLOR_BGR2RGB) \nright4 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/16_right.jpeg\") , cv2.COLOR_BGR2RGB) \nleft5 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/17_left.jpeg\") , cv2.COLOR_BGR2RGB) \nright5 = cv2.cvtColor(cv2.imread(\"/kaggle/working/sample/17_right.jpeg\") , cv2.COLOR_BGR2RGB) \nf, axarr = plt.subplots(2,4)\naxarr[0 , 0].imshow(left1)\naxarr[1 , 0].imshow(right1)\naxarr[0 , 1].imshow(left2)\naxarr[1 , 1].imshow(right2)\naxarr[0 , 2].imshow(left3)\naxarr[1 , 2].imshow(right3)\naxarr[0 , 3].imshow(left4)\naxarr[1 , 3].imshow(right4)\n#axarr[0 , 4].imshow(left5)\n#axarr[1 , 4].imshow(right5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:04:50.065208Z","iopub.execute_input":"2024-12-14T10:04:50.065654Z","iopub.status.idle":"2024-12-14T10:05:00.953564Z","shell.execute_reply.started":"2024-12-14T10:04:50.065618Z","shell.execute_reply":"2024-12-14T10:05:00.952285Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"left1.shape , left2.shape , left3.shape , left4.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:05:00.955205Z","iopub.execute_input":"2024-12-14T10:05:00.955648Z","iopub.status.idle":"2024-12-14T10:05:00.965113Z","shell.execute_reply.started":"2024-12-14T10:05:00.955603Z","shell.execute_reply":"2024-12-14T10:05:00.963513Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!apt install p7zip-full -y\n!7z x ../input/diabetic-retinopathy-detection/train.zip.001 \"-i!train/11*.jpeg\" -y # restrict extracted file to about 100 for the disk restriction\n!mkdir data\n!mv train data/train_11","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:05:00.966779Z","iopub.execute_input":"2024-12-14T10:05:00.967246Z","iopub.status.idle":"2024-12-14T10:05:30.108193Z","shell.execute_reply.started":"2024-12-14T10:05:00.967197Z","shell.execute_reply":"2024-12-14T10:05:30.106418Z"},"collapsed":true,"jupyter":{"outputs_hidden":true}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"len(os.listdir(\"/kaggle/working/data/train_11\"))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:05:30.110536Z","iopub.execute_input":"2024-12-14T10:05:30.111110Z","iopub.status.idle":"2024-12-14T10:05:30.122127Z","shell.execute_reply.started":"2024-12-14T10:05:30.111057Z","shell.execute_reply":"2024-12-14T10:05:30.120783Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"width , height = [] , []\nfor img_name in os.listdir(\"/kaggle/working/data/train_11\"):\n    img = cv2.imread(\"/kaggle/working/data/train_11/\" + img_name)\n    width.append(img.shape[0])\n    height.append(img.shape[1])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:05:30.123831Z","iopub.execute_input":"2024-12-14T10:05:30.124170Z","iopub.status.idle":"2024-12-14T10:06:23.408279Z","shell.execute_reply.started":"2024-12-14T10:05:30.124121Z","shell.execute_reply":"2024-12-14T10:06:23.406976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"np.mean(width) , np.mean(height)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.409838Z","iopub.execute_input":"2024-12-14T10:06:23.410199Z","iopub.status.idle":"2024-12-14T10:06:23.418061Z","shell.execute_reply.started":"2024-12-14T10:06:23.410165Z","shell.execute_reply":"2024-12-14T10:06:23.416895Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"all_img_names = [img_name.split(\".\")[0] for img_name in os.listdir(\"/kaggle/working/data/train_11\")]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.419447Z","iopub.execute_input":"2024-12-14T10:06:23.419881Z","iopub.status.idle":"2024-12-14T10:06:23.433866Z","shell.execute_reply.started":"2024-12-14T10:06:23.419844Z","shell.execute_reply":"2024-12-14T10:06:23.432587Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"small_df = df[df.image.isin(all_img_names)].reset_index(drop = True)\nsmall_df.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.435398Z","iopub.execute_input":"2024-12-14T10:06:23.435849Z","iopub.status.idle":"2024-12-14T10:06:23.462201Z","shell.execute_reply.started":"2024-12-14T10:06:23.435816Z","shell.execute_reply":"2024-12-14T10:06:23.460926Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"sample_stages , sample_stage_frequency = np.unique(small_df.level , return_counts = True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.463638Z","iopub.execute_input":"2024-12-14T10:06:23.464059Z","iopub.status.idle":"2024-12-14T10:06:23.481742Z","shell.execute_reply.started":"2024-12-14T10:06:23.464025Z","shell.execute_reply":"2024-12-14T10:06:23.480131Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.bar(sample_stages , sample_stage_frequency , color = plt.cm.Set3(np.arange(len(sample_stages))))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.483242Z","iopub.execute_input":"2024-12-14T10:06:23.483764Z","iopub.status.idle":"2024-12-14T10:06:23.728847Z","shell.execute_reply.started":"2024-12-14T10:06:23.483652Z","shell.execute_reply":"2024-12-14T10:06:23.727731Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cv2.imread(\"/kaggle/working/data/train_11/\" + \"111_left.jpeg\").mean(axis = (0 , 1))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.730264Z","iopub.execute_input":"2024-12-14T10:06:23.730724Z","iopub.status.idle":"2024-12-14T10:06:23.980895Z","shell.execute_reply.started":"2024-12-14T10:06:23.730650Z","shell.execute_reply":"2024-12-14T10:06:23.979715Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dir_path = \"/kaggle/working/data/train_11/\"\nlevel_bgr = {}\nfor level in sample_stages:\n    level_df = small_df[small_df.level == level].image\n    level_r , level_g , level_b = [] , [] , []\n    for img_name in level_df:\n        img = cv2.imread(dir_path + img_name + \".jpeg\")\n        level_b.append(img.mean(axis = (0 , 1))[0])\n        level_g.append(img.mean(axis = (0 , 1))[1])\n        level_r.append(img.mean(axis = (0 , 1))[2])\n    level_bgr[level] = [np.mean(level_b) , np.mean(level_g) , np.mean(level_r)]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:06:23.982242Z","iopub.execute_input":"2024-12-14T10:06:23.982726Z","iopub.status.idle":"2024-12-14T10:17:30.582168Z","shell.execute_reply.started":"2024-12-14T10:06:23.982654Z","shell.execute_reply":"2024-12-14T10:17:30.580236Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"level_bgr","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:17:30.587048Z","iopub.execute_input":"2024-12-14T10:17:30.587447Z","iopub.status.idle":"2024-12-14T10:17:30.595173Z","shell.execute_reply.started":"2024-12-14T10:17:30.587412Z","shell.execute_reply":"2024-12-14T10:17:30.593957Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"blue = np.array(list(level_bgr.values()))[: , 0]\ngreen = np.array(list(level_bgr.values()))[: , 1]\nred = np.array(list(level_bgr.values()))[: , 2]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:17:30.596719Z","iopub.execute_input":"2024-12-14T10:17:30.597062Z","iopub.status.idle":"2024-12-14T10:17:30.611534Z","shell.execute_reply.started":"2024-12-14T10:17:30.597019Z","shell.execute_reply":"2024-12-14T10:17:30.610370Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"blue","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:17:30.612982Z","iopub.execute_input":"2024-12-14T10:17:30.613343Z","iopub.status.idle":"2024-12-14T10:17:30.632716Z","shell.execute_reply.started":"2024-12-14T10:17:30.613308Z","shell.execute_reply":"2024-12-14T10:17:30.631642Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"x_axis = np.arange(len(sample_stages))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:17:30.634159Z","iopub.execute_input":"2024-12-14T10:17:30.634457Z","iopub.status.idle":"2024-12-14T10:17:30.650621Z","shell.execute_reply.started":"2024-12-14T10:17:30.634429Z","shell.execute_reply":"2024-12-14T10:17:30.649429Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.bar(x_axis - 0.2, blue , 0.4 , color = 'blue')\nplt.bar(x_axis , green , 0.4 , color = 'green')\nplt.bar(x_axis + 0.2 , red , 0.4 , color = \"red\")\nplt.xticks(x_axis , stage_names)\nplt.xlabel(\"Colors\") \nplt.ylabel(\"Mean of each color\")  \nplt.legend() \nplt.show() ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:17:30.652148Z","iopub.execute_input":"2024-12-14T10:17:30.652558Z","iopub.status.idle":"2024-12-14T10:17:30.834687Z","shell.execute_reply.started":"2024-12-14T10:17:30.652514Z","shell.execute_reply":"2024-12-14T10:17:30.832529Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dir_path = \"/kaggle/working/data/train_11/\"\nlevel_brightness_dict = {}\nlevel_contrast_dict = {}\nfor level in sample_stages:\n    level_df = small_df[small_df.level == level].image\n    level_brightness = []\n    level_contrast = []\n    for img_name in level_df:\n        img = cv2.imread(dir_path + img_name + \".jpeg\")\n        gray_img = cv2.cvtColor(img , cv2.COLOR_BGR2GRAY)\n        level_brightness.append(gray_img.mean())\n        level_contrast.append(gray_img.std())\n    level_brightness_dict[level] = [level_brightness]\n    level_contrast_dict[level] = [level_contrast]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:17:30.836439Z","iopub.execute_input":"2024-12-14T10:17:30.838089Z","iopub.status.idle":"2024-12-14T10:19:12.668598Z","shell.execute_reply.started":"2024-12-14T10:17:30.838028Z","shell.execute_reply":"2024-12-14T10:19:12.666970Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig, axes = plt.subplots(2, 5, figsize=(15, 6))\n\nfor i in range(5):\n    axes[0, i].hist(level_brightness_dict[i], bins=50, alpha=1, color='black')\n    axes[0, i].set_title(f'Level {i} Brightness')\n\nfor i in range(5):\n    axes[1, i].hist(level_contrast_dict[i], bins=50, alpha=1, color='black')\n    axes[1, i].set_title(f'Level {i} Contrast')\n\nplt.tight_layout()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:19:12.670140Z","iopub.execute_input":"2024-12-14T10:19:12.670508Z","iopub.status.idle":"2024-12-14T10:19:15.088980Z","shell.execute_reply.started":"2024-12-14T10:19:12.670473Z","shell.execute_reply":"2024-12-14T10:19:15.087772Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"radius = 3\nn_points = 8 * radius\nmethod = 'uniform'","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:20:48.677066Z","iopub.execute_input":"2024-12-14T10:20:48.677514Z","iopub.status.idle":"2024-12-14T10:20:48.682891Z","shell.execute_reply.started":"2024-12-14T10:20:48.677478Z","shell.execute_reply":"2024-12-14T10:20:48.681607Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"img = cv2.imread(\"/kaggle/working/data/train_11/\" + \"111_left.jpeg\")\ngray_img = cv2.cvtColor(img , cv2.COLOR_BGR2GRAY)\nlbp_image = local_binary_pattern(gray_img, n_points, radius, method)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:23:05.764802Z","iopub.execute_input":"2024-12-14T10:23:05.765235Z","iopub.status.idle":"2024-12-14T10:23:09.181312Z","shell.execute_reply.started":"2024-12-14T10:23:05.765199Z","shell.execute_reply":"2024-12-14T10:23:09.180279Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(12, 6))\nplt.subplot(1, 2, 1)\nplt.title('Original Image')\nplt.imshow(img, cmap='gray')\nplt.subplot(1, 2, 2)\nplt.title('LBP Image')\nplt.imshow(lbp_image, cmap='gray')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:23:41.578609Z","iopub.execute_input":"2024-12-14T10:23:41.579031Z","iopub.status.idle":"2024-12-14T10:23:43.569162Z","shell.execute_reply.started":"2024-12-14T10:23:41.578995Z","shell.execute_reply":"2024-12-14T10:23:43.567975Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Will have to do something with the black border pixels\n#Images will have to be resized as they are not all of the same size\n#Images will be resized to 224 and saved for easier loading\n#illumination is different even for the same person\n#From the color histogram: Blue < Green < Red\n#From the analysis of other notebooks, they use a subset of images ~1k.\n#Class imbalance, undersampling with 700*5 = 3.5k images.\n#Obvious inference that most pictures have low brightness.\n#","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-14T10:19:15.090434Z","iopub.execute_input":"2024-12-14T10:19:15.090792Z","iopub.status.idle":"2024-12-14T10:19:15.095943Z","shell.execute_reply.started":"2024-12-14T10:19:15.090759Z","shell.execute_reply":"2024-12-14T10:19:15.094776Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}