PMDG: Prototype-Guided Multiscale Dual-View Graph Reasoning for Weakly Supervised Breast Lesion Recognition
PMDG is a breast-level weakly supervised framework for paired-view mammography classification and lesion localization. A sample is one breast with its available ipsilateral CC and MLO views. The network predicts two independent targets—mass and suspicious calcification—and reconstructs class-specific full-resolution response maps without using lesion boxes during training.
The implementation follows one deterministic data-to-result path:
- DICOM polarity, laterality, breast foreground and P1–P99 intensity are standardized.
- Each view is represented by a variable-length bag of 512 × 512 patches; patches below 50% breast coverage are excluded.
- A frozen Mammo-CLIP EfficientNet-B2 encoder produces 352-dimensional patch features.
- Anatomical descriptors, class-conditional prototypes, a sparse dynamic graph and directional cross-view consistency refine candidate tokens.
- Top-K MIL aggregation produces breast-level mass and calcification scores.
- Overlapping candidate responses are averaged into heatmaps and converted to connected-component localization boxes for post-hoc evaluation.
The complete mapping from manuscript concepts to source files is provided in
docs/METHOD_CODE_MAP.md.
configs/ PMDG, five baselines and seven ablations
src/dagl_mil/data/ manifest, DICOM preprocessing and patch bags
src/dagl_mil/models/ PMDG, baselines and frozen Mammo-CLIP encoder
src/dagl_mil/engine/ training, checkpoints, feature encoding and inference
src/dagl_mil/evaluation/ classification, localization, bootstrap and efficiency
scripts/ data gates, cache builders and experiment wrappers
tests/ unit and protocol-level regression tests
artifacts/splits/ split counts, anomalies and public assignment snapshot
Download VinDr-Mammo 1.0.0 from PhysioNet under its own data use terms. Download the EfficientNet-B2 checkpoint from the official Mammo-CLIP project under its upstream license. Data and weights are deliberately excluded from Git.
Place or link them at the defaults below, or edit configs/dagl.yaml:
data/vindr-mammo-1.0.0/
weights/model-epoch-10.repacked.pt
The formal experiments target Python 3.10+ and a CUDA-capable NVIDIA GPU.
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[test]"On Windows PowerShell, activate with .venv\Scripts\Activate.ps1.
Build the examination-grouped seed-2026 split and deterministic preprocessing cache:
dagl-mil prepare
python scripts/precache_vindr.py --workers 8
python scripts/audit_patch_feasibility.py --workers 8
python scripts/validate_data_gates.pyRun a real-DICOM smoke test:
dagl-mil smoke --resume --skip-completedTrain, infer and evaluate PMDG:
dagl-mil train --config configs/dagl.yaml --resume --skip-completed
dagl-mil infer --config configs/dagl.yaml --skip-completed
dagl-mil evaluate --config configs/dagl.yaml --skip-completed
dagl-mil efficiency --config configs/dagl.yaml --skip-completedRun the complete comparison matrix:
dagl-mil run-all --resume --skip-completedAdditional protocol details and expected artifacts are documented in
docs/REPRODUCIBILITY.md.
python -m pytest -q
python -m ruff check src tests scriptsTests using the complete VinDr-Mammo tree are skipped when the dataset is not available. Formal training commands fail closed when their CUDA and protocol requirements are not satisfied.
The frozen image encoder contains code derived from Mammo-CLIP and
EfficientNet-PyTorch. See THIRD_PARTY_NOTICES.md and
MAMMO_CLIP_LICENSE_NOTICE.txt. The repository
does not redistribute Mammo-CLIP weights or VinDr-Mammo data.
This repository is being prepared privately. An explicit project license will be selected before public release; until then, all rights are reserved. The third-party files retain their original upstream terms.