mbickel / DenseInferenceWrapper

A python wrapper for Krähenbühls dense CRF for medical image volumes.
89 stars 37 forks source link

Dense Inference Wrapper

Overview

An add-on to Krähenbühls DenseCRF for 3d grayscale image volumes and a corresponding python wrapper to handle numpy ndarrays.

It was designed and tested to sharpen soft-labeled classifier outputs for medical 3d image data, such as CT-volumes.

The wrapper makes it very easy to run Krähenbühls super fast DenseCRF on your classifier output (i.e. the output of your fully convolutional neural network) just by a single python method call.

DenseCRF denseinference/lib

The CRF-code is modified from the publicly available code by Philipp Krähenbühl and Vladlen Koltun. See their project website for more information.

If you also use this code, please cite their paper: Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials, Philipp Krähenbühl and Vladlen Koltun, NIPS 2011.

The modification is also inspired by DeepLab and its application of DenseCRF. See their project website for more information.

Setup

Requirements

make, g++, boost-python

Requirements Python

numpy, psutil

Requirements Python Testing

matplotlib

Installation

cd denseinferencewrapper
make all
sudo pip install .

Usage

from denseinference import CRFProcessor

# init wrapper object
# all crf options can be set here (optional)
pro = CRFProcessor.CRF3DProcessor()
# Now run crf and get hard labeled result tensor:
result = pro.set_data_and_run(img, feature_tensor)