Utilizing 2D-region-based CNNs for automatic dendritic spine detection in 3D live cell imaging

Fabian W. Vogel, Sercan Alipek, Jens-Bastian Eppler, Pamela Osuna-Vargas, Jochen Triesch, Diane Bissen, Amparo Acker‐Palmer, Simon Rumpel, Matthias KaschubeScientific 2023

Abstract

Dendritic spines are considered a morphological proxy for excitatory synapses, rendering them a target of many different lines of research. Over recent years, it has become possible to simultaneously image large numbers of dendritic spines in 3D volumes of neural tissue. In contrast, currently no automated method for 3D spine detection exists that comes close to the detection performance reached by human experts. However, exploiting such datasets requires new tools for the fully automated detection and analysis of large numbers of spines. Here, we developed an efficient analysis pipeline to detect large numbers of dendritic spines in volumetric fluorescence imaging data acquired by two-photon imaging in vivo. The core of our pipeline is a deep convolutional neural network that was pretrained on a general-purpose image library and then optimized on the spine detection task. This transfer learning approach is data efficient while achieving a high detection precision. To train and validate the model we generated a labeled dataset using five human expert annotators to account for the variability in human spine detection. The pipeline enables fully automated dendritic spine detection reaching a performance slightly below that of the human experts. Our method for spine detection is fast, accurate and robust, and thus well suited for large-scale datasets with thousands of spines. The code is easily applicable to new datasets, achieving high detection performance, even without any retraining or adjustment of model parameters.

Introduction

Dendritic spines—tiny protrusions on neurons—are the primary sites of excitatory synapses in the brain. Their size and density are critical proxies for synaptic strength and learning. While modern two-photon microscopy can now capture massive 3D volumes of these spines in living tissue, the "analysis bottleneck" remains severe. Manual identification of thousands of spines is slow, exhausting, and highly subjective even among experts. Existing automated tools often rely on rigid, rule-based image processing that fails when faced with the noise and diverse shapes found in real-world biological data. This paper presents a deep-learning solution that is robust, fast, and generalizable across different laboratory setups.

Methodology

The authors developed a pipeline that bridges the gap between efficient 2D object detection and 3D volumetric data through several key innovations.

2D Detection and Transfer Learning

Instead of building a complex 3D CNN, which requires massive amounts of labeled data, the pipeline uses a Faster R-CNN with a ResNeXt-101 backbone. To overcome the scarcity of specialized biological training data, the model was pretrained on the MS COCO dataset. This transfer learning approach allowed the network to learn basic geometric features before being fine-tuned on a smaller dataset of microscopic images.

3D Integration and the IoM Metric

To handle 3D stacks, the pipeline processes each 2D slice independently. A custom tracking algorithm then links these detections across the z-axis, creating a "3D bounding box" for each spine. This process helps filter out transient noise or misdetections in individual slices.

Detections are tracked across the z-dimension to integrate 2D slices into a 3D volume.

Standard computer vision uses Intersection over Union (IoU) to measure accuracy. However, because spines are so small, a tiny pixel offset can result in a poor IoU score even if the detection is biologically accurate. The authors proposed Intersection over Minimum (IoM), which is more robust for small-scale object detection.

Datasets and Human Ground Truth

The primary dataset consisted of 55 two-photon image stacks from the auditory cortex of a mouse. To account for human subjectivity, five expert annotators labeled the data. The authors established three "ground truth" tiers based on consensus: Minimal (detected by at least one expert), Majority (at least three), and Maximal (all five).

The annotation workflow (A-C), dataset distribution (D), and variability in expert labeling (E0-E5).

Key Results

  • Accuracy: The model achieved a 3D $F_1$-score of 0.903, coming remarkably close to the human expert average of 0.968.
  • Speed: Human experts took approximately 12 seconds to process a single frame. The model completed the same task in 0.053 seconds, representing a speedup of over 200x.
  • Generalization: The model achieved an $F_1$-score of 0.815 on a completely novel dataset from a different lab (organotypic hippocampal slices) without any retraining. This suggests the model learned the fundamental "essence" of a dendritic spine rather than just memorizing specific image textures.

Discussion and Future Work

While the model is highly robust, it faces challenges when spines are in very close proximity, sometimes merging them into a single detection. Additionally, spines extending purely in the z-direction are harder to detect due to their small footprint in the x-y plane. Future iterations could incorporate instance segmentation to allow for more detailed morphological analysis, such as measuring neck width or head volume.

Summary updated

BibTeX
@inproceedings{vogel2023utilizing,
  author = {Fabian W. Vogel and Sercan Alipek and Jens-Bastian Eppler and Pamela Osuna-Vargas and Jochen Triesch and Diane Bissen and Amparo Acker‐Palmer and Simon Rumpel and Matthias Kaschube},
  title = {{Utilizing 2D-region-based CNNs for automatic dendritic spine detection in 3D live cell imaging}},
  booktitle = {Scientific},
  year = {2023},
  doi = {10.1038/s41598-023-47070-3},
}
Figure