Skip to main content

BrainCog is an open source spiking neural network based brain-inspired cognitive intelligence engine for Brain-inspired Artificial Intelligence and brain simulation. More information on braincog can be found on its homepage http://www.brain-cog.network/

Project description

BrainCog

BrainCog is an open source spiking neural network based brain-inspired cognitive intelligence engine for Brain-inspired Artificial Intelligence and brain simulation. More information on BrainCog can be found on its homepage http://www.brain-cog.network/

The current version of BrainCog contains at least 18 functional spiking neural network algorithms (including but not limited to perception and learning, decision making, knowledge representation and reasoning, motor control, social cognition, etc.) built based on BrainCog infrastructures, and BrainCog also provide brain simulations to drosophila, rodent, monkey, and human brains at multiple scales based on spiking neural networks at multiple scales. More detail in http://www.brain-cog.network/docs/

BrainCog is a community based effort for spiking neural network based artificial intelligence, and we welcome any forms of contributions, from contributing to the development of core components, to contributing for applications.

If you use BrainCog in your research, the following paper can be cited as the source for BrainCog.

Yi Zeng, Dongcheng Zhao, Feifei Zhao, Guobin Shen, Yiting Dong, Enmeng Lu, Qian Zhang, Yinqian Sun, Qian Liang, Yuxuan Zhao, Zhuoya Zhao, Hongjian Fang, Yuwei Wang, Yang Li, Xin Liu, Chengcheng Du, Qingqun Kong, Zizhe Ruan, Weida Bi. BrainCog: A Spiking Neural Network based Brain-inspired Cognitive Intelligence Engine for Brain-inspired AI and Brain Simulation. arXiv:2207.08533, 2022. https://arxiv.org/abs/2207.08533

./figures/logo.jpg

BrainCog provides essential and fundamental components to model biological and artificial intelligence.

image

Brain-Inspired AI

BrainCog currently provides cognitive functions components that can be classified into five categories:

  • Perception and Learning
  • Decision Making
  • Motor Control
  • Knowledge Representation and Reasoning
  • Social Cognition
mt mt

Brain Simulation

BrainCog currently include two parts for brain simulation:

  • Brain Cognitive Function Simulation
  • Multi-scale Brain Structure Simulation
bmbm10s bm10s bh10s

The anatomical and imaging data is used to support our simulation from various aspects.

Resources

