Git Product home page Git Product logo

3dunetcnn's Introduction

3D U-Net Convolution Neural Network with Keras

Background

Designed after this paper on volumetric segmentation with a 3D U-Net. Currently, the network does not have the B-Spline deformations that are mentioned in the paper. If you figure out a way to apply these to a 3D Keras CNN, let me know! PRs are always welcome!

The code was written to be trained using the BRATS data set for brain tumors, but it can be easily modified to be used in other 3D applications. To adapt the network, you might have to play with the input size to get something that works for your data.

I used Bohdan Pavlyshenko's Kaggle kernel for 2D U-Net segmentation as a base for this 3D U-Net.

How to Train Using BRATS Data

  1. Download the BRATS 2015 data set.
  2. Install dependencies: nibabel, keras, pytables, nilearn
  3. Install ANTs N4BiasFieldCorrection and add the location of the ANTs binaries to the PATH environmental variable.
  4. Convert the data to nifti format and perform image wise normalization and correction:
$ cd brats

Import the conversion function:

>>> from preprocess import convert_brats_data

Import the configuration dictionary:

>>> from config import config
>>> convert_brats_data("/path/to/BRATS/BRATS2015_Training",  config["data_dir"])

Where config["data_dir"] is the location where the raw BRATS data will be converted to.

  1. Run the training:
$ cd ..
$ export PYTHONPATH=${PWD}:$PYTHONPATH
$ python brats/train.py

Configuration

In training I have found that this network requires a large amount of memory! For an image shape of 144x144x144 the memory required when training using cpu is around 32GB. This can be reduced by reducing the image shape in the configuration file. The code will then reduce the resolution of the input images so that they all match the given shape.

3dunetcnn's People

Contributors

ellisdg avatar

Watchers

 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.