Biological neuron counting using AI

April 27, 2023
Blog Cogniflow How Artificial Intelligence Is Changing Business

The AI revolution is having a significant impact on the way we live and think. These impacts will be especially felt in biology and the biomedical sciences. The use of AI in medical imaging, neuroscience, and protein folding has helped to improve the efficiency, and accuracy of obtaining results, both in basic scientific research and clinical applications.

The current article summarizes the ongoing work we have been doing in collaboration with Dr. Ronald McGregor from the Center for Sleep Research, Department of Psychiatry and Brain Research Institute at the University of California, Los Angeles, United States of America. As one of the most prestigious Universities in the US, UCLA has become a bustling hub for brain research, paving the way forward in the field of neuroscience.

This post describes how Dr. McGregor, a specialist in brain circuit anatomy (the study of the connections we have in our brains) uses Cogniflow successfully to solve a taxing problem in neuroanatomy: counting the number of neurons in brain structures. This is usually a time-consuming process that has to be performed by a trained histologist who can recognize the defining characteristics of the neuronal cell. Using Cogniflow has allowed him to train an AI model to recognize these characteristics and identify neuronal cells. 

An additional and beneficial application that Dr. McGregor found in using this AI model was that onboarding laboratory personnel, including technicians and students, could be trained successfully by the AI model to recognize the neuronal cells. This kind of training would be unsupervised and portable; the trainees could use any computer or mobile device and learn on their own schedules.

Encouraged by the results in counting neuronal cells, McGregor is using Cogniflow to develop a new model to identify and quantify the presence of neuronal fibers and how those fibers are reshaped after experimental treatments. This last point is crucial in understanding how dynamic brain connections are.

Below, Dr. McGregor describes, in his own words, his ongoing research and how he solves many challenges using Cogniflow’s no-code AI platform.

How can we see neurons? Why are neuronal numbers important?

Within the nervous system, neurons communicate with each other by using electric signals and chemical messengers called neurotransmitters. Each group of neurons has a specific and recognizable chemical signature that researchers can detect and visualize. During a healthy aging process, the brain will lose neurons and interconnections, leading to declines in particular cognitive abilities such as processing speed, multitasking, some types of memory, and executive functions.

Neurodegenerative diseases like Parkinson, narcolepsy, or Alzheimer's can also significantly reduce neuronal numbers. Losing neurons then decreases the absolute number of processing units and the connectivity between them, making the dialog between different brain areas harder to maintain.

Are there any hidden neurons that we cannot see? How does this relate to substance use disorders?

Yes, prior work from our laboratory has previously reported that there are hidden neurons we cannot see under baseline conditions in rodents [1], and in a follow-up study, we found that the brains of people addicted to heroin (a commonly abused opioid) have, on average, 54% more hypocretin-producing neurons than people who don’t have a substance use disorder (SUD) and confirmed the same finding in mice [2] establishing a relationship between these neurons and SUD.

We further reported that target regions of hypocretin-producing neurons, like the locus coeruleus, were also affected [3]. Neurons in the LC produce NE and distribute it to other parts of the brain, stimulating functions such as arousal, wakefulness, attention, or a “fight or flight” stress response. NE is thought to be a principal actor in opioid withdrawal. 

How did Cogniflow help to build an AI model to identify and quantify neuronal cell numbers correctly?

The structure I am currently working on, the LC, is one of the brain's most challenging regions to quantify neuronal numbers. This stems from the extremely high density of cells present in the structure combined with their compact arrangement, making the quantification process both difficult and time-consuming.

Cogniflow seemed a promising aid in this process, although I had no prior experience in AI or computer coding. I started providing my microscope images to the Cogniflow platform to perform the labeling process (specifying using bounding boxes where the neuron are located). Then I asked Cogniflow to train a model for me.

