A fusion of spiking neural networks and CNNs for efficient digit classification
This project dives into the world of spiking neural networks (SNNs) using the Izhikevich neuron model to classify handwritten digits from the MNIST dataset. Paired with a convolutional neural network (CNN), it compares the energy efficiency and accuracy of SNNs against traditional CNNs.
With optimizations like Spike-Timing-Dependent Plasticity (STDP) and sparse weight matrices, the project achieves up to 94% accuracy, showcasing the potential of biologically inspired models for image classification on resource-constrained devices.
"Exploring the balance between biological plausibility and computational efficiency in neural networks."
The SNN was built using Brian2, simulating 1,254,400 synapses with a maximum spike frequency of 20 Hz. The Izhikevich model, known for its computational efficiency, is defined by:
v' = 0.04v² + 5v + 140 - u + I
u' = a(bv - u)
Where v is the membrane potential, u is the recovery variable, and I is the input current.
Parameters a and b were tuned for regular spiking behavior, and STDP was used for learning. Sparse weight matrices (mean ~0.2501, max ~0.5000) were generated with NumPy and stored in .npy format to reduce memory usage.
The CNN, implemented in PyTorch, included Conv2D layers, MaxPooling2D, and fully connected layers with an input shape of (28, 28, 1). Batch normalization and an Input layer resolved shape warnings, achieving 94% accuracy after 10 epochs.
Reached ~94% accuracy with CNN and ~72% with SNN, enhanced by hidden layers and STDP.
SNNs consumed less power, ideal for edge devices.
Reduced memory with sparse matrices in .npy format.
Generated confusion matrices and energy plots with Matplotlib.
Visualizations provide insights into model performance:
Confusion Matrix
Energy Plot
Accuracy Plot
Check out the full project on GitHub to dive into the implementation details.
View Repository