{"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":"!pip install tifffile","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:07:28.209231Z","iopub.execute_input":"2022-07-09T07:07:28.209612Z","iopub.status.idle":"2022-07-09T07:07:42.571278Z","shell.execute_reply.started":"2022-07-09T07:07:28.209587Z","shell.execute_reply":"2022-07-09T07:07:42.569033Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n        break\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-09T07:01:20.486263Z","iopub.execute_input":"2022-07-09T07:01:20.486686Z","iopub.status.idle":"2022-07-09T07:01:20.655771Z","shell.execute_reply.started":"2022-07-09T07:01:20.486642Z","shell.execute_reply":"2022-07-09T07:01:20.654788Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tifffile\nfrom glob import glob\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:10:38.484745Z","iopub.execute_input":"2022-07-09T07:10:38.485050Z","iopub.status.idle":"2022-07-09T07:10:38.489694Z","shell.execute_reply.started":"2022-07-09T07:10:38.485027Z","shell.execute_reply":"2022-07-09T07:10:38.488488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"images =glob(\"/kaggle/input/hubmap-organ-segmentation/train_images/*.tiff\")\nannotations = glob(\"/kaggle/input/hubmap-organ-segmentation/train_annotations/*.json\")\nlen(images)\nlen(annotations)","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:04:26.080395Z","iopub.execute_input":"2022-07-09T07:04:26.080766Z","iopub.status.idle":"2022-07-09T07:04:26.096327Z","shell.execute_reply.started":"2022-07-09T07:04:26.080736Z","shell.execute_reply":"2022-07-09T07:04:26.095176Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"../input/hubmap-organ-segmentation/train.csv\")\ndf","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:05:31.886785Z","iopub.execute_input":"2022-07-09T07:05:31.888186Z","iopub.status.idle":"2022-07-09T07:05:32.481823Z","shell.execute_reply.started":"2022-07-09T07:05:31.888132Z","shell.execute_reply":"2022-07-09T07:05:32.480437Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### EDA ","metadata":{}},{"cell_type":"markdown","source":"### Data source, Age and Gender ","metadata":{}},{"cell_type":"code","source":"plt.figure(figsize=(20,6))\nplt.subplot(1,3,1)\nplt.pie(df.groupby(\"data_source\")[\"id\"].count(), labels=df[\"data_source\"].unique())\nplt.title(\"Data source\")\nplt.subplot(1,3,2)\nplt.pie(df[\"sex\"].value_counts(), labels= df[\"sex\"].unique())\nplt.title(\"Gender\")\nplt.subplot(1,3,3)\nplt.hist(x=df[\"age\"],label=\"age\")\nplt.xlabel(\"age\")\nplt.ylabel(\"count\")\nplt.title(\"Age\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:40:03.024848Z","iopub.execute_input":"2022-07-09T07:40:03.025324Z","iopub.status.idle":"2022-07-09T07:40:03.317094Z","shell.execute_reply.started":"2022-07-09T07:40:03.025283Z","shell.execute_reply":"2022-07-09T07:40:03.315686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Image height width and pixel size","metadata":{}},{"cell_type":"code","source":"plt.figure(figsize=(20,5))\nplt.subplot(1,3,1)\nplt.hist(x=df[\"img_height\"])\nplt.xlabel(\"img_height\")\nplt.ylabel(\"count\")\nplt.title(\"img_height\")\nplt.subplot(1,3,2)\nplt.hist(x=df[\"img_width\"])\nplt.title(\"img_width\")\nplt.xlabel(\"img_width\")\nplt.ylabel(\"count\")\nplt.subplot(1,3,3)\nplt.hist(x=df[\"pixel_size\"])\nplt.title(\"pixel_size\")\nplt.xlabel(\"pixel_size\")\nplt.ylabel(\"count\")\nplt.show()\n","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:41:09.253684Z","iopub.execute_input":"2022-07-09T07:41:09.254015Z","iopub.status.idle":"2022-07-09T07:41:09.736593Z","shell.execute_reply.started":"2022-07-09T07:41:09.253990Z","shell.execute_reply":"2022-07-09T07:41:09.735074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.imshow(tifffile.imread(images[0]))","metadata":{"execution":{"iopub.status.busy":"2022-07-09T07:11:26.691936Z","iopub.execute_input":"2022-07-09T07:11:26.692264Z","iopub.status.idle":"2022-07-09T07:11:28.762833Z","shell.execute_reply.started":"2022-07-09T07:11:26.692219Z","shell.execute_reply":"2022-07-09T07:11:28.761068Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}