Downloads · 30 days
0
Dianyuan/VDPA
VDPA is a machine learning model from Dianyuan. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository provides the PyTorch implementation and checkpoint for VDPA, a variance-driven dual-path attention network for CT-based prediction of KRAS mutation status in non-small cell lung cancer.
Downloads · 30 days
0
Access
Public
Updated Aug 11, 2026
Repo size
312 MB
Likes
0
Public
Click a slice to open those files.
.pth310 MB · 99%
From the Hugging Face model README
This repository provides the PyTorch implementation and checkpoint for VDPA, a variance-driven dual-path attention network for CT-based prediction of KRAS mutation status in non-small cell lung cancer.
VDPA integrates local sparse attention and learnable global aggregation through a variance-driven fusion mechanism. The released model uses three tumor-containing CT slices as input and produces a patient-level KRAS mutation probability.
Core configuration:
| Item | Setting |
|---|---|
| Input | 3 x 512 x 512 CT slices |
| Patch size | 16 |
| Embedding dimension | 768 |
| Transformer depth | 10 |
| Attention heads | 12 |
| Class token | Yes |
| Number of classes | 2 |
| Parameters | 77.6M |
src/vdpa/model.py VDPA model definition
src/vdpa/commn.py Attention and pooling modules
scripts/check_checkpoint_compatibility.py
scripts/evaluate_npy_checkpoint.py
scripts/prepare_tcia_lobe3_npy.py
scripts/plot_metrics_and_calibration.py
configs/vdpa_checkpoint_config.json
checkpoints/vdpa_institutional_best_model.pth
results/
conda create -n vdpa-kras python=3.9 -y
conda activate vdpa-kras
pip install -r requirements.txt
Install a CUDA-compatible PyTorch build if GPU inference is required.
Run the following command after downloading the repository:
python scripts/check_checkpoint_compatibility.py \
--checkpoint checkpoints/vdpa_institutional_best_model.pth
Expected output:
missing: []
unexpected: []
parameter_count: 77595168
The evaluation script expects NPY files arranged by class and patient:
data/KRAS_NPY/val/KRAS/<patient_id>/<case>.npy
data/KRAS_NPY/val/mut-KRAS/<patient_id>/<case>.npy
Each .npy file should contain one three-slice CT input in [3, H, W] format. [H, W, 3] arrays are also supported and are transposed automatically.
Class labels:
| Folder | Label |
|---|---|
KRAS | 0 |
mut-KRAS | 1 |
python scripts/evaluate_npy_checkpoint.py \
--data-root data/KRAS_NPY \
--split val \
--checkpoint checkpoints/vdpa_institutional_best_model.pth \
--out-dir results/checkpoint_eval \
--batch-size 2 \
--threshold 0.5
Outputs:
results/checkpoint_eval/image_predictions.csv
results/checkpoint_eval/patient_predictions.csv
results/checkpoint_eval/metrics.json
Patient-level probability is computed by averaging mutation probabilities across all inputs belonging to the same patient.
The repository includes a helper script for preparing three-slice NPY inputs from the public TCIA NSCLC Radiogenomics collection:
python scripts/prepare_tcia_lobe3_npy.py \
--tcia-root data/TCIA_NSCLC_Radiogenomics_KRAS \
--out-root data/TCIA_KRAS_lobe3_npy
The script reads TCIA metadata, selects CT series, extracts three axial CT slices according to the recorded tumor lobe zone, and writes NPY inputs using the same class-folder format as the evaluation script.
The model checkpoint is larger than GitHub's standard 100 MB file limit. Use Git LFS before committing the checkpoint:
git lfs install
git lfs track "*.pth"
git add .gitattributes
Institutional CT data are not included in this repository. Public TCIA data should be obtained from The Cancer Imaging Archive according to its data access policy.
@article{vdpa_kras_nsclc,
title = {Variance-Driven Dual-Path Attention for CT Prediction of KRAS Mutation Status in Non-Small Cell Lung Cancer},
author = {Fu, Guobin and colleagues},
year = {2026}
}
This code is released under the MIT License.