Giter Club home page Giter Club logo

prostate_segmentation's Introduction

NCI-ISBI 2013 Challenge - Automated Segmentation of Prostate Structures (using Keras Data Augmentation)

In this work, I used deep learning methods in automated segmentation of prostate gland.

images/prostate_seg.png

The data was originally posted on Cancer Imaging Archive website in 2013 for NCI-ISBI competition. More info on this NCI-ISBI competition can be found on Cancer Imaging Archive website.

The network architecture was inspired by U-Net: Convolutional Networks for Biomedical Image Segmentation and by Keras implementation of the model by Marko Josic

This deep neural network (which I call simple U-net) achieves ~0.70 Dice coefficient (max Dice similarity coefficient is 1) on the test images (10 patients and ~300 images), and can be tuned further to achieve better results.

Overview

Data Pre-processing

Provided data is processed by dicom_to_array function. After downloading the data extract the files in the following directory structure:

-codes
 |
-data
 |
 ---- train
 |    |
 |    ---- PatientID
 |    |    |
 |    |    ---- 00001.dcm
 |    |---- PatientID.nrrd
 |    |---- ....
 ---- test
 |    |
 |    ---- PatientID
 |    |    |
 |    |    ---- 00001.dcm
 |    |---- PatientID.nrrd
 |    |---- ....
 ---- validate
 |    |
 |    ---- PatientID
 |    |    |
 |    |    ---- 00001.dcm
 |    |---- PatientID.nrrd
 |    |---- ....

The histogram of the images are equalized using skimage.exposure.equalize_hist.

All the images were resized to 96x96 (better resolution will likely provide better results)

Segmentations (masks) are provided as nrrd files. Peripheral zone (PZ) of the prostate gland is masked with some value close to 1 and the less accessible central gland (CG) is masked with values close to 2. The masks are converted to binary arrays for 1 masking whole prostate gland (not differentiating between CG and PG in this particular model).

Model

The provided model is basically modification of U-Net architecture. Original U-net has millions of weights but there only ~1000 training data available for this segmentation problem. Therefore, to avoid over-fitting, I got rid convolutional layers (both downsampling and upsampling) with 128 and 256 filters. Moreover, I have reduced number of filters in each layer. This gave me ~30k weights to be optimized.

img

Training

The training set has only ~1000 images with masks. I used Keras's ImageDataGenerator to augment data with random rotations, flips, zooms and shifts. Note that I have used the same image augmentation parameters and random seed for both images and masks. Overall, I have trained the model with fit_generator for ~150k augmented dataset. The model is trained for 30 epochs with batch size 32, where each epoch took ~3 minutes on Nvidia P100 GPUs provided by Ohio Supercomputer Center. Memory footprint of the model is ~2GB. After 30 epochs, calculated Dice coefficient is ~0.70 on test images.

Predictions

Top 3 predictions by Dice coefficient

images/best_predictions.png

Bottom 3 predictions by Dice coefficient

images/worst_predictions.png

For the worst predictions, even I am having difficulties defining the prostate boundaries.

How to use

Dependencies

This tutorial depends on the following libraries:

  • scikit-image, numpy, matplotlib
  • pydicom
  • pynrrd
  • Tensorflow
  • Keras >= 2.0

This code should also be compatible with Theano backend of Keras, but in my experience Theano is slower than TensorFlow.

Running the model

  • Run python train.py to pre-process the data and train the model. Model weights are save in file ../data/weights.h5 .

  • Run python test.py to test the model and generate some images with some best and worst predictions.

Acknowledgements

  • This material is based upon work supported by the National Science Foundation under Agreement No. 0931642

  • Mathematical Biosciences Institute at Ohio State University

prostate_segmentation's People

Contributors

imirzaevtest avatar mirzaevinom avatar

Watchers

Shubham Pachori avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.