{"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 # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport tifffile as tiff \nimport cv2","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-07T05:41:28.349544Z","iopub.execute_input":"2022-07-07T05:41:28.350026Z","iopub.status.idle":"2022-07-07T05:41:29.659103Z","shell.execute_reply.started":"2022-07-07T05:41:28.349925Z","shell.execute_reply":"2022-07-07T05:41:29.657821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_images_path='../input/mayo-clinic-strip-ai/train'\ntest_images_path='../input/mayo-clinic-strip-ai/test'\n\ntrain_df=pd.read_csv('../input/mayo-clinic-strip-ai/train.csv')\ntest_df=pd.read_csv('../input/mayo-clinic-strip-ai/test.csv')\nsample_sub=pd.read_csv('../input/mayo-clinic-strip-ai/sample_submission.csv')\n\nprint('Train Dataframe size: ',train_df.shape)\nprint('Test Dataframe size: ',test_df.shape)","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:41:29.661297Z","iopub.execute_input":"2022-07-07T05:41:29.661664Z","iopub.status.idle":"2022-07-07T05:41:29.692115Z","shell.execute_reply.started":"2022-07-07T05:41:29.661628Z","shell.execute_reply":"2022-07-07T05:41:29.69128Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Number of images in training: {}'.format(len(os.listdir(train_images_path))))\nprint('Number of images in test: {}'.format(len(os.listdir(test_images_path))))","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:41:29.693143Z","iopub.execute_input":"2022-07-07T05:41:29.69381Z","iopub.status.idle":"2022-07-07T05:41:29.765216Z","shell.execute_reply.started":"2022-07-07T05:41:29.693776Z","shell.execute_reply":"2022-07-07T05:41:29.764224Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Lets take a loot at train dataframe\ntrain_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:41:29.767237Z","iopub.execute_input":"2022-07-07T05:41:29.767866Z","iopub.status.idle":"2022-07-07T05:41:29.794022Z","shell.execute_reply.started":"2022-07-07T05:41:29.767831Z","shell.execute_reply":"2022-07-07T05:41:29.792879Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Number of unique image ids: {}'.format(train_df['image_id'].nunique()))\nprint('Number of unique patient ids: {}'.format(train_df['patient_id'].nunique()))","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:41:29.795463Z","iopub.execute_input":"2022-07-07T05:41:29.796576Z","iopub.status.idle":"2022-07-07T05:41:29.81102Z","shell.execute_reply.started":"2022-07-07T05:41:29.79653Z","shell.execute_reply":"2022-07-07T05:41:29.809679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Target Distribution\nsns.displot(train_df['label'])\nlabels_count=train_df['label'].value_counts()\nprint('{:.2f}% Labels belong to CE while {:.2F}% belong to LAA'.format(labels_count['CE']*100/754,\n                                                               labels_count['LAA']*100/754))","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:41:29.81272Z","iopub.execute_input":"2022-07-07T05:41:29.813768Z","iopub.status.idle":"2022-07-07T05:41:30.083549Z","shell.execute_reply.started":"2022-07-07T05:41:29.813731Z","shell.execute_reply":"2022-07-07T05:41:30.082446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Now time to look at some images\nimg=tiff.imread(os.path.join(train_images_path,str(train_df.loc[1,'image_id'])+'.tif'))\nprint('Image Shape: ',img.shape)\n#img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:41:30.085041Z","iopub.execute_input":"2022-07-07T05:41:30.085381Z","iopub.status.idle":"2022-07-07T05:41:34.674912Z","shell.execute_reply.started":"2022-07-07T05:41:30.085351Z","shell.execute_reply":"2022-07-07T05:41:34.673683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig=plt.figure(figsize=(12,12))\nplt.imshow(img)","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:42:44.015116Z","iopub.execute_input":"2022-07-07T05:42:44.015533Z","iopub.status.idle":"2022-07-07T05:42:56.383842Z","shell.execute_reply.started":"2022-07-07T05:42:44.015501Z","shell.execute_reply":"2022-07-07T05:42:56.382857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img=tiff.imread(os.path.join(train_images_path,str(train_df.loc[4,'image_id'])+'.tif'))\nprint('Image Shape: ',img.shape)\n\nfig=plt.figure(figsize=(12,12))\nplt.imshow(img)","metadata":{"execution":{"iopub.status.busy":"2022-07-07T05:44:38.754947Z","iopub.execute_input":"2022-07-07T05:44:38.755481Z","iopub.status.idle":"2022-07-07T05:44:50.559349Z","shell.execute_reply.started":"2022-07-07T05:44:38.755443Z","shell.execute_reply":"2022-07-07T05:44:50.558287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Well...the images are extremely huge**","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}