Neuron Segmentation
This repository contains various algorithms implemented on neurons images segmentation which are completed on CSCI 8360, Data Science Practicum at the University of Georgia, Spring 2018.
This project uses the time series image datasets of neurons from CodeNeuro. Each folder of training and testing images is a single plan, and the images are numbered according to their temporal ordering. The neurons in the images will flicker on and off as calcium is added. In this repository, we are offering three main algorithms as follows using different packages to locate the neurons and segment them out from the surrounding image.
- Non-negative Matrix Factorization by thunder-extraction
- Convolutional Neural Network by Unet
- Constrained Non-negative Matrix Factorization by CaImAn
Read more details about each algorithm and their applications in our WIKI tab.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Prerequisites
Environment Setting
- Clone this repository.
$ git clone https://github.com/dsp-uga/Johnson.git
$ cd Johnson
- Create conda environment based on
environments.yml
offered in this repository.
$ conda env create -f environments.yml -n neuron python=3.6
$ source activate neuron
Note that tf_unet
works best in python 2.7, which is also the environment we used for it. (All other experiments are done in Python 3.6). So if you want to use tf_unet
, create a conda environment as follows:
$ conda env create -f environments.yml -n neuron python=2.7
$ source activate neuron
- (for Unet)
Clone the source repository by tf_unet, go into tf_unet repository, and set up
tf_unet
in the conda environment, then delete tf_unet repository.
$ git clone https://github.com/jakeret/tf_unet
$ cd tf_unet
$ python setup.py install
$ rm -rf tf_unet
- (for CNMF)
Clone the sources repository by CaImAn, go into CaImAn repository, and set up
caiman
in the conda environment, then delete CaImAn repository.
$ git clone https://github.com/flatironinstitute/CaImAn
$ cd CaImAn
$ python setup.py install
$ rm -rf CaImAn
Add sudo
before the command if you encounter the permission problems.
Running the tests
python -m [option-name] [args-for-the-option]
Options
ThunderNMF
: Running NMF bythunder-extraction
UNET
: Running CNN byunet
CNMF
: Running CNMF bycaiman
Each module provides their own arguments. Use help()
to know more details when running the algorithms.
Evaluation
Based on the neurons coordinates, five related scores to determine the results will be generated as follows:
- Recall: (number of matched regions)/(number of ground-truth regions)
- Precision: (number of matched regions)/(number of our regions)
- Inclusion: (number of intersecting pixels)/(number of total pixels in the ground-truth regions)
- Exclusion: (number of intersecting pixels)/(number of total pixels in our regions)
- Combined:
Test Results
Module | arguments | Total Score | Avg Precision | Avg Recall | Avg Inclusion | Avg Exclusion |
---|---|---|---|---|---|---|
ThunderNMF | percentile=99, max_iter=50, overlap=0.1, chunk=32 | 2.94815 | 0.78606 | 0.84156 | 0.56725 | 0.75328 |
ThunderNMF | percentile=99, max_iter=50, overlap=0.1, chunk=128, padding=15 | 2.852 | 0.663 | 0.93048 | 0.67249 | 0.58641 |
Unet (only running on 00 sets) | train_iter=120, epoch=500, layer=4, features=64 | 2.93394 | 1.0 | 0.9446 | 0.41857 | 0.57077 |
CNMF | k=1000, g=5, merge=0.8 | 2.60321 | 0.860 | 0.645 | 0.790 | 0.309 |
Tensorboard Records for Unet training
Accuracy
Loss
TODO
Training tf_unet with padded images, because tf_unet with shrink the image size. Our results from tf_unet is not as good as we expected. We used scaling, but that may not work so well here. See Issues #13 and #18.
We also tried implementing the image segmentation problem using the spectral clustering method. Due to lack of time, we were not able to test our results for this method. We used the scikit-learn package of spectral clustering in order to implement this.
Authors
(Ordered alphabetically)
- Ankita Joshi - AnkitaJo
- I-Huei Ho - melanieihuei
- Jeremy Shi - whusym
See the CONTRIBUTORS file for details.
License
This project is licensed under the MIT License - see the LICENSE file for details