{"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":"from kaggle_secrets import UserSecretsClient\ntoken = UserSecretsClient().get_secret(\"GITHUB_TOKEN\")\n!git clone -b feat/experiment-runner https://{token}@github.com/RaffiSatamyan/synthetic-data-cv-benchmark.git\n%cd synthetic-data-cv-benchmark\n!pip install -e \".[training,viz]\" -q","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-08-30T18:56:42.405453Z","iopub.execute_input":"2026-08-30T18:56:42.405832Z","iopub.status.idle":"2026-08-30T18:56:54.014098Z","shell.execute_reply.started":"2026-08-30T18:56:42.405794Z","shell.execute_reply":"2026-08-30T18:56:54.01333Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls /kaggle/input/competitions/imagenet-object-localization-challenge/ILSVRC/Data/CLS-LOC/train | head","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T18:56:54.015769Z","iopub.execute_input":"2026-08-30T18:56:54.016465Z","iopub.status.idle":"2026-08-30T18:56:54.16921Z","shell.execute_reply.started":"2026-08-30T18:56:54.016435Z","shell.execute_reply":"2026-08-30T18:56:54.168471Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!python scripts/run.py --dataset imagenet100_kaggle --model resnet18 \\\n    --real-fraction 0.01 --epochs 2 --batch-size 128","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T18:56:54.170393Z","iopub.execute_input":"2026-08-30T18:56:54.170697Z","iopub.status.idle":"2026-08-30T19:04:33.008859Z","shell.execute_reply.started":"2026-08-30T18:56:54.170665Z","shell.execute_reply":"2026-08-30T19:04:33.008095Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import json, glob, os\nimport pandas as pd\nfrom IPython.display import Image, display\n\nrun = sorted(glob.glob('/kaggle/working/synthetic-data-cv-benchmark/outputs/*/'))[-1]\nprint(\"RUN:\", run)\nprint(\"\\n=== metrics.json ===\")\nprint(json.dumps(json.load(open(run+'metrics.json')), indent=2))\nprint(\"\\n=== history.csv (per epoch) ===\")\ndisplay(pd.read_csv(run+'history.csv'))\nprint(\"\\n=== predictions.csv (per sample) ===\")\ndisplay(pd.read_csv(run+'predictions.csv').head())\nfor f in ['training_curves.png','confusion_val.png','per_class_accuracy_val.png',\n          'confusion_test.png','per_class_accuracy_test.png']:\n    p = run+'figures/'+f\n    if os.path.exists(p): \n        print(f); display(Image(p))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T19:14:01.653725Z","iopub.execute_input":"2026-08-30T19:14:01.654185Z","iopub.status.idle":"2026-08-30T19:14:02.020675Z","shell.execute_reply.started":"2026-08-30T19:14:01.654147Z","shell.execute_reply":"2026-08-30T19:14:02.019849Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!cd /kaggle/working/imagenet100 && zip -r /kaggle/working/imagenet100_splits.zip splits class_list.txt source_manifest.csv","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T19:16:12.545491Z","iopub.execute_input":"2026-08-30T19:16:12.545801Z","iopub.status.idle":"2026-08-30T19:16:13.301509Z","shell.execute_reply.started":"2026-08-30T19:16:12.545779Z","shell.execute_reply":"2026-08-30T19:16:13.300726Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os; os.environ['IMAGENET100_ROOT']='/kaggle/input/imagenet-object-localization-challenge/ILSVRC/Data/CLS-LOC/train'\n!python scripts/run.py --dataset imagenet100 --model resnet18 --real-fraction 0.05 --batch-size 128","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T19:16:20.819015Z","iopub.execute_input":"2026-08-30T19:16:20.819483Z","iopub.status.idle":"2026-08-30T19:19:16.081897Z","shell.execute_reply.started":"2026-08-30T19:16:20.819448Z","shell.execute_reply":"2026-08-30T19:19:16.081173Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!rm -rf /kaggle/working/synthetic-data-cv-benchmark/data/imagenet100\n!df -h /kaggle/working | tail -1","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T19:24:22.015054Z","iopub.execute_input":"2026-08-30T19:24:22.015741Z","iopub.status.idle":"2026-08-30T19:24:24.389412Z","shell.execute_reply.started":"2026-08-30T19:24:22.015704Z","shell.execute_reply":"2026-08-30T19:24:24.388479Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import json, glob, os\nimport pandas as pd\nfrom IPython.display import Image, display\n\nrun = sorted(glob.glob('/kaggle/working/synthetic-data-cv-benchmark/outputs/*/'))[-1]\nprint(\"RUN:\", run)\nprint(json.dumps(json.load(open(run+'metrics.json')), indent=2))\ndisplay(pd.read_csv(run+'history.csv'))\ndisplay(pd.read_csv(run+'predictions.csv').head())\nfor f in ['training_curves.png','confusion_val.png','per_class_accuracy_val.png']:\n    p = run+'figures/'+f\n    if os.path.exists(p): print(f); display(Image(p))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-30T19:24:27.464583Z","iopub.execute_input":"2026-08-30T19:24:27.464891Z","iopub.status.idle":"2026-08-30T19:24:27.556016Z","shell.execute_reply.started":"2026-08-30T19:24:27.464858Z","shell.execute_reply":"2026-08-30T19:24:27.555148Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}