Automatic Neuron Detection in Calcium Imaging Data Using Convolutional Networks

Noah J. Apthorpe, Alexander J. Riordan, Rob E. Aguilar, Jan Homann, Yi Gu, David W. Tank, H. Sebastian Seung

The Bottleneck in Calcium Imaging

Calcium imaging is a cornerstone of modern neuroscience, allowing researchers to monitor the activity of thousands of neurons simultaneously by recording the "blinking" fluorescence of calcium indicators. However, the data analysis pipeline suffers from a massive bottleneck: identifying which pixels belong to which neuron—a task known as Region of Interest (ROI) detection.

Traditionally, this is done manually by experts, a process that is agonizingly slow and highly subjective. Alternatively, researchers use unsupervised methods like PCA/ICA. Unfortunately, unsupervised methods often fail because they rely on neurons being active to "see" them; if a neuron is quiet during a recording, it effectively doesn't exist to the algorithm. Furthermore, these methods struggle with noise, brain motion artifacts, and overlapping signals from different neurons.

To overcome these limitations, this paper introduces a supervised learning approach using Convolutional Networks (ConvNets) to automate neuron detection, achieving near-human accuracy at "superhuman" speeds.

Datasets and Target Representation

The study utilized two primary datasets gathered from mice using two-photon microscopy:

  • V1 Dataset: Data from the primary visual cortex, consisting of 27 image series with ~4,000 human-annotated neurons.
  • MEC Dataset: Data from the medial entorhinal cortex, consisting of 10 image series with ~500 annotated neurons.
Sample images from the V1 and MEC datasets showing initial images, human-labeled ROIs, and target centroids.

Instead of predicting the full, complex shape of a neuron, the network was trained to detect 4-pixel radius circular "centroids." This intentional "shrinkage" strategy helps the model learn to separate neurons that are physically touching or overlapping. While creating these "ground truth" labels took roughly 10 hours of expert labor, this investment is a one-time cost that enables the rapid automation of future datasets.

Deep Learning Architectures

The authors developed two main ConvNet architectures to tackle the ROI detection problem:

  1. 2D ConvNet: Takes a time-averaged 2D image of the calcium video as input.
  2. (2+1)D ConvNet: Takes a spatiotemporal stack (a video snippet) as input. It uses 2D convolutional kernels followed by a max-pooling layer over the time dimension to produce a 2D probability map of neuron locations.
Architectures for the (2+1)D network (A) and the 2D network (B).

The model processes large imaging frames using a $37 \times 37$ pixel sliding window. The raw probability maps output by the ConvNet are then refined using thresholding and a marker-based watershed algorithm to produce final, distinct ROIs.

Key Insights and Results

  • The "Human Error" Revelation: Initially, the ConvNet seemed to have a high false-positive rate. However, when a human expert re-evaluated the "errors," they discovered that the ConvNet had actually found real neurons that the human had missed during the first pass. After re-labeling to correct these human omissions, the model's $F_1$ score jumped from 0.71 to 0.82.
  • Temporal Context Matters: While the 2D and (2+1)D networks had similar overall scores, qualitative inspection showed that the (2+1)D network was much better at finding neurons that were only transiently active or slightly out of focus. The temporal dimension provides a "flicker" cue that a static average image lacks.
  • Supervised vs. Unsupervised Flexibility: Supervised learning is inherently more flexible. A ConvNet can be retrained to follow different lab-specific criteria (e.g., "only count cell bodies" vs. "include dendrites"), whereas unsupervised algorithms often require tedious manual parameter tuning for every new dataset.
  • Speed and Accuracy: The (2+1)D ConvNet achieved an $F_1$ score of 0.82, nearing the consistency levels of human experts. On the MEC dataset, the ConvNet achieved an $F_1$ of 0.51, significantly outperforming the industry-standard PCA/ICA method (0.27). Crucially, the automated pipeline processes an image series in about 1.2 seconds, compared to the 40–60 minutes required by a human expert.

Limitations and Future Work

Performance was lower on the MEC dataset compared to the V1 dataset, likely due to higher noise levels and a smaller training set. Additionally, the authors used significant temporal downsampling to make the data manageable, which might discard useful high-frequency activity patterns.

Future directions include moving toward true 3D convolutional kernels (rather than 2D kernels with max pooling) and implementing the pipeline for real-time, online ROI detection. This could enable closed-loop experiments, such as triggering optogenetic stimulation based on live neural activity.

Summary updated

BibTeX
@inproceedings{apthorpe2016automatic,
  author = {Noah J. Apthorpe and Alexander J. Riordan and Rob E. Aguilar and Jan Homann and Yi Gu and David W. Tank and H. Sebastian Seung},
  title = {{Automatic Neuron Detection in Calcium Imaging Data Using Convolutional Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
}
Figure