{"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":99552,"databundleVersionId":13694723,"isSourceIdPinned":false,"sourceType":"competition"}],"dockerImageVersionId":31089,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# ===========================\n# RSNA 2025 Brain Aneurysm\n# 零模型 Baseline – 无警告、无报错\n# ===========================\n\nimport os\nimport shutil\nfrom collections import defaultdict\nimport polars as pl\nimport pydicom\nimport kaggle_evaluation.rsna_inference_server\n\n# 清空本地测试共享目录（关键修复）\nshutil.rmtree('/kaggle/shared', ignore_errors=True)\nos.makedirs('/kaggle/shared', exist_ok=True)\n\n# 比赛要求的 14 个标签（顺序固定）\nLABEL_COLS = [\n    'Left Infraclinoid Internal Carotid Artery',\n    'Right Infraclinoid Internal Carotid Artery',\n    'Left Supraclinoid Internal Carotid Artery',\n    'Right Supraclinoid Internal Carotid Artery',\n    'Left Middle Cerebral Artery',\n    'Right Middle Cerebral Artery',\n    'Anterior Communicating Artery',\n    'Left Anterior Cerebral Artery',\n    'Right Anterior Cerebral Artery',\n    'Left Posterior Communicating Artery',\n    'Right Posterior Communicating Artery',\n    'Basilar Tip',\n    'Other Posterior Circulation',\n    'Aneurysm Present'\n]\n\ndef predict(series_path: str) -> pl.DataFrame:\n    \"\"\"Baseline：所有标签输出 0.5\"\"\"\n    fake_preds = [0.5] * len(LABEL_COLS)\n    return pl.DataFrame([fake_preds], schema=LABEL_COLS, orient=\"row\")\n\n# 启动官方推理服务器\ninference_server = kaggle_evaluation.rsna_inference_server.RSNAInferenceServer(predict)\n\nif os.getenv('KAGGLE_IS_COMPETITION_RERUN'):\n    inference_server.serve()\nelse:\n    inference_server.run_local_gateway()\n\n# 本地查看提交文件（可选）\nsubmission = pl.read_parquet('/kaggle/working/submission.parquet')\nprint(\"Submission preview:\")\nprint(submission)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-09-14T09:47:07.107894Z","iopub.execute_input":"2025-09-14T09:47:07.108293Z","iopub.status.idle":"2025-09-14T09:47:12.878853Z","shell.execute_reply.started":"2025-09-14T09:47:07.108262Z","shell.execute_reply":"2025-09-14T09:47:12.877937Z"}},"outputs":[],"execution_count":null}]}