Skip to content

inqlee0704/segmentor

Repository files navigation

segmentor

Segmentor is a deep learning segmentation engine.

Install

# activate conda
conda activate
# clone the repository
git clone https://github.com/inqlee0704/segmentor.git

# Install packages
cd segmentor
python -m pip install -r requirements.txt

Inference

Predict and save segmentation results.

Requirements:

  • model file: RESULTS/lobe/ZUNet.pth
  • dicom: {subj_path}/dicom/
  • in file: ProjSubjListDCM.in (if you want to run multiple cases)
# Infer one case (lobes)
python run_inference --mask=lobes --model=ZUNet --subj_path=25 --parameter_path=RESULTS/lobes/ZUNet.pth --pp=True --multi_channel=True

# Infer one case (airway)
python run_inference --mask=airway --model=UNet --subj_path=25 --parameter_path=RESULTS/airway/UNet.pth --pp=False --multi_channel=False

# Infer a list of cases
python run_inference --in_file_path=TE_ProjSubjListDCM.in

Parameters:

  • mask: [airway, lobes, lung, vessels]
  • model: [UNet, ZUNet]
  • subj_path: Subject folder which has a dicom folder
  • parameter_path: path to the *.pth
  • pp: postprocessing [True, False]

Outputs:

  • {model}_{mask}.img.gz
  • {model}_{mask}.hdr.gz

Test

Calculate segmentation accuracy using the mask from the 'run_inference.py' and ground truth.

Requirements:

  • predicted mask: *.img.gz & *.hdr
  • label: *.img.gz & *.hdr

Train

Data Preparation

  1. Get VIDA_sheet.csv
  • Download VIDA_sheet as a .csv from either google drive or one drive.
  • save as VIDA_sheet.csv
  1. Get ProjSubjList.in
cd utils
python get_ProjSubjList.py /d/ENV18PM/VIDA_sheet_20220120.csv /d/ENV18PM/ENV18PM_ProjSubjList_20220120.in /d/ENV18PM/ImageData
  1. Convert dicom to analyze
python convert_dcm2img.py /d/ENV18PM/ENV18PM_ProjSubjList_20220120.in

Start training

python main.py
  • mask: airway, vessels, lung, lobe
  • model: UNet, ZUNet
  • debug: True, False
  • save: True, False
  • lr: learning rate
  • train_bs: train batch size
  • valid_bs: valid batch size
  • epochs: train epoch
  • n_case: number of cases to use

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages