alexklibisz / deep-calcium

Fast, Simple Calcium Imaging Segmentation with Fully Convolutional Networks (https://arxiv.org/abs/1707.06314)
28 stars 9 forks source link
calcium-imaging deep-learning neurofinder unet

deep-calcium

Deep Learning Models for Calcium Imaging Data

Installation and example

Install the package and make predictions on Neurofinder using a pre-trained UNet2DS model.

Note: This assumes python3.5 and pip3.

# Install from Github repo. Need to upgrade pip.
$ pip install --upgrade --user -I pip
$ pip install --user git+https://github.com/alexklibisz/deep-calcium.git

# Download the model from Github releases.
$ wget https://github.com/alexklibisz/deep-calcium/releases/download/v0.0.1-weights/unet2ds_model.hdf5

# Download the example script and evaluate predictions on the first training dataset.
# This will download and preprocess the dataset to ~/.deep-calcium-datasets, requiring ~3.1GB of disk space.
$ wget https://raw.githubusercontent.com/alexklibisz/deep-calcium/dev/examples/neurons/unet2ds_nf.py
$ CUDA_VISIBLE_DEVICES="0" python unet2ds_nf.py evaluate neurofinder.00.00 --model unet2ds_model.hdf5

You should see output similar to this:

$ INFO:predict:Loaded model from unet2ds_model.hdf5.
$ INFO:predict:neurofinder.00.00: prec=0.976, reca=1.000, incl=0.084, excl=0.109, comb=0.988
$ INFO:predict:Saved /home/kzh/.deep-calcium/checkpoints/neurons_unet2ds_nf/neurofinder.00.00_mp.png
$ INFO:predict:Mean prec=0.976, reca=1.000, comb=0.988
$ INFO:evaluation:Evaluation without TTA.
$ INFO:predict:Loaded model from unet2ds_model.hdf5.
$ INFO:predict:neurofinder.00.00: prec=0.919, reca=1.000, incl=0.106, excl=0.133, comb=0.958
$ INFO:predict:Saved /home/kzh/.deep-calcium/checkpoints/neurons_unet2ds_nf/neurofinder.00.00_mp.png
$ INFO:predict:Mean prec=0.919, reca=1.000, comb=0.958

Models for Neuron Segmentation

Ground truth and predicted neurons are outlined in blue and red, respectively. Intersecting outlines become purple.

U-Net2DS: U-Net segmenting 2D Summary Images

Date Summary Mean F1 Score All Scores Model & Weights Training Artifacts Commit
6/16/17 UNet with a single batchnorm layer at the input. Images scaled to [0,1]. 0.5356 Github Google Drive Google Drive 0bda9d4
7/12/17 Same as 6/16/17, but with 8x test-time augmentation. 0.5422 Github Google Drive Google Drive f1b33bf
7/13/17 UNet with batchnorm between each conv and ReLU. Mean subtraction and normalization on each summary image. Mask-summary erosion to eliminate merged neurons in ground-truth mask. 0.5611 Github Github Google Drive 2b15d1b
7/13/17 Same as 7/13/17, but with 8x test-time augmentation. Replaced UNet2DS submission with this one. 0.5689 Github Github Google Drive 2b15d1b

Models for Spike Segmentation

*Ground truth spikes marked in blue, predicted spike segments in red.

U-Net1D: 1-dimensional U-Net segmenting calcium traces