Skip to content

R1ck29/Kaggle-SIIM-ACR-Pneumothorax-Segmentation

Repository files navigation

Solution for Kaggle SIIM-ACR Pneumothorax Segmentation

ENVIRONMENT

The following dependecies should be installed:

  • Python 3.7.3
  • CUDA 10.1
  • cuddn 7.5.1
  • nvidia drivers v.430.40

DATA SETUP

To get iamge data, run a script below:

python download_images.py

Alternatively, you can download from cloud.
Instruction is here

  • To convert to png images, run a script below:
python convert_to_png.py

MODEL BUILD

  1. train models from scratch

    a) trains all models from scratch using 5 folds cross validation.

    b) expect this to run for about 17.5 hours(if epoch size is 40) on a single RTX2080Ti

  2. make prediction

    a) uses weights from the final stage models to make prediction.

    b) uses 5 different weights to create 5 csv files and ensemble them.

Commands to run each build are presented below:

1. train models, predict and ensemble

  • creates model weights in ../weights
  • creates ../output/v{version}/Unet_{encoder_name}_v{version}_fold{fold}.csv for each fold.
  • creates ../output/v{version}/ensemble/Unet_{encoder_name}_v{version}_average.csv
./stage_1.sh

2. train models

  • creates model weights in ../weights
./train.sh

3. make prediction

  • predict using weights which is generated by specified version.
  • creates ../output/v{version}/Unet_{encoder_name}_v{version}_fold{fold}.csv for each fold.
  • creates ../output/v{version}/ensemble/Unet_{encoder_name}_v{version}_average.csv
./predict.sh

TensorBoard

You can visualize your training process by:

tensorboard --logdir="{work_dir}/logs/v{version}/{fold}"

For Stage 2 prediction

  • combine stage 1 train and test set for retraining
  • place stage 2 test set
  • run script to covert dcm to png images(define the input path and output path like below)
python3 convert_to_png.py \
--test_path /home/rick/siim_data/siim-original/dicom-images-test/ \
--test_out_path /home/rick/siim_data/stage2/test_png/ \
--test_only True
  • set stage 2 train image path Argument is "train_image_path'
  • set stage 2 test set path in ./predict.py. Argument is "stage2_path".
    The path should be same as what you defined in 'convert_to_png.py'
./stage_2.sh

About

Solution for Kaggle competition : SIIM-ACR-Pneumothorax-Segmentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published