{"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\nfrom PIL import Image\nimport matplotlib.pyplot as plt\nfrom pathlib import Path\nfrom tqdm.notebook import tqdm, trange","metadata":{"execution":{"iopub.status.busy":"2023-03-15T19:10:00.614584Z","iopub.execute_input":"2023-03-15T19:10:00.615099Z","iopub.status.idle":"2023-03-15T19:10:00.746180Z","shell.execute_reply.started":"2023-03-15T19:10:00.615054Z","shell.execute_reply":"2023-03-15T19:10:00.744469Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Looking through the first train example","metadata":{}},{"cell_type":"code","source":"TRAIN_PATH = Path(\"/kaggle/input/vesuvius-challenge-ink-detection/train\")","metadata":{"execution":{"iopub.status.busy":"2023-03-15T18:59:08.270837Z","iopub.execute_input":"2023-03-15T18:59:08.271425Z","iopub.status.idle":"2023-03-15T18:59:08.278736Z","shell.execute_reply.started":"2023-03-15T18:59:08.271366Z","shell.execute_reply":"2023-03-15T18:59:08.277176Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Plotting the first layer, the Ink Mask and IR images\n\nplt.figure(figsize=(15,6))\n\nimg = Image.open(TRAIN_PATH / \"1\" / \"surface_volume\" / \"00.tif\")\nprint(f\"Surface scanned image size: ({img.size[0]}, {img.size[1]})\")\nplt.subplot(1, 3, 1)\nplt.title(\"First layer\")\nplt.imshow(img)\n\nimg_labels = Image.open(TRAIN_PATH / \"1/inklabels.png\")\nprint(f\"Ink Labels Mask image size: ({img.size[0]}, {img.size[1]})\")\nplt.subplot(1, 3, 2)\nplt.imshow(img_labels)\nplt.title(\"Ink Labels Mask\")\n\nimg_ir = Image.open(TRAIN_PATH / \"1/ir.png\")\nprint(f\"IR image size: ({img.size[0]}, {img.size[1]})\")\nplt.subplot(1, 3, 3)\nplt.imshow(img_ir)\nplt.title(\"IR Image\")","metadata":{"execution":{"iopub.status.busy":"2023-03-15T19:30:46.376487Z","iopub.execute_input":"2023-03-15T19:30:46.377023Z","iopub.status.idle":"2023-03-15T19:31:01.593999Z","shell.execute_reply.started":"2023-03-15T19:30:46.376978Z","shell.execute_reply":"2023-03-15T19:31:01.592488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Plotting every 5 images (layers):\n\nfig, axs = plt.subplots(nrows=4, ncols=3, figsize=(12,16))\n\nfor i, ax in tqdm(enumerate(axs.flat)):\n    img = Image.open(TRAIN_PATH / \"1\" / \"surface_volume\" / f\"{(i*5):02d}.tif\")\n    ax.imshow(img)\n    ax.set_title(f\"{(i*5):02d}.tif\")\n    \nfig.tight_layout()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-15T19:33:21.052947Z","iopub.execute_input":"2023-03-15T19:33:21.053458Z","iopub.status.idle":"2023-03-15T19:33:47.536532Z","shell.execute_reply.started":"2023-03-15T19:33:21.053415Z","shell.execute_reply":"2023-03-15T19:33:47.535386Z"},"trusted":true},"execution_count":null,"outputs":[]}]}