Git Product home page Git Product logo

bnpseg's Introduction

Bayesian Non-Parametric Image Segmentation

This project implements a Gibbs Sampler for performing pixel-wise classification (image-segmentation) of vector-valued voxel representations in a joint Hierarchical Dirichlet Process-Markov Random Field bayesian non-parametric model.

The model was developed for learned intra-tumor segmentation. The model places each voxel across a population of patients' images into one of a variable number of classes. Utilization of the HDP guarantees correspondence of a class definition for all patients, allowing the algorithm to select the appropriate number of distinct voxel representations based on population information.

The MRF constraint is placed on the class assignment to reinforce the assumption that under a revealing representation (feature vector) voxels (collections of cells) tend to compose themselves into larger clusters rather than spread them selves into small, disjoint clusters.

The algorithm draws samples from conditional distributions over the full state space vector to infer the latent class assignment parameters and implicit number of unique cell classifications.

Getting Started

Running the code for the first time is easy, just follow these steps after you have installed all of the dependencies

  1. Clone the repo:
    git clone https://github.com/ryanneph/bnp-tumorseg
  2. Enter the project directory and run on one of the sample datasets:
    python run.py --dataset=balloons
  • Check out all of the available options with:
    python run.py --help

On every iteration, the t-index and k-index mode maps are saved to ./figures/<dataset>/, and logfiles are saved to ./logs/. Presently, the full trace histories for t-index, k-index, and beta random variables are stored to file in ./blobs/<dataset> at the end of the sampling stage.

Resuming a Previous Sampling Run

Basic support for resuming a sampling session from a previously terminated session is available by specifying the cli argument: --resume-from=<blob.pickle> using one of the recorded data "checkpoints" which are written to ./blobs/<dataset> a the end of each session (whether maxiter is reached or the user terminates early with <ctrl-c>) Currently, by resuming a sampling session, one can modify the concentration parameter values, the MRF constraint weights, and the burnin period. The data used for the resuming session will be identical to that used in the checkpoint blob. (no new data added to the dataset directory will be registered at this time).

Dependencies

  • NumPy
  • SciPy
  • matplotlib
  • pymedimage (install using pip install --upgrade git+git://github.com/ryanneph/pymedimage.git)
  • choldate
  • pushbullet.py [optional] - for getting success/failure notifications on your mobile devices (see notifications below for more details - coming soon)

bnpseg's People

Contributors

ryanneph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bnpseg's Issues

Split-Merge on Class Labels

Following http://arxiv.org/abs/1201.1657 we should implement the HDP split-merge algorithm on the corpus-level (class; k) labels due to its potential to speed up mixing of the Gibb's sampler. The authors claim that "Split- merge algorithms can consider larger moves in the state space and have the potential to converge more quickly."

Initialization via Sequential Prediction

Instead of random initialization used currently, use "Sequential Prediction" as described in Sec 5.1 of https://cs.stanford.edu/~pliang/papers/permutation-dp-icml2007.pdf:

sequential prediction: a clustering is sampled according to the CRP but weighting the probability of choosing a cluster by the predictive likelihood of the new point given the existing points in the cluster.

which can be seen as a sort of 0th iteration with incrementally growing class/group membership as each data point is introduced to the sampler. wang notes that "this works well empirically"

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.