{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":129649,"databundleVersionId":15582313,"sourceType":"competition"}],"dockerImageVersionId":31259,"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,"execution":{"iopub.status.busy":"2026-02-05T13:40:33.671046Z","iopub.execute_input":"2026-02-05T13:40:33.671489Z","iopub.status.idle":"2026-02-05T13:40:57.991732Z","shell.execute_reply.started":"2026-02-05T13:40:33.671452Z","shell.execute_reply":"2026-02-05T13:40:57.990683Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nimport zipfile\nimport csv\nfrom pathlib import Path\nfrom PIL import Image\nimport numpy as np\n\ndef create_fixed_submission(output_zip_name=\"submission.zip\"):\n    # 1. Config: Define scenes and cameras (Match these to the dataset!)\n    scenes = [\"bball\", \"sport\"]   # Replace with actual scene names from dataset\n    num_frames = 5                # Replace with actual frame count\n    cameras = [\"cam00\", \"cam01\"]  # Replace with actual test cameras\n    \n    csv_rows = []\n    \n    print(f\"📦 Creating {output_zip_name} with correct 'id' header...\")\n    \n    with zipfile.ZipFile(output_zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf:\n        # --- A. Generate/Add Images ---\n        for scene in scenes:\n            for frame_idx in range(num_frames):\n                frame_folder = f\"frame{frame_idx:06d}\"\n                \n                for cam in cameras:\n                    # 1. Define the internal path: <scene>/<frame>/<cam>.png\n                    archive_path = f\"{scene}/{frame_folder}/{cam}.png\"\n                    \n                    # 2. Add to CSV list. \n                    # IMPORTANT: The ID is usually the file path.\n                    csv_rows.append([archive_path])\n                    \n                    # 3. Create Dummy Image (Replace with your real image loading)\n                    # For real submission: img = Image.open(real_path)\n                    img = Image.fromarray(np.zeros((100, 100, 3), dtype=np.uint8))\n                    \n                    # 4. Save to temp and write to zip\n                    temp_filename = \"temp_render.png\"\n                    img.save(temp_filename)\n                    zipf.write(temp_filename, arcname=archive_path)\n\n        # --- B. Create submission.csv ---\n        csv_filename = \"submission.csv\"\n        with open(csv_filename, 'w', newline='') as f:\n            writer = csv.writer(f)\n            \n            # --- THE FIX IS HERE ---\n            # The platform explicitly requested the column 'id'\n            writer.writerow(['id']) \n            writer.writerows(csv_rows)\n            \n        # --- C. Add CSV to the Zip Root ---\n        zipf.write(csv_filename, arcname=\"submission.csv\")\n        print(f\"  Added: submission.csv (containing {len(csv_rows)} rows)\")\n\n    # Cleanup temp files\n    if os.path.exists(\"temp_render.png\"): os.remove(\"temp_render.png\")\n    if os.path.exists(\"submission.csv\"): os.remove(\"submission.csv\")\n        \n    print(f\"\\n✅ Version 2 Fixed submission created: {output_zip_name}\")\n\nif __name__ == \"__main__\":\n    create_fixed_submission()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-02-05T13:41:05.047695Z","iopub.execute_input":"2026-02-05T13:41:05.048041Z","iopub.status.idle":"2026-02-05T13:41:05.136381Z","shell.execute_reply.started":"2026-02-05T13:41:05.048011Z","shell.execute_reply":"2026-02-05T13:41:05.135071Z"}},"outputs":[],"execution_count":null}]}