Add analysis scripts and experiment configurations for bridge attention and sensitivity studies

- Introduced `bridge_attention_ceiling_check.py` for variance decomposition analysis on bridge attention configurations.
- Added `bridge_attention_readout.py` to perform per-tower gate and contribution readouts, including AUC sanity checks.
- Created multiple JSON configuration files for backbone replication experiments, including anonymous CV variants and basic backbones.
- Implemented sensitivity experiments to evaluate the impact of axial length inclusion and EfficientNetV2-M performance at higher resolutions.
- Added a memory probe script to assess GPU memory usage during training with EfficientNetV2-M.
This commit is contained in:
rpotter6298
2026-07-03 08:51:44 +02:00
parent 3d954a4606
commit 708fbc70ce
52 changed files with 2223 additions and 218 deletions
@@ -0,0 +1,10 @@
[
{
"_note": "F2 block 2 — Anonymous CV variant of the refugelike R50 image-only single-eye baseline. split_identity_level=0 disables patient-level fold grouping (v4_hypertower.py:254-256); fold assignment becomes patient-anonymous, allowing the two eyes of one patient to fall on opposite sides of the train/test split. Mirrors v3 phase 2 imageonly_resnet50_leaky. Same backbone, same architecture, same seed/fold_seed as the F2 block-3 baseline (refugelike img-only single-eye); only the grouping rule changes. The gap baseline→anonymous quantifies the patient-anonymous CV inflation.",
"run_name": "experiments/backbone_replication/anonymous_cv_refugelike",
"reps": 10,
"overrides": {
"split_identity_level": 0
}
}
]
@@ -0,0 +1,10 @@
[
{
"_note": "Anonymous CV variant of the single-eye img+cd L1 fusion configuration at the refugelike R50 backbone (the 'classic hypertower' eye-level fusion mode without L2 bilateral aggregation). split_identity_level=0 disables patient-level fold grouping; fold assignment becomes patient-anonymous, allowing the two eyes of one patient to fall on opposite sides of the train/test split. Mirrors the image-only anonymous_cv_refugelike run (F2 block 2) but with the clinical tower fused in at the L1 stage, so the patient-anonymous CV inflation can be quantified directly against the single-eye img+cd headline number (ensemble_single_refugelike rep-mean test AUC 0.874 at split_identity_level=1). Same backbone, towers, bridge, training schedule, and seeds as the single-eye headline; only the fold-grouping rule changes. Bilateral L2 is not included because patient-level aggregation is mechanically incompatible with patient-anonymous fold assignment.",
"run_name": "experiments/backbone_replication/anonymous_cv_ensemble_single_refugelike",
"reps": 10,
"overrides": {
"split_identity_level": 0
}
}
]
@@ -0,0 +1,46 @@
[
{
"_note": "F2 block 1 — basic backbones, ImageNet pretrained, image-only, single-eye, patient-grouped 5-fold CV. VGG16. Replicates v3 phase 1 imageonly_vgg16 in the v4 pipeline.",
"run_name": "experiments/backbone_replication/basic_vgg16",
"reps": 10,
"tower_overrides": {
"img": { "args": { "backbone": "vgg16", "freeze_ratio": 0.0 } }
}
},
{
"_note": "F2 block 1 — MobileNetV2 (ImageNet, img-only, single-eye).",
"run_name": "experiments/backbone_replication/basic_mobilenet_v2",
"reps": 10,
"tower_overrides": {
"img": { "args": { "backbone": "mobilenet_v2", "freeze_ratio": 0.0 } }
}
},
{
"_note": "F2 block 1 — DenseNet121 (ImageNet, img-only, single-eye).",
"run_name": "experiments/backbone_replication/basic_densenet121",
"reps": 10,
"tower_overrides": {
"img": { "args": { "backbone": "densenet121", "freeze_ratio": 0.0 } }
}
},
{
"_note": "F2 block 1 — InceptionV3 (ImageNet, img-only, single-eye). NB: Inception expects 299x299 input — backbone_transform_config auto-overrides crop_size to 299 for inception_v3.",
"run_name": "experiments/backbone_replication/basic_inception_v3",
"reps": 10,
"tower_overrides": {
"img": { "args": { "backbone": "inception_v3", "freeze_ratio": 0.0 } }
}
},
{
"_note": "F2 block 1 — ResNet50 ImageNet-pretrained (the unfrozen ImageNet R50, not refugelike). Anchor for the basic-backbone comparison.",
"run_name": "experiments/backbone_replication/basic_resnet50",
"reps": 10,
"tower_overrides": {
"img": { "args": { "backbone": "resnet50", "freeze_ratio": 0.0 } }
}
}
]
@@ -0,0 +1,39 @@
[
{
"_note": "F2 block 2 — GT disc-contour crop. R50 refugelike, image-only, single-eye, patient-grouped 5-fold CV. Each input image is cropped to a square bbox centred on the GT disc contour with margin=2.5 (matching v3 phase 2 imageonly_resnet50_gtcrop_2.5). The crop happens in original image coords before the standard 256-resize + 224-center-crop transform pipeline runs. Eyes with no contour file fall back to the un-cropped full image.",
"run_name": "experiments/backbone_replication/gtcrop_refugelike",
"reps": 10,
"tower_overrides": {
"img": {
"args": {
"backbone": "refugelike",
"freeze_ratio": 0.0,
"crop_source": "gt",
"crop_kwargs": { "margin": 2.5, "expert": 1 }
}
}
}
},
{
"_note": "F2 block 2 — U-Net disc-mask crop. R50 refugelike, image-only, single-eye, patient-grouped 5-fold CV. Each input image is cropped to a square bbox centred on the U-Net-predicted disc mask with margin=2.5 (matching v3 phase 2 imageonly_resnet50_unetcrop_2.5). U-Net is loaded from the base REFUGE checkpoint and NOT fine-tuned per fold (finetune_epochs=0) to keep this an apples-to-apples preprocessing-only ablation. Eyes where U-Net predicts no disc fall back to the un-cropped full image.",
"run_name": "experiments/backbone_replication/unetcrop_refugelike",
"reps": 10,
"tower_overrides": {
"img": {
"args": {
"backbone": "refugelike",
"freeze_ratio": 0.0,
"crop_source": "unet",
"crop_kwargs": {
"margin": 2.5,
"weights_path": "models/v2/refuge/segmentation/per_image/best.pt",
"unet_size": 512,
"threshold": 0.5,
"finetune_epochs": 0
}
}
}
}
}
]