Fix: DRModel attribute names match notebook checkpoint (backbone/head_cls/head_coral/dict return) — weights now load correctly; GradCAM aug_smooth=False; lesion ROI max area cap
Gokul-G1
33f9765
fix: real fundus images no longer rejected + robust model loading
Gokul-G1
9163e1b
inference.py:
- validate_fundus(): heuristics now SUFFICIENT to pass — neural validator
score is informational only and never blocks inference.
Fixes: real fundus image rejected with neural score 0.434.
- _heuristics(): thresholds relaxed for clinical letterbox/padded images
(aspect ratio 2.5, dark_frac 3%, colour: only blue-dominant rejected).
- _find_gradcam_layer(): multi-strategy target layer discovery for
EfficientNetV2-M in timm (blocks[-2][-1] → blocks[-1][-1] → Conv2d →
BatchNorm2d). Fixes: GradCAM++ silently falling back to preprocessed.
model_loader.py:
- FundusValidator: robust state dict extraction (model_state / state_dict /
model / net / raw tensor dict). Non-fatal if FV weights corrupt/missing
(heuristic-only validation used instead of crashing).
fix: correct 4 runtime errors in inference pipeline
Gokul-G1
0167383
- app.py: replace deprecated asyncio.get_event_loop() with
asyncio.get_running_loop() (required in Python 3.10+ async context)
- inference.py: fix albumentations 1.4.4 API breaks:
* A.Rotate limit=(90,90) tuple → limit=90 int (single int required)
* A.RandomResizedCrop size=(H,W) → height=H, width=W kwargs
- model_loader.py: wrap hf_hub_download in try/except TypeError
so removal of local_dir_use_symlinks in newer hub versions
does not crash the downloader