cadc-models / README.md
kasatoko's picture
Upload CADC ten-model inference ensemble
b63998b verified
|
Raw History Blame Contribute Delete
3.53 kB
---
language: en
library_name: pytorch
tags:
- medical-imaging
- computed-tomography
- lung-nodules
- research
- ensemble
---
# CADC lung nodule classifiers
Ten trained classifiers: five folds of a 3D ResNet and five folds of a
2.5D multi-view ResNet18. Inference averages all ten sigmoid scores.
Source project: https://github.com/Dhir-learner/CAD-C
Interactive website: https://huggingface.co/spaces/kasatoko/cadc
This repository hosts downloadable model weights and inference code. Online
inference is provided by the separate website Space; uploading weights here
does not provision a dedicated inference endpoint.
**Research only. Not clinically validated and not a medical device.**
These models predict radiologists' suspicion ratings, not confirmed cancer.
Scores are not calibrated probabilities of cancer and must not guide care.
## Inputs and outputs
Input: one nodule-centred `(64, 64, 64)` NumPy array in Hounsfield units,
indexed `(z, y, x)`, resampled to 1 mm isotropic spacing. Inference clips to
[-1000, 400] HU, takes a central 48-voxel cube, and scales intensities to [0, 1].
Use the source project's `cadc.preprocess.extract_patch` to prepare a patch
from a CT volume. This model repository does not locate nodules in a scan.
Output: ensemble suspicion score and ten individual model scores.
## Run locally
Download this repository with `hf download kasatoko/cadc-models --local-dir cadc-models`,
then run from the downloaded directory:
```python
import numpy as np
from inference import load_ensemble, predict_patch
models, names = load_ensemble(".", device="cpu")
patch = np.load("nodule.npy", allow_pickle=False)
score, votes = predict_patch(models, patch)
print({"suspicion_score": score, "model_votes": dict(zip(names, votes))})
```
Install `requirements.txt` first. Use `device="cuda"` in both calls for GPU
inference on a compatible PyTorch installation.
## Training and evaluation
Training used LIDC-IDRI radiologist ratings: mean rating <=2.5 was labelled
benign and >=3.5 malignant; ambiguous cases were excluded. Five folds were
split by patient. Only final-epoch checkpoints are included.
The source project's out-of-fold evaluation reports nodule AUC 0.936
(95% CI 0.921-0.949) on 1,627 nodules from 724 patients. This evaluation uses
only the fold models that did not train on each patient, rather than the full
ten-model inference ensemble on those training patients.
On 118 patients with recorded confirmed diagnoses, AUC was 0.680
(95% CI 0.547-0.796), versus 0.765 for radiologists. This is a subset of LIDC,
not independent external validation. Results on training scans are optimistic.
Aggregate evaluation files are included under `runs/`.
## Contents and provenance
- `runs/baseline/fold*/final.pt`: 3D ResNet weights.
- `runs/multiview/fold*/final.pt`: multi-view classifier weights.
- `cadc/model.py`: architecture definitions from the source project.
- `inference.py`: loader and single-patch inference.
- `manifest.json`: file sizes and SHA-256 hashes.
Training scans, patient-level predictions, optimizer states, API keys and
the separately distributed MONAI detector are not included.
LIDC-IDRI is provided by The Cancer Imaging Archive under CC BY 3.0, as
documented by the source project. Cite Armato SG III et al., Medical Physics
38(2):915-931, 2011. The multi-view backbone was initialized with torchvision
ImageNet ResNet18 weights. The source project does not currently declare a
code/weights license; no new license is assigned by this export.