{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":28755,"isInternetEnabled":false,"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\n\n# Use the kagglehub client library to attach Kaggle resources like competitions, datasets, and models to your session\n# Learn more about kagglehub: https://github.com/Kaggle/kagglehub/blob/main/README.md\n\nimport kagglehub\n# kagglehub.dataset_download('<owner>/<dataset-slug>')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nprint(\"=== Working Directory Files ===\")\nprint(os.listdir('/kaggle/working'))\nif os.path.exists('/kaggle/working/ich-cloud'):\n    print(\"\\n=== Inside ich-cloud Folder ===\")\n    print(os.listdir('/kaggle/working/ich-cloud'))\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-15T04:24:32.076248Z","iopub.execute_input":"2026-08-15T04:24:32.076656Z","iopub.status.idle":"2026-08-15T04:24:32.08485Z","shell.execute_reply.started":"2026-08-15T04:24:32.076629Z","shell.execute_reply":"2026-08-15T04:24:32.08409Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nprint(os.listdir('/kaggle/working/ich-cloud'))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-15T04:26:25.490313Z","iopub.execute_input":"2026-08-15T04:26:25.490964Z","iopub.status.idle":"2026-08-15T04:26:25.501887Z","shell.execute_reply.started":"2026-08-15T04:26:25.490934Z","shell.execute_reply":"2026-08-15T04:26:25.500971Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nprint(os.listdir('.'))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-15T04:28:01.057652Z","iopub.execute_input":"2026-08-15T04:28:01.058162Z","iopub.status.idle":"2026-08-15T04:28:01.062481Z","shell.execute_reply.started":"2026-08-15T04:28:01.058132Z","shell.execute_reply":"2026-08-15T04:28:01.061826Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!git clone https://github.com/hahammad01/ich-cloud.git\n%cd ich-cloud\n!pip install -q -r requirements.txt","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T05:54:10.79047Z","iopub.execute_input":"2026-08-13T05:54:10.790719Z","iopub.status.idle":"2026-08-13T05:54:15.542251Z","shell.execute_reply.started":"2026-08-13T05:54:10.790697Z","shell.execute_reply":"2026-08-13T05:54:15.541527Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!find /kaggle/input -maxdepth 3 -name \"stage_2_train.csv\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-04T07:53:57.658629Z","iopub.execute_input":"2026-08-04T07:53:57.659397Z","iopub.status.idle":"2026-08-04T07:53:57.776549Z","shell.execute_reply.started":"2026-08-04T07:53:57.65936Z","shell.execute_reply":"2026-08-04T07:53:57.775782Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import gc \nimport torch\ngc.collect()\nif torch.cuda.is_available():\n    torch.cuda.empty_cache()\n    print(\"GPU VRAM is clear!\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:13:24.215005Z","iopub.execute_input":"2026-08-13T06:13:24.215539Z","iopub.status.idle":"2026-08-13T06:13:26.172047Z","shell.execute_reply.started":"2026-08-13T06:13:24.215501Z","shell.execute_reply":"2026-08-13T06:13:26.171405Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%cd /kaggle/working/ich-cloud\n!git pull\n!python -c \"import config as C; print('DATA_ROOT =', C.DATA_ROOT); print('labels CSV found:', C.TRAIN_CSV.exists()); print('image folder found:', C.TRAIN_DIR.exists())\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:13:59.654282Z","iopub.execute_input":"2026-08-13T06:13:59.654836Z","iopub.status.idle":"2026-08-13T06:14:00.169575Z","shell.execute_reply.started":"2026-08-13T06:13:59.654807Z","shell.execute_reply":"2026-08-13T06:14:00.16884Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%cd /kaggle/working/ich-cloud\n!git pull\n!python -c \"import config as C; print('DATA_ROOT =', C.DATA_ROOT); print('labels CSV found:', C.TRAIN_CSV.exists()); print('image folder found:', C.TRAIN_DIR.exists())\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:15:23.02355Z","iopub.execute_input":"2026-08-13T06:15:23.02445Z","iopub.status.idle":"2026-08-13T06:15:23.543064Z","shell.execute_reply.started":"2026-08-13T06:15:23.024405Z","shell.execute_reply":"2026-08-13T06:15:23.542138Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls -la \"/kaggle/input/competitions/rsna-intracranial-hemorrhage-detection/rsna-intracranial-hemorrhage-detection\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:15:29.733985Z","iopub.execute_input":"2026-08-13T06:15:29.734815Z","iopub.status.idle":"2026-08-13T06:15:29.867514Z","shell.execute_reply.started":"2026-08-13T06:15:29.734777Z","shell.execute_reply":"2026-08-13T06:15:29.866571Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!git pull\n!python -c \"import config as C; print('DATA_ROOT =', C.DATA_ROOT); print('CSV:', C.TRAIN_CSV.exists(), '| images:', C.TRAIN_DIR.exists()); print('TRAIN_DIR =', C.TRAIN_DIR)\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:15:40.151132Z","iopub.execute_input":"2026-08-13T06:15:40.151778Z","iopub.status.idle":"2026-08-13T06:15:40.640632Z","shell.execute_reply.started":"2026-08-13T06:15:40.151745Z","shell.execute_reply":"2026-08-13T06:15:40.639894Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python prepare_data.py","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:15:48.069955Z","iopub.execute_input":"2026-08-13T06:15:48.070774Z","iopub.status.idle":"2026-08-13T06:49:43.527064Z","shell.execute_reply.started":"2026-08-13T06:15:48.070736Z","shell.execute_reply":"2026-08-13T06:49:43.526053Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python train.py --model resnet50\n!python train.py --model efficientnet_b0\n!python evaluate.py --model efficientnet_b0 --threshold 0.5","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-13T06:49:55.12387Z","iopub.execute_input":"2026-08-13T06:49:55.124438Z","execution_failed":"2026-08-13T17:53:56.103Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%cd /kaggle/working\n!git -C ich-cloud pull || git clone https://github.com/hahammad01/ich-cloud.git\n%cd /kaggle/working/ich-cloud\n!pip install -q -r requirements.txt","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T04:28:19.465345Z","iopub.execute_input":"2026-08-14T04:28:19.465785Z","iopub.status.idle":"2026-08-14T04:28:25.04114Z","shell.execute_reply.started":"2026-08-14T04:28:19.465751Z","shell.execute_reply":"2026-08-14T04:28:25.040191Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import torch\nprint(torch.cuda.get_device_name(0))\nx = torch.randn(8, 3, 64, 64, device=\"cuda\")\nprint(\"gpu ok:\", float((x * 2).sum()))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T04:33:17.988936Z","iopub.execute_input":"2026-08-14T04:33:17.98986Z","iopub.status.idle":"2026-08-14T04:33:22.528678Z","shell.execute_reply.started":"2026-08-14T04:33:17.989818Z","shell.execute_reply":"2026-08-14T04:33:22.52799Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python prepare_data.py","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T04:34:06.620944Z","iopub.execute_input":"2026-08-14T04:34:06.621536Z","iopub.status.idle":"2026-08-14T05:14:42.721701Z","shell.execute_reply.started":"2026-08-14T04:34:06.621507Z","shell.execute_reply":"2026-08-14T05:14:42.720577Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python train.py --model resnet50","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:53:10.337745Z","iopub.execute_input":"2026-08-14T15:53:10.338096Z","iopub.status.idle":"2026-08-14T15:53:10.545678Z","shell.execute_reply.started":"2026-08-14T15:53:10.338062Z","shell.execute_reply":"2026-08-14T15:53:10.544802Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%cd /kaggle/working/ich-cloud\n!git pull","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:08.872272Z","iopub.execute_input":"2026-08-14T15:51:08.872504Z","iopub.status.idle":"2026-08-14T15:51:09.004286Z","shell.execute_reply.started":"2026-08-14T15:51:08.872482Z","shell.execute_reply":"2026-08-14T15:51:09.003654Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python -c \"import config as C; print('EPOCHS =', C.EPOCHS)\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:23.606937Z","iopub.execute_input":"2026-08-14T15:51:23.607354Z","iopub.status.idle":"2026-08-14T15:51:23.81294Z","shell.execute_reply.started":"2026-08-14T15:51:23.60732Z","shell.execute_reply":"2026-08-14T15:51:23.812224Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python train.py --model resnet50","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:28.440883Z","iopub.execute_input":"2026-08-14T15:51:28.441486Z","iopub.status.idle":"2026-08-14T15:51:28.644102Z","shell.execute_reply.started":"2026-08-14T15:51:28.441451Z","shell.execute_reply":"2026-08-14T15:51:28.643335Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python train.py --model efficientnet_b0","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:33.901807Z","iopub.execute_input":"2026-08-14T15:51:33.902292Z","iopub.status.idle":"2026-08-14T15:51:34.110431Z","shell.execute_reply.started":"2026-08-14T15:51:33.902256Z","shell.execute_reply":"2026-08-14T15:51:34.109712Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls /kaggle/working/ich-cloud/work","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:37.600315Z","iopub.execute_input":"2026-08-14T15:51:37.600612Z","iopub.status.idle":"2026-08-14T15:51:37.71886Z","shell.execute_reply.started":"2026-08-14T15:51:37.60058Z","shell.execute_reply":"2026-08-14T15:51:37.718119Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python -u train.py --model efficientnet_b0","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:41.459874Z","iopub.execute_input":"2026-08-14T15:51:41.460143Z","iopub.status.idle":"2026-08-14T15:51:41.668394Z","shell.execute_reply.started":"2026-08-14T15:51:41.460116Z","shell.execute_reply":"2026-08-14T15:51:41.66761Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python evaluate.py --model efficientnet_b0 --threshold 0.5","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:47.780233Z","iopub.execute_input":"2026-08-14T15:51:47.781102Z","iopub.status.idle":"2026-08-14T15:51:47.986854Z","shell.execute_reply.started":"2026-08-14T15:51:47.781064Z","shell.execute_reply":"2026-08-14T15:51:47.986111Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!git pull\n!python evaluate.py --model efficientnet_b0 --threshold 0.5","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:52.465735Z","iopub.execute_input":"2026-08-14T15:51:52.466626Z","iopub.status.idle":"2026-08-14T15:51:52.781647Z","shell.execute_reply.started":"2026-08-14T15:51:52.466566Z","shell.execute_reply":"2026-08-14T15:51:52.780746Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!git pull","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:51:57.464109Z","iopub.execute_input":"2026-08-14T15:51:57.46472Z","iopub.status.idle":"2026-08-14T15:51:57.581289Z","shell.execute_reply.started":"2026-08-14T15:51:57.464684Z","shell.execute_reply":"2026-08-14T15:51:57.580488Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python evaluate.py --model resnet50 --threshold 0.5","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:52:01.926785Z","iopub.execute_input":"2026-08-14T15:52:01.927068Z","iopub.status.idle":"2026-08-14T15:52:02.133154Z","shell.execute_reply.started":"2026-08-14T15:52:01.927036Z","shell.execute_reply":"2026-08-14T15:52:02.132203Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python evaluate.py --model efficientnet_b0 --threshold 0.5","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T15:52:14.818287Z","iopub.execute_input":"2026-08-14T15:52:14.819086Z","iopub.status.idle":"2026-08-14T15:52:15.027302Z","shell.execute_reply.started":"2026-08-14T15:52:14.819048Z","shell.execute_reply":"2026-08-14T15:52:15.026614Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}