This repo contains training and prediction code for 6-class Lung cancer detection using pretrained resnet. The prediction model was trained with LUAD images.
- Pytorch 0.4.0
- Torchvision 0.2.0
- cv2 (3.4.1)
- Openslide 1.1.1
- sklearn
- PIL
- Change the BASE_DIR to the path of your folder after you clone the git repo
- Go to folder "training_codes", run python train_lung_john_6classes.py
- Go to folder "scripts", run bash svs_2_heatmap.sh
Build the docker image by:
docker build -t luad_detection .
(Note the dot at the end).
Create folder named "data" and subfolders below on the host machine:
- data/svs: to contains *.svs files
- data/patches: to contain output from patch extraction
- data/log: to contain log files
- data/heatmap_txt: to contain prediction output
- data/heatmap_jsons: to contain prediction output as json files
- Run the docker container as follows:
nvidia-docker run --name luad-detection -itd -v <path-to-data>:/data -e CUDA_VISIBLE_DEVICES='<cuda device id>' luad_detection svs_2_heatmap.sh
CUDA_VISIBLE_DEVICES -- set to select the GPU to use
The following example runs the cancer detection pipeline. It will process images in /home/user/data/svs and output the results to /home/user/data.
nvidia-docker run --name luad-detection -itd -v /home/user/data:/data -e CUDA_VISIBLE_DEVICES='0' luad_detection svs_2_heatmap.sh