{"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\nimport matplotlib.pyplot as plt\nfrom skimage import io","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-18T05:25:35.833944Z","iopub.execute_input":"2023-10-18T05:25:35.834364Z","iopub.status.idle":"2023-10-18T05:25:36.682945Z","shell.execute_reply.started":"2023-10-18T05:25:35.834333Z","shell.execute_reply":"2023-10-18T05:25:36.68206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv('../input/UBC-OCEAN/train.csv')\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:15:22.445572Z","iopub.execute_input":"2023-10-18T05:15:22.445966Z","iopub.status.idle":"2023-10-18T05:15:22.475046Z","shell.execute_reply.started":"2023-10-18T05:15:22.445939Z","shell.execute_reply":"2023-10-18T05:15:22.474217Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['label'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:18:33.612977Z","iopub.execute_input":"2023-10-18T05:18:33.613604Z","iopub.status.idle":"2023-10-18T05:18:33.624503Z","shell.execute_reply.started":"2023-10-18T05:18:33.613569Z","shell.execute_reply":"2023-10-18T05:18:33.623402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['is_tma'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:41:11.984524Z","iopub.execute_input":"2023-10-18T05:41:11.984901Z","iopub.status.idle":"2023-10-18T05:41:11.995843Z","shell.execute_reply.started":"2023-10-18T05:41:11.984874Z","shell.execute_reply":"2023-10-18T05:41:11.994707Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_heights = list(train[train.is_tma==False].image_height)\nimg_widths = list(train[train.is_tma==False].image_width)\nfigure = plt.figure(figsize = (8,3))\nax1 = figure.add_subplot(1,2,1)\nax1.hist(img_heights, color='red', ec='black')\nax1.set_title(f'Image Heights', fontsize=10)\nax2 = figure.add_subplot(1,2,2)\nax2.hist(img_widths, color='blue', ec='black')\nax2.set_title(f'Image Widths', fontsize=10)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:21:52.026038Z","iopub.execute_input":"2023-10-18T05:21:52.026446Z","iopub.status.idle":"2023-10-18T05:21:52.402094Z","shell.execute_reply.started":"2023-10-18T05:21:52.026417Z","shell.execute_reply":"2023-10-18T05:21:52.401398Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def display_images(tma=True):\n    labels = ['HGSC', 'LGSC', 'EC', 'CC', 'MC']\n    for l in labels:\n        imgs = train[train.label==l]\n        img_ids = list(imgs[imgs.is_tma==tma].image_id.sample(5))\n        figure = plt.figure(figsize = (20,6))\n        i = 0\n        for img_id in img_ids:\n            ax = figure.add_subplot(1,5,i+1)\n            if tma:\n                io.imshow(f'../input/UBC-OCEAN/train_images/{img_id}.png')\n            else: \n                io.imshow(f'../input/UBC-OCEAN/train_thumbnails/{img_id}_thumbnail.png')\n            ax.set_title(f'Image Id:{img_id}, label:{l}', fontsize=14)\n            i += 1\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:42:02.46972Z","iopub.execute_input":"2023-10-18T05:42:02.470105Z","iopub.status.idle":"2023-10-18T05:42:02.477527Z","shell.execute_reply.started":"2023-10-18T05:42:02.470075Z","shell.execute_reply":"2023-10-18T05:42:02.476304Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display_images(tma=True)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:35:12.590456Z","iopub.execute_input":"2023-10-18T05:35:12.590794Z","iopub.status.idle":"2023-10-18T05:35:54.875291Z","shell.execute_reply.started":"2023-10-18T05:35:12.590769Z","shell.execute_reply":"2023-10-18T05:35:54.87444Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display_images(tma=False)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T05:42:10.042541Z","iopub.execute_input":"2023-10-18T05:42:10.042889Z","iopub.status.idle":"2023-10-18T05:42:30.831351Z","shell.execute_reply.started":"2023-10-18T05:42:10.042862Z","shell.execute_reply":"2023-10-18T05:42:30.830477Z"},"trusted":true},"execution_count":null,"outputs":[]}]}