{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":112509,"databundleVersionId":14254895,"sourceType":"competition"}],"dockerImageVersionId":31153,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"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\nfrom PIL import Image\nimport os\nimport glob\nimport matplotlib.pyplot as plt\nfrom IPython.display import display\n\n# for dirname, _, filenames in os.walk('/kaggle/input'):\n#     for filename in filenames:\n#         print(os.path.join(dirname, filename))\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","trusted":true,"execution":{"iopub.status.busy":"2025-11-17T17:19:00.782669Z","iopub.execute_input":"2025-11-17T17:19:00.782958Z","iopub.status.idle":"2025-11-17T17:19:00.788473Z","shell.execute_reply.started":"2025-11-17T17:19:00.782936Z","shell.execute_reply":"2025-11-17T17:19:00.787422Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def get_id(path):\n    return os.path.splitext(os.path.basename(path))[0]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-17T17:19:03.088474Z","iopub.execute_input":"2025-11-17T17:19:03.088784Z","iopub.status.idle":"2025-11-17T17:19:03.093967Z","shell.execute_reply.started":"2025-11-17T17:19:03.088762Z","shell.execute_reply":"2025-11-17T17:19:03.092930Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"base_directory = \"/kaggle/input/csiro-biomass\"\ntrain_csv = pd.read_csv(\n    os.path.join(base_directory , \"train.csv\")\n)\ntrain_imgs_path = glob.glob(\\\n    os.path.join(base_directory , \"train\" , \"*\")\n)\nmax_imgs_to_show = 2\nfor i in range(max_imgs_to_show):\n    path = train_imgs_path[i]\n    id_ = get_id(path)\n    img_info = train_csv[train_csv[\"sample_id\"].str.split(\"_\" , expand=True)[0]==id_][[\"target_name\" , \"target\"]].copy()\n    img = Image.open(path).convert(\"RGB\")\n\n    \n    fig , ax = plt.subplots(1 , 2 , figsize = (12 , 6))\n\n    ax[0].imshow(img)\n    ax[0].set_title(f\"{img.size}\")\n    table = ax[1].table(cellText=img_info.values,\n                     colLabels=img_info.columns,\n                     cellLoc='center',\n                     loc='center')\n    \n    # Styling\n    table.auto_set_font_size(False)\n    table.set_fontsize(10)\n    table.scale(1.2, 1.2)  # (width, height) scaling\n    \n    plt.title(\"DataFrame (First 5 Rows)\", fontsize=12, pad=10)\n    plt.tight_layout()\n    plt.show()\n\n#Dry_GDM = Dry Green + Dry Clover","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-17T17:19:04.328463Z","iopub.execute_input":"2025-11-17T17:19:04.328764Z","iopub.status.idle":"2025-11-17T17:19:22.109339Z","shell.execute_reply.started":"2025-11-17T17:19:04.328741Z","shell.execute_reply":"2025-11-17T17:19:22.107704Z"}},"outputs":[],"execution_count":null}]}