{"cells":[{"cell_type":"markdown","metadata":{},"source":"# RSNA R100 hybrid — mounted-data smoke\n\nPre-registered in `CAMPAIGN.md` (2026-09-08). This touches every mount/import/DICOM path before the full inference run; it does not deserialize third-party checkpoints or submit."},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":"import json\nfrom pathlib import Path\nimport cv2\nimport numpy as np\nimport pandas as pd\nimport pydicom\nimport timm\nimport torch\nassert torch.cuda.is_available(), 'CUDA unavailable'\nassert torch.cuda.device_count() >= 1, 'no CUDA device'\ndevices = [torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())]\nprint('CUDA devices:', devices, flush=True)\nROOT = Path('/kaggle/input')\nCOMP = ROOT / 'rsna-knee-abnormality-detection'\nif not COMP.exists(): COMP = ROOT / 'competitions' / 'rsna-knee-abnormality-detection'\nassert (COMP / 'test.csv').is_file(), f'missing test.csv under {COMP}'\nassert (COMP / 'test_series.csv').is_file(), f'missing test_series.csv under {COMP}'\nseries_root = COMP / 'test_series'\nif not series_root.is_dir(): series_root = COMP / 'test_images'\nassert series_root.is_dir(), f'missing DICOM tree under {COMP}'\nmounts = {'raptor-knee-maxspan':'dreaddevelopment','raptor-knee-native384':'dreaddevelopment','raptor-knee-native384dense':'dreaddevelopment','knee-mri-fold-weights':'mattiaangeli','opencv-python-headless-4120088-x86':'mattiaangeli','resnet-50-radimagenet-marwan':'marwanmath','rsna-knee-coat-resgated-ep10-top3':'mattiaangeli','rsna-knee-e11-diverse-heads-v20':'antoinegg1','rsna-knee-e9-radimagenet-heads-v15':'antoinegg1','rsna-knee-llm-labels':'pilkwang','rsna-knee-v52-radimagenet-heads-20260812':'prvsiyan','rsna-knee-weights':'pilkwang'}\ndef resolve_mount(slug, owner):\n    candidates = [ROOT / slug, ROOT / 'datasets' / owner / slug]\n    for path in candidates:\n        if path.is_dir(): return path\n    raise AssertionError(f'missing mount {owner}/{slug}; checked {candidates}')\nfor slug, owner in mounts.items():\n    path = resolve_mount(slug, owner)\n    names = [p.name for p in path.rglob('*') if p.is_file()]\n    assert names, f'empty mount: {owner}/{slug} at {path}'\n    print(f'mount {owner}/{slug}: {path} ({len(names)} files)', flush=True)\ntest = pd.read_csv(COMP / 'test.csv').head(3).copy()\nids = test['StudyInstanceUID'].astype(str).tolist()\nassert len(ids) == 3 and len(set(ids)) == 3\ndcm = next(series_root.rglob('*.dcm'), None)\nassert dcm is not None, 'no DICOM file found'\nheader = pydicom.dcmread(dcm, stop_before_pixels=True)\npixel = pydicom.dcmread(dcm).pixel_array\nassert pixel.size > 0\ntargets = [c for c in pd.read_csv(COMP / 'sample_submission.csv', nrows=1).columns if c != 'StudyInstanceUID']\nassert len(targets) == 12\nsubmission = pd.DataFrame(0.5, index=range(3), columns=targets)\nsubmission.insert(0, 'StudyInstanceUID', ids)\nassert submission.shape == (3, 13) and np.isfinite(submission[targets].to_numpy()).all()\nsubmission.to_csv('/kaggle/working/submission.csv', index=False)\nreceipt = {'status':'SMOKE_OK','devices':devices,'studies':ids,'dicom':str(dcm),'pixel_shape':list(pixel.shape),'cv2':cv2.__version__,'timm':timm.__version__}\nPath('/kaggle/working/smoke_receipt.json').write_text(json.dumps(receipt, indent=2) + '\\n')\nprint('SMOKE_OK', json.dumps(receipt, sort_keys=True), flush=True)\n"}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python"},"kaggle":{"accelerator":"nvidiaTeslaT4","isGpuEnabled":true,"isInternetEnabled":false,"language":"python","sourceType":"notebook"}},"nbformat":4,"nbformat_minor":5}