Training a spiking neural network on an event-based label-free flow
  cytometry dataset
Imaging flow cytometry systems aim to analyze a huge number of cells or
micro-particles based on their physical characteristics. The vast majority of
current systems acquire a large amount of images which are used to train deep
artificial neural networks. However, this approach increases both the latency
and power consumption of the final apparatus. In this work-in-progress, we
combine an event-based camera with a free-space optical setup to obtain spikes
for each particle passing in a microfluidic channel. A spiking neural network
is trained on the collected dataset, resulting in 97.7% mean training accuracy
and 93.5% mean testing accuracy for the fully event-based classification
pipeline.
Muhammed Gouda, Steven Abreu, Alessio Lugnan, Peter Bienstman
# Training a spiking neural network on an event-based label-free flow cytometry dataset

###### Abstract.

Imaging flow cytometry systems aim to analyze a huge number of cells or micro-particles based on their physical characteristics. The vast majority of current systems acquire a large amount of images which are used to train deep artificial neural networks. However, this approach increases both the latency and power consumption of the final apparatus. In this work-in-progress, we combine an event-based camera with a free-space optical setup to obtain spikes for each particle passing in a microfluidic channel. A spiking neural network is trained on the collected dataset, resulting in 97.7% mean training accuracy and 93.5% mean testing accuracy for the fully event-based classification pipeline.

+
Footnote †: journal: Soft authors contributed equally to this research.

+
Footnote †: journal: Soft authors contributed equally to this research.
a previous work using a traditional frame-based camera, the dataset was on the order of hundreds of gigabytes (Beng et al., 2018).

We used two different classes of spherical microparticles (class A of diameter 16 \(\upmu\)m and class B with a diameter of 20 \(\upmu\)m). We ran four separate experiments for each class of microparticles, where each experiment ran for \(T_{exp}\approx 60\)s for a total of 480 seconds of data. The accumulation time for a single particle is \(T_{acc}\approx 10m\)s. Therefore, we have around 6,000 samples per experiment, or 24,000 samples in total per class. We train the network for four different train-test splits, each split using a different experiment as testing data, and the remaining experiments as training data.

### Spiking neural network

We pre-process our event-based imaging data using the Tonic library (Beng et al., 2018). The pre-processing involved a spatial downsampling from \(640\times 480\times 2\) to \(32\times 24\times 2\) (event polarity is left unchanged), and a temporal downsampling by passing the events for each neuron corresponding to a downsampled pixel of fixed polarity through a discretized leaky-integrate-and-fire (LIF) neuron:

\[s_{i}^{out}(n+1) =1\text{ if }\left(\beta u_{i}(n)+\text{ws}_{i}^{in}(n+1) \right)\geq u_{thr}\text{ else }0\] \[r_{i}(n+1) =\max_{t\in\{0,\dots,t_{rf}\}}s_{i}^{out}(n+1-t)\] \[u_{i}(n+1) =0\text{ if }\left(r_{i}(n+1)\right)\text{ else }\left(\beta u_{i}(n)+\text{ws}_{i}^{in}(n+1)\right)\]

where \(u_{i}(n),s_{i}^{out}(n),r_{i}(n)\) denote the membrane potential, binary spike output, and binary refractory period of neuron \(i\) at timestep \(n\), respectively. Further, \(\beta=0.9\) is the membrane decay rate, \(w=1.0\) is the synaptic weight, \(u_{thr}=3.0\) is the threshold voltage, \(t_{rf}=2\) is the refractory period, \(s_{i}^{in}(n)\) equals unity if there is an input event from the event-based camera in the \(i\)th \(20\times 20\times 1\) patch of pixels at timestep \(n\) (and zero otherwise).

For classification, we use a feedforward network of LIF neurons with an input layer of size \(32\times 24\times 2=1536\), a hidden layer of size 100, and an output layer of size 20 (using population coding with 10 neurons per output class). The neuron parameters are constant for all neurons in the network, with the membrane decay rate \(\beta=0.9\) and membrane threshold \(U_{thr}=0.5\). We use the Adam optimizer to optimize the mean squared error on the output spike rate, with a desired population spike rate of 20% (correct) and 80% (incorrect). Backpropagation is applied through a shifted Heaviside function in the forward pass and a fast sigmoid

\[S=\frac{U}{1+k\|U\|}\]

with slope \(k=75\) in the backward pass (Beng et al., 2018). We use snnTorch (Beng et al., 2018) for our implementation.

## 3. Results

We trained the spiking neural network described in Section 2.2 for 10 epochs on a NVIDIA GeForce RTX 2080 Ti GPU with 11 GB of memory. Figure 2 show the training and testing performance for this experiment. The figure shows that the accuracy exceeds 98.5% for all experiments, with the exception of the testing accuracy for the network trained on experiments 1, 3, and 4. More work is needed to analyze the anomalous performance on this data split.

## 4. Outlook

As next steps, we are investigating the use of exact timing information for a time-to-first-spike classification that should yield even faster classification. In this work, we fixed the hyperparameters use to the values mentioned in Section 2.2. For further performance gains, we will optimize the hyperparameters and network architecture through a cross-validation procedure. Finally, we will transfer the SNN to a neuromorphic chip for a fully neuromorphic processing pipeline.

## Acknowledgments

This work was performed in the context of the European projects Neoteric (grant agreement 871330), Prometheus (grant agreement 101070195) and Post-Digital project (grant agreement 860360).
