Skip to content

giurdeluca/Sybil

 
 

Repository files navigation

Personal documentation

Check README_original for further documentation and citation!

Install

git clone https://github.com/giurdeluca/Sybil.git
cd Sybil/
conda create -n <env_name> python=<python_version>
conda activate <env_name>
pip install -e .

for my old computational environment (CUDA 11.3, python 3.8)

pip install torch==1.10.1+cu113 torchvision==0.11.2+cu113 -f https://download.pytorch.org/whl/torch_stable.html

or, on newer environment (CUDA 12.4, python 3.10) to be compliant with latest author requirements

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117

Run first inference on demo data (with attention maps)

#!/bin/bash

# Run inference on the demo data
# The output will be printed to the console


demo_scan_dir=sybil_demo_data

# Download the demo data if it doesn't exist
if [ ! -d "$demo_scan_dir" ]; then
  # Download example data
  curl -L -o sybil_example.zip "https://www.dropbox.com/scl/fi/covbvo6f547kak4em3cjd/sybil_example.zip?rlkey=7a13nhlc9uwga9x7pmtk1cf1c&dl=1"
  unzip -q sybil_example.zip
fi

# If not installed with pip, sybil-predict will not be available.
# Can use "python3 sybil/predict.py" instead.
sybil-predict \
--loglevel DEBUG \
--output-dir demo_prediction \
--write-attention-images \
--return-attentions \
--save-individually \
--save-gif \
$demo_scan_dir

Run inference on a list of DICOM paths

python sybil/sybil_DICOM.py \
--model ensemble \
--input-list /path/to/list/of/DICOM/paths.txt
--output-dir /path/to/output/directory
--save-maps
Argument Default Description
--model ensemble Pretrained model to load (ensemble, that averages 5 folds, or base))
--input-list - Path to text file containing input CT image paths (DICOM)
--output-dir ./derived/pipeline/ Directory to save output files
--save-maps False If added, saves pngs with attention maps

How to plot annotation box and seeds

  1. Download the JSON file here

  2. Run convert_annotation_json_to_csv.py

python utils/convert_annotation_json_to_csv.py <path_to_annotation.json> <path_to_annotations.csv>
  1. Run extract_annotation_seed.py for calculation of bounding box center and visualization
python utils/extract_annotation_seed.py <dicom_root_folder> <path_to_annotations.csv> <output_folder>

About

Deep Learning for Lung Cancer Risk Prediction using LDCT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.4%
  • Other 0.6%