{"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":33843,"databundleVersionId":3444800,"sourceType":"competition"},{"sourceId":12633506,"sourceType":"datasetVersion","datasetId":7982952}],"dockerImageVersionId":31089,"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\n\nimport os\nfor 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},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from fastai.vision.all import *\nimport pandas as pd\nfrom pathlib import Path\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-31T16:15:03.891471Z","iopub.execute_input":"2025-07-31T16:15:03.891791Z","iopub.status.idle":"2025-07-31T16:15:03.896562Z","shell.execute_reply.started":"2025-07-31T16:15:03.89173Z","shell.execute_reply":"2025-07-31T16:15:03.895631Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"learn = load_learner('/kaggle/input/baseline-model-pkl/baseline_model.pkl')\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-31T16:15:06.355464Z","iopub.execute_input":"2025-07-31T16:15:06.355801Z","iopub.status.idle":"2025-07-31T16:15:06.441509Z","shell.execute_reply.started":"2025-07-31T16:15:06.355775Z","shell.execute_reply":"2025-07-31T16:15:06.440297Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"test_path = Path('/kaggle/input/iwildcam2022-test/test')  # <-- Change if needed\ntest_images = get_image_files(test_path, recurse=True)\n\nprint(f\"Found {len(test_images)} test images.\")\nprint(test_images[:5])\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-31T16:15:57.28929Z","iopub.execute_input":"2025-07-31T16:15:57.289571Z","iopub.status.idle":"2025-07-31T16:15:57.295016Z","shell.execute_reply.started":"2025-07-31T16:15:57.289552Z","shell.execute_reply":"2025-07-31T16:15:57.2942Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"test_dl = learn.dls.test_dl(test_images)\npreds, _ = learn.get_preds(dl=test_dl)\nlabels = preds.argmax(dim=1)\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-31T16:16:10.796462Z","iopub.execute_input":"2025-07-31T16:16:10.796781Z","iopub.status.idle":"2025-07-31T16:16:10.82393Z","shell.execute_reply.started":"2025-07-31T16:16:10.796723Z","shell.execute_reply":"2025-07-31T16:16:10.822645Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission = pd.DataFrame({\n    'Id': [img.stem for img in test_images],\n    'Category': labels\n})\nsubmission.to_csv('submission.csv', index=False)\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission.head()\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## 📊 Reflection\n\nThe model was evaluated on the test set and submitted to the leaderboard.  \nValidation metric not computed in this notebook.  \nPublic leaderboard score: **[Insert score here]**\n","metadata":{}}]}