Lectures

  • [BrainCog Talk] Beginning BrainCog Lecture 23. The Implement of Object Detection and Semantic Segmentation Based on SNNs with Braincog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 22. BrainCog Data Engine: Spatio-temporal Sequence Data N-Omniglot and Its Applications [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 21. Dynamic structural development for SNNs incorporating constraints, pruning and regeneration based on BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 20. Developmental Plasticity-inspired Adaptive Pruning for SNNs based on BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 19. Multi-brain areas Coordinated Brain-inspired Affective Empathy Spiking Neural Network Based on Braincog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 18. Application of the Prefrontal Cortex Column Model in Working Memory Task with BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 17. A Brain-inspired Theory of Mind Model Based on BrainCog for Reducing Other Agents’ Safety Risks [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 16. Brain-inspired Bodily Self-perception Model Based on BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 15. SNN-based Music Memory and Generation Based on BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 14. The Implement of Multisensory Concept Learning Framework Based on SNNs with Braincog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 13. Symbolic Representation and Reasoning SNN Based on Braincog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 12. Unsupervised STDP-based Spiking Neural Networks Based on BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 11. Backpropagation with Spatiotemporal Adjustment for Training Deep Spiking Neural Networks through BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 10. Multi-brain Areas Coordinated Brain-inspired Decision-Making Spiking Neural Network Based on Braincog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 9. Spiking Neural Networks with Global Feedback Connections Based on BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 8. Converting Artificial Neural Network to Spiking Neural Network through BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 7. Implementing Quantum Superposition Inspired Spatio-temporal Spike Encoding through BrainCog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 6. Implementing spiking deep Q network through Braincog [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 5. Advanced BrainCog System Functions [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 4. Creating Cognitive SNNs for Brain Areas [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 3. Creating SNNs Easily and Quickly [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 2. Computational Modeling of Spiking Neurons [English Version, Chinese Version]
  • [BrainCog Talk] Beginning BrainCog Lecture 1. Installing and Deploying BrainCog platform [English Version, Chinese Version]

Tutorial

BrainCog Data Engine

In addition to the static datasets, BrainCog supports the commonly used neuromorphic datasets, such as DVSGesture, DVSCIFAR10, NCALTECH101, ES-ImageNet. Also, the neuromorphic dataset N-Omniglot for few-shot learning is also integrated into BrainCog.

DVSGesture

This dataset contains 11 hand gestures from 29 subjects under 3 illumination conditions recorded using a DVS128.

DVSCIFAR10

This dataset converts 10,000 frame-based images in the CIFAR10 dataset into 10,000 event streams using a dynamic vision sensor.

NCALTECH101

The NCaltech101 dataset is captured by mounting the ATIS sensor on a motorized pan-tilt unit and having the sensor move while it views Caltech101 examples on an LCD monitor. The "Faces" class has been removed from N-Caltech101, leaving 100 object classes plus a background class

ES-ImageNet

The dataset is converted with Omnidirectional Discrete Gradient (ODG) from 1,300,000 frame-based images in the ImageNet dataset into event-stream samples, which has 1000 categories.

N-Omniglot

This dataset contains 1,623 categories of handwritten characters, with only 20 samples per class. The dataset is acquired with the DVS acquisition platform to shoot videos (generated from the original Omniglot dataset) played on the monitor, and use the Robotic Process Automation (RPA) software to collect the data automatically.

You can easily use them in the braincog/datasets folder, taking DVSCIFAR10 as an example

loader_train, loader_eval,_,_ = get_dvsc10_data(batch_size=128,step=10)

Requirements:

  • python == 3.8
  • CUDA toolkit == 11.
  • numpy >= 1.21.2
  • scipy >= 1.8.0
  • h5py >= 3.6.0
  • torch >= 1.10
  • torchvision >= 0.12.0
  • torchaudio >= 0.11.0
  • timm >= 0.5.4
  • matplotlib >= 3.5.1
  • einops >= 0.4.1
  • thop >= 0.0.31
  • pyyaml >= 6.0
  • loris >= 0.5.3
  • pandas >= 1.4.2
  • tonic
  • pandas >= 1.4.2
  • xlrd == 1.2.0

Install

Install Online

  1. You can install braincog by running:

    pip install braincog

  2. Also, install from github by running:

    pip install git+https://github.com/braincog-X/Brain-Cog.git

Install locally

  1. If you are a developer, it is recommanded to download or clone braincog from github.

    git clone https://github.com/braincog-X/Brain-Cog.git

  2. Enter the folder of braincog

    cd Brain-Cog

  3. Install braincog locally

    pip install -e .

Example

  1. Examples for Image Classification
cd ./examples/Perception_and_Learning/img_cls/bp 
python main.py --model cifar_convnet --dataset cifar10 --node-type LIFNode --step 8 --device 0
  1. Examples for Event Classification
cd ./examples/Perception_and_Learning/img_cls/bp 
python main.py --model dvs_convnet --node-type LIFNode --dataset dvsc10 --step 10 --batch-size 128 --act-fun QGateGrad --device 0 

Other BrainCog features and tutorials can be found at http://www.brain-cog.network/docs/

BrainCog Assistant

Please add our BrainCog Assitant via wechat and we will invite you to our wechat developer group. image

Publications Using BrainCog

Brain Inspired AI

Perception and Leanring

Papers Codes Publisher
Quantum superposition inspired spiking neural network https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/QSNN Cell iScience
Backpropagation with biologically plausible spatiotemporal adjustment for training deep spiking neural networks https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/img_cls/bp Cell Patterns
N-Omniglot, a large-scale neuromorphic dataset for spatio-temporal sparse few-shot learning https://github.com/BrainCog-X/Brain-Cog/tree/main/braincog/datasets/NOmniglot Scientific Data
Efficient and Accurate Conversion of Spiking Neural Network with Burst Spikes https://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Perception_and_Learning/Conversion/converted_CIFAR10.py IJCAI 2022
BackEISNN: A deep spiking neural network with adaptive self-feedback and balanced excitatory–inhibitory neurons https://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Perception_and_Learning/img_cls/bp/main_backei.py Neural Networks
Spiking CapsNet: A spiking neural network with a biologically plausible routing rule between capsules https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/img_cls/spiking_capsnet Information Sciences
Multisensory Concept Learning Framework Based on Spiking Neural Networks https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/MultisensoryIntegration Frontiers in Systems Neuroscience
GLSNN: A Multi-Layer Spiking Neural Network Based on Global Feedback Alignment and Local STDP Plasticity https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/img_cls/glsnn Fontiers in Computational Neuroscience
EventMix: An Efficient Augmentation Strategy for Event-Based Data https://github.com/BrainCog-X/Brain-Cog/blob/main/braincog/datasets/cut_mix.py Arxiv
Spike Calibration: Fast and Accurate Conversion of Spiking Neural Network for Object Detection and Segmentation https://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Perception_and_Learning/Conversion/converted_CIFAR10.py Arxiv
An Unsupervised Spiking Neural Network Inspired By Biologically Plausible Learning Rules and Connections https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/UnsupervisedSTDP Arxiv

Social Cognition

Papers Codes Publisher
Toward Robot Self-Consciousness (II): Brain-Inspired Robot Bodily Self Model for Self-Recognition https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/mirror_test Cognitive Computation
A brain-inspired intention prediction model and its applications to humanoid robot https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/Intention_Prediction Frontiers in Neuroscience
A Brain-Inspired Theory of Mind Spiking Neural Network for Reducing Safety Risks of Other Agents https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/ToM Frontiers in Neuroscience
Brain-Inspired Affective Empathy Computational Model and Its Application on Altruistic Rescue Task https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/affective_empathy/BAE-SNN Frontiers in Computational Neuroscience
A brain-inspired robot pain model based on a spiking neural network https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/affective_empathy/BRP-SNN Frontiers in Neurorobotics
Brain-Inspired Theory of Mind Spiking Neural Network Elevates Multi-Agent Cooperation and Competition https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/MAToM-SNN SSRN

Knowledge Representation and Reasoning

Papers Codes Publisher
A Brain-Inspired Causal Reasoning Model Based on Spiking Neural Networks https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/CRSNN IJCNN2021
Brain Inspired Sequences Production by Spiking Neural Networks With Reward-Modulated STDP https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/SPSNN Frontiers in Computational Neuroscience
Temporal-Sequential Learning With a Brain-Inspired Spiking Neural Network and Its Application to Musical Memory https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/musicMemory Frontiers in Computational Neuroscience
Brain-Inspired Affective Empathy Computational Model and Its Application on Altruistic Rescue Task https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/musicMemory Frontiers in System Neuroscience
Stylistic Composition of Melodies Based on a Brain-Inspired Spiking Neural Network https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/affective_empathy/BRP-SNN Frontiers in Neurorobotics
Brain-inspired Graph Spiking Neural Networks for Commonsense Knowledge Representation and Reasoning https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/CKRGSNN Arxiv

Decision Making

Papers Codes Publisher
Nature-inspired self-organizing collision avoidance for drone swarm based on reward-modulated spiking neural network https://github.com/BrainCog-X/Brain-Cog/blob/main/examples/decision_making/swarm/Collision-Avoidance.py Cell Patterns
Solving the spike feature information vanishing problem in spiking deep Q network with potential based normalization https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/decision_making/RL/sdqn Frontiers in Neuroscience
A Brain-Inspired Decision-Making Spiking Neural Network and Its Application in Unmanned Aerial Vehicle https://github.com/BrainCog-X/Brain-Cog/blob/main/examples/decision_making/BDM-SNN/BDM-SNN-hh.py Frontiers in Neurorobotics
Multi-compartment Neuron and Population Encoding improved Spiking Neural Network for Deep Distributional Reinforcement Learning https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/decision_making/RL/mcs-fqf Arxiv

Motor Control

Papers Codes Publisher
https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/MotorControl/experimental

SNN Safety

Papers Codes Publisher
DPSNN https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Snn_safety/DPSNN Arxiv

Development and Evolution

Papers Codes Publisher
Developmental Plasticity-inspired Adaptive Pruning for Deep Spiking and Artificial Neural Networks https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Structural_Development/DPAP Arxiv
Adaptive Sparse Structure Development with Pruning and Regeneration for Spiking Neural Networks https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Structural_Development/SD-SNN Arxiv

Hardware Acceleration

Papers Codes Publisher
FireFly: A High-Throughput and Reconfigurable Hardware Accelerator for Spiking Neural Networks https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Hardware_acceleration Arxiv

Brain Simulation

Funtion

Papers Codes Publisher
A neural algorithm for Drosophila linear and nonlinear decision-making https://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Brain_Cognitive_Function_Simulation/drosophila/drosophila.py Scientific Reports
Comparison Between Human and Rodent Neurons for Persistent Activity Performance: A Biologically Plausible Computational Investigation https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/Human_PFC_Model Frontiers in System Neuroscience

Structure

Papers Codes Publisher
Corticothalamic minicolumn https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn
Human Brain https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/HumanBrain
Macaque Brain https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/MacaqueBrain
Mouse Brain https://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/Mouse_brain

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

braincog-0.2.7.19-py3-none-any.whl (123.0 kB view details)

Uploaded Python 3

File details

Details for the file braincog-0.2.7.19-py3-none-any.whl.

File metadata

  • Download URL: braincog-0.2.7.19-py3-none-any.whl
  • Upload date:
  • Size: 123.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.15

File hashes

Hashes for braincog-0.2.7.19-py3-none-any.whl
Algorithm Hash digest
SHA256 713200ea2a202fb0f5774160271eba5593861f37b72b4479f564993391e097c2
MD5 4faed99362cb284fd5edf99006e3d15a
BLAKE2b-256 602b67c84cb4bef4ca6ef13e4575d6b179ae736c1d74f4aec146ae0e9c3215c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page