Package: braincog
BrainCogBrainCog 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 homepagehttp://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 inhttp://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.08533BrainCog provides essential and fundamental components to model biological and artificial intelligence.Brain-Inspired AIBrainCog currently provides cognitive functions components that can be classified
into five categories:Perception and LearningDecision MakingMotor ControlKnowledge Representation and ReasoningSocial CognitionBrain SimulationBrainCog currently include two parts for brain simulation:Brain Cognitive Function SimulationMulti-scale Brain Structure SimulationThe anatomical and imaging data is used to support our simulation from various aspects.ResourcesLectures[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]TutorialHow to Install BrainCog [English Version,Chinese Version]Overall Introduction of BrainCog [English Version,Chinese Version]Spiking Neuron Modeling with BrainCog [English Version,Chinese Version]Building Efficient Spiking Neural Networks with BrainCog [English Version,Chinese Version]Building Cognitive Networks with BrainCog [English Version,Chinese Version]Implementing Deep Reinforcement Learning SNNs with BrainCog [English Version,Chinese Version]Quantum Superposition State Inspired Encoding With BrainCog [English Version,Chinese Version]Converting ANNs to SNNs with BrainCog [English Version,Chinese Version]SNNs with Global Feedback Connections Based on BrainCog [English Version,Chinese Version]Multi-brain Areas Coordinated Brain-inspired Decision-Making SNNs Based on Braincog [English Version,Chinese Version]Backpropagation with Spatiotemporal Adjustment for Training SNNs Based on BrainCog [English Version,Chinese Version]Unsupervised STDP Based SNNs with Multiple Adaptive Mechanisms Based on BrainCog [English Version,Chinese Version]Symbolic Representation and Reasoning SNNs Based on BrainCog [English Version,Chinese Version]Multisensory Integration Based on BrainCog [English Version,Chinese Version]SNN-based Music Memory and Generation Based on BrainCog [English Version,Chinese Version]Brain-inspired Bodily Self-perception Model Based on BrainCog [English Version,Chinese Version]A Brain-inspired Theory of Mind Model Based on BrainCog for Reducing Other Agents’ Safety Risks [English Version,Chinese Version]Application of the Prefrontal Cortex Column Model in Working Memory Task with BrainCog [English Version,Chinese Version]Multi-brain areas Coordinated Brain-inspired Affective Empathy Spiking Neural Network Based on Braincog [English Version,Chinese Version]Developmental Plasticity-inspired Adaptive Pruning for SNNs based on BrainCog [English Version,Chinese Version]Dynamic structural development for SNNs incorporating constraints, pruning and regeneration based on BrainCog [English Version,Chinese Version]BrainCog Data Engine: Spatio-temporal Sequence Data N-Omniglot and Its Applications [English Version,Chinese Version]The Implement of Object Detection and Semantic Segmentation Based on SNNs with Braincog [English Version,Chinese Version]BrainCog Data EngineIn 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.DVSGestureThis dataset contains 11 hand gestures from 29 subjects under 3 illumination conditions recorded using a DVS128.DVSCIFAR10This dataset converts 10,000 frame-based images in the CIFAR10 dataset into 10,000 event streams using a dynamic vision sensor.NCALTECH101The 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 classES-ImageNetThe 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-OmniglotThis 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 exampleloader_train,loader_eval,_,_=get_dvsc10_data(batch_size=128,step=10)Requirements:python == 3.8CUDA toolkit == 11.numpy >= 1.21.2scipy >= 1.8.0h5py >= 3.6.0torch >= 1.10torchvision >= 0.12.0torchaudio  >= 0.11.0timm >= 0.5.4matplotlib >= 3.5.1einops >= 0.4.1thop >= 0.0.31pyyaml >= 6.0loris >= 0.5.3pandas >= 1.4.2tonicpandas >= 1.4.2xlrd == 1.2.0InstallInstall OnlineYou can install braincog by running:pip install braincogAlso, install from github by running:pip install git+https://github.com/braincog-X/Brain-Cog.gitInstall locallyIf you are a developer, it is recommanded to download or clone
braincog from github.git clone https://github.com/braincog-X/Brain-Cog.gitEnter the folder of braincogcd Brain-CogInstall braincog locallypip install -e .ExampleExamples for Image Classificationcd./examples/Perception_and_Learning/img_cls/bppythonmain.py--modelcifar_convnet--datasetcifar10--node-typeLIFNode--step8--device0Examples for Event Classificationcd./examples/Perception_and_Learning/img_cls/bppythonmain.py--modeldvs_convnet--node-typeLIFNode--datasetdvsc10--step10--batch-size128--act-funQGateGrad--device0Other BrainCog features and tutorials can be found athttp://www.brain-cog.network/docs/BrainCog AssistantPlease add our BrainCog Assitant via wechat and we will invite you to our wechat developer group.Publications Using BrainCogBrain Inspired AIPerception and LeanringPapersCodesPublisherQuantum superposition inspired spiking neural networkhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/QSNNCell iScienceBackpropagation with biologically plausible spatiotemporal adjustment for training deep spiking neural networkshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/img_cls/bpCell PatternsN-Omniglot, a large-scale neuromorphic dataset for spatio-temporal sparse few-shot learninghttps://github.com/BrainCog-X/Brain-Cog/tree/main/braincog/datasets/NOmniglotScientific DataEfficient and Accurate Conversion of Spiking Neural Network with Burst Spikeshttps://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Perception_and_Learning/Conversion/converted_CIFAR10.pyIJCAI 2022BackEISNN: A deep spiking neural network with adaptive self-feedback and balanced excitatory–inhibitory neuronshttps://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Perception_and_Learning/img_cls/bp/main_backei.pyNeural NetworksSpiking CapsNet: A spiking neural network with a biologically plausible routing rule between capsuleshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/img_cls/spiking_capsnetInformation SciencesMultisensory Concept Learning Framework Based on Spiking Neural Networkshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/MultisensoryIntegrationFrontiers in Systems NeuroscienceGLSNN: A Multi-Layer Spiking Neural Network Based on Global Feedback Alignment and Local STDP Plasticityhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/img_cls/glsnnFontiers in Computational NeuroscienceEventMix: An Efficient Augmentation Strategy for Event-Based Datahttps://github.com/BrainCog-X/Brain-Cog/blob/main/braincog/datasets/cut_mix.pyArxivSpike Calibration: Fast and Accurate Conversion of Spiking Neural Network for Object Detection and Segmentationhttps://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Perception_and_Learning/Conversion/converted_CIFAR10.pyArxivAn Unsupervised Spiking Neural Network Inspired By Biologically Plausible Learning Rules and Connectionshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Perception_and_Learning/UnsupervisedSTDPArxivSocial CognitionPapersCodesPublisherToward Robot Self-Consciousness (II): Brain-Inspired Robot Bodily Self Model for Self-Recognitionhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/mirror_testCognitive ComputationA brain-inspired intention prediction model and its applications to humanoid robothttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/Intention_PredictionFrontiers in NeuroscienceA Brain-Inspired Theory of Mind Spiking Neural Network for Reducing Safety Risks of Other Agentshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/ToMFrontiers in NeuroscienceBrain-Inspired Affective Empathy Computational Model and Its Application on Altruistic Rescue Taskhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/affective_empathy/BAE-SNNFrontiers in Computational NeuroscienceA brain-inspired robot pain model based on a spiking neural networkhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/affective_empathy/BRP-SNNFrontiers in NeuroroboticsBrain-Inspired Theory of Mind Spiking Neural Network Elevates Multi-Agent Cooperation and Competitionhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/MAToM-SNNSSRNKnowledge Representation and ReasoningPapersCodesPublisherA Brain-Inspired Causal Reasoning Model Based on Spiking Neural Networkshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/CRSNNIJCNN2021Brain Inspired Sequences Production by Spiking Neural Networks With Reward-Modulated STDPhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/SPSNNFrontiers in Computational NeuroscienceTemporal-Sequential Learning With a Brain-Inspired Spiking Neural Network and Its Application to Musical Memoryhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/musicMemoryFrontiers in Computational NeuroscienceBrain-Inspired Affective Empathy Computational Model and Its Application on Altruistic Rescue Taskhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/musicMemoryFrontiers in System NeuroscienceStylistic Composition of Melodies Based on a Brain-Inspired Spiking Neural Networkhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Social_Cognition/affective_empathy/BRP-SNNFrontiers in NeuroroboticsBrain-inspired Graph Spiking Neural Networks for Commonsense Knowledge Representation and Reasoninghttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Knowledge_Representation_and_Reasoning/CKRGSNNArxivDecision MakingPapersCodesPublisherNature-inspired self-organizing collision avoidance for drone swarm based on reward-modulated spiking neural networkhttps://github.com/BrainCog-X/Brain-Cog/blob/main/examples/decision_making/swarm/Collision-Avoidance.pyCell PatternsSolving the spike feature information vanishing problem in spiking deep Q network with potential based normalizationhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/decision_making/RL/sdqnFrontiers in NeuroscienceA Brain-Inspired Decision-Making Spiking Neural Network and Its Application in Unmanned Aerial Vehiclehttps://github.com/BrainCog-X/Brain-Cog/blob/main/examples/decision_making/BDM-SNN/BDM-SNN-hh.pyFrontiers in NeuroroboticsMulti-compartment Neuron and Population Encoding improved Spiking Neural Network for Deep Distributional Reinforcement Learninghttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/decision_making/RL/mcs-fqfArxivMotor ControlPapersCodesPublisherhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/MotorControl/experimentalSNN SafetyPapersCodesPublisherDPSNNhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Snn_safety/DPSNNArxivDevelopment and EvolutionPapersCodesPublisherDevelopmental Plasticity-inspired Adaptive Pruning for Deep Spiking and Artificial Neural Networkshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Structural_Development/DPAPArxivAdaptive Sparse Structure Development with Pruning and Regeneration for Spiking Neural Networkshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Structural_Development/SD-SNNArxivHardware AccelerationPapersCodesPublisherFireFly: A High-Throughput and Reconfigurable Hardware Accelerator for Spiking Neural Networkshttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Hardware_accelerationArxivBrain SimulationFuntionPapersCodesPublisherA neural algorithm for Drosophila linear and nonlinear decision-makinghttps://github.com/BrainCog-X/Brain-Cog/blob/main/examples/Brain_Cognitive_Function_Simulation/drosophila/drosophila.pyScientific ReportsComparison Between Human and Rodent Neurons for Persistent Activity Performance: A Biologically Plausible Computational Investigationhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/Human_PFC_ModelFrontiers in System NeuroscienceStructurePapersCodesPublisherCorticothalamic minicolumnhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumnHuman Brainhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/HumanBrainMacaque Brainhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/MacaqueBrainMouse Brainhttps://github.com/BrainCog-X/Brain-Cog/tree/main/examples/Multiscale_Brain_Structure_Simulation/Mouse_brain