Skip to content

Demonstrates the conversion of a simple Artificial Neural Network (ANN) into a Spiking Neural Network (SNN) using the snnTorch library.

Notifications You must be signed in to change notification settings

Saad-data/ANN-to-SNN-Conversion-with-snnTorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Prerequisites Before running this script, ensure you have Python installed on your system. This script requires the following libraries: Libraries: torch matplotlib snntorch

You can install these dependencies using pip: pip install torch matplotlib snntorch

Running the Script Ensure all the prerequisites are installed. Save the snntorch_anntosnn.py script to your local machine. Open a terminal or command prompt. Navigate to the directory containing the script.

Run the script using Python: python snntorch_anntosnn.py

Understanding the Code

The script consists of several key parts: SimpleANN: A class that defines a simple ANN with one fully connected layer and ReLU activation. SimpleSNN: A class that defines a corresponding SNN with one fully connected layer followed by a leaky integrate-and-fire (LIF) neuron model. test_performance: A function to measure the performance of a given model with provided input data. Visualization: The script generates and visualizes the output of the ANN and the output of the SNN over multiple time steps. The output will include printed performance metrics (output values and time taken) for the ANN. It will also display a plot comparing the activation of the ANN's output neurons with the activation of the SNN's output neurons over time.

About

Demonstrates the conversion of a simple Artificial Neural Network (ANN) into a Spiking Neural Network (SNN) using the snnTorch library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published