Once the model was ready, I evaluated its results in recognizing the neurons. I repeated this process for five rounds, and to my surprise, I obtained a 90% accuracy between my cell counts and the neurons the AI program was recognizing. In histology, a 15% discrepancy between two trained histologists quantifying the cell numbers using the same sample is acceptable. Compared to the months of constant work and supervision needed to prepare a student or a technician to recognize neurons in a histological section properly, I was amazed to see that with so few trials, I could obtain such great results. To draw a comparison, teaching a human to recognize neurons properly starts from the basics, and it takes no less than six months before I will allow the trainee to begin working in the LC.

Currently, we are expanding the training by adding more sections to keep improving the model's accuracy. In addition, I have decided to expand the model to other neuronal populations that are of interest to our ongoing research, like the histamine-containing neurons, responsible for maintaining wakefulness and, we think, are also involved in the processing of rewards.


The Data

The dataset used to train the models consisted of microscope images of norepinephrine neurons. These images were obtained from two groups of mice, one exposed to opioids and the other one to control conditions. Figure 1 shows examples of individual norepinephrine neurons used to train the model.

Figure 1. Tyrosine hydroxylase expressing  neurons in the LC. Confocal image of a representative section of the locus coeruleus of a rodent stained for enzyme tyrosine hydroxylase. Yellow arrowheads indicate neurons with a clear identifiable nucleus; single blue arrow indicates a neuron without an apparent nucleus; double green arrows point to a structure that is not a neuron. Isert is a confocal image at a higher magnification of the selected area (white square). Scale bar 100 μm, insert 20 μm.

Each image in the dataset has two categories: one for neurons with visible nucleus, represented by the yellow bounding box, and a second category for neurons without visible nucleus represented by the blue bounding box. The model was trained in a way that it was able to recognize neurons using accessory criteria, including the size and shape of the cells.

Figure 2. Examples of two neurons located in the ventral sector of the LC and stained for TH. The yellow bounding box labels the neuron with an identifiable nucleus, seen in the image as a dark ovoid shape in the center of the cell. The blue bounding box labels a neuron without a visible nucleus.  

Once the images are completely labeled, the dataset is exported in YOLOv5 format, so Cogniflow can start the training automatically*. At this stage, the data is divided into training and validation subsets such that 80% of the images are used for training and 20% for validation. Once the dataset is labeled and partitioned, the newly trained Object Detection model can identify and locate neurons in novel microscope images.  

*Note: To know more about how to label an Object Detection dataset, please click here.

Training Results

A global mAP@0.5 of 75% was achieved on the validation subset for the most extensive dataset. This is a good result given the small size of the dataset, consisting of only 120 images for both training and validation. Also, it’s encouraging to look at the local mAP@0.5 (i.e., for every category). Thus we found a mAP@0.5 of 86% for the Neuron class, while a 64% for Neuron_2. This difference resides mainly in the lower number of Neuron_2 objects present in the images w.r.t Neuron class. So, it was expected that the model would perform a little worse for this class (i.e. it doesn’t have too much data to learn from). 

Figure 3 below shows an inference run on a low-density image. Check how both classes are present here, each bounding box with its confidence score.

Figure 3. Inference example. Both kinds of neurons are detected, each with its own confidence score.

Thanks to Cogniflow, detecting, locating, and counting neurons in microscopy images is now possible. Anyhow, the counting phase entails some challenges to address. The following sections dive into the counting process in more detail.

Counting Neurons

Once trained, the model is ready to receive a novel image it has not seen before. The program will run an inference on the data and return the image with every object detected (i.e., neurons with or without visible nucleus), each with its own bounding box. In addition, it provides the specific coordinates for each bounding box, its class (neuron 1 or neuron 2), and a confidence score between 0 and 1. The closer to 1 the number is, the more confident the model is about its prediction.

Figure 4. Model inference and neuron counting in Cogniflow platform.

Although counting neurons might seem a straightforward procedure, the design of the model required further development to achieve a precise neuronal cell count since the intrinsic complexities of this biological sample, such as overlapping of neurons, high object density, and convoluted patterns, needed to be taken into consideration.  A few of these modifications are highlighted below.

  • Filter by a confidence score. This tool allowed me to set the threshold for the confidence score. Objects below a certain confidence number can be automatically eliminated. The trained model was powerful enough to correctly identify and eliminate false positive objects.
  • Filter double counting or undercounting. This particular biological sample was a 3-dimensional image composed of individual images stacked together. In order to obtain an accurate number of neurons in the sample, it is important to avoid double counting (counting the same neuron twice) or undercounting (in the image stack, one neuron is below another). These are frequent issues when using stacks of images and require special attention when training new histologists.  
  • Filter by the intersection of bounding boxes. This tool permits the discrimination between double detections and neurons close to each other, another factor to consider when avoiding double counting.
  • Filter by area of bounding boxes. Although particularly small or large objects are not usually detected, this step is taken as a precaution against possible size outliers that could trigger double counting.

With a set of microscope image stacks with a ground truth value of neuron counting (i.e., done manually), it’s possible to assess how well our automated counting is performing and how to set different threshold values needed to filter out any noisy detection. Below, the neuron counting results are presented.

Neuron Counting Results

The Mean Error Rate (MER) was computed to measure how well the counting process was performed. The MER was measured for every stack in individual samples and averaged for every combination of thresholds and parameters. The model designed by Cogniflow achieved a MER of 10.41%, indicating that the results obtained by the AI were below the human discrepancy accepted in the field of 15%.

Humans are expected to have between a 10% and 15% error margin for this kind of neuronal population, so the 10.41% MER reached by Cogniflow remains promising.

Concluding remarks

In this article, we have learned how Dr. McGregor, having no prior experience with AI or computer coding, was able to successfully build a model that can recognize and quantify neurons in complex brain structures with an accuracy of almost 90%. These results are well within the range of accepted accuracy between two human histologists (85% to 90%) quantifying the same sample. This outstanding performance was obtained with a set of just 120 images, indicating that a small data set is enough to train a high-performant model. Continuous training of the model with more data will significantly improve the model beyond the current accuracy.

In a similar success story, Cogniflow was used to help another group of researchers from the Clemente Estable Biological Research Institute (IIBCE), a leading Latin American scientific research facility, to create a model to identify, categorize and quantify images of different types of receptors (electroreceptors) used by a family of fish to precisely sense their environment. In this case, the AI image classification model trained has an outstanding 97% accuracy. These two cases have shown the power and flexibility Cogniflow has to offer. Recently, other researchers and MDs have started to use Cogniflow in areas like brain tumor identification and classification and mould spore counting.

In conclusion, Cogniflow tackled difficult, time-consuming tasks and delivered outstanding solutions for users in different life-science fields. Using Cogniflow as an independent, fully automated system or working as an aid improves efficiency, reduces processing time, and provides accurate results.

Future work

Encouraged by the outstanding performance of Cogniflow in identifying neurons, Dr. McGregor is now working to tackle a more challenging problem: identifying and quantifying neuronal fibers in specific brain areas. As mentioned before, a critical aspect in the study of the brain is understanding the way different regions are connected to each other, and in this specific case, how these connections are reshaped after exposure to drugs of abuse. This set of unique challenges will put Cogniflow at the forefront of neuroanatomical studies in the field of substance use disorders. 

Recently this UCLA research group has started a cross-institutional collaboration with other laboratories currently using Cogniflow to write a peer-review article showcasing the flexibility and broad spectrum of applications that Cogniflow has to offer to the growing field of life-sciences.

Marcelo Martinez CEO co-founder Cogniflow
Ronald Mc Gregor
Ph.D. Project Scientist, Center for Sleep Research, University of California, Los Angeles.

Want to learn more about No-Code AI and Machine Learning?

Thank you for subscribing to our newsletter!
Oops! Something went wrong while submitting the form.