A pulse neural network model construction method for task incremental learning
By masking the membrane voltage and pulses of the spiking neural network in task incremental learning, an independent task model is constructed, which solves the catastrophic forgetting problem and improves the classification accuracy and stability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAZHONG UNIV OF SCI & TECH
- Filing Date
- 2024-06-20
- Publication Date
- 2026-06-26
Smart Images

Figure CN118821870B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of incremental learning technology, and more specifically, relates to a method for constructing a spiking neural network model for task incremental learning. Background Technology
[0002] Spiking neural networks (SNNs) are neural networks that simulate the structure of real neurons, encoding information by mimicking the action potentials of neurons. Instead of analog values, SNNs use binary pulses to represent spatiotemporal information through pulse sequences. The gated parametric neuron (GPN) disclosed in patent application CN117009866A is a high-performance SNN capable of effectively processing time-complex sequential data. Multiple experiments have demonstrated the effectiveness of GPN in mitigating gradient vanishing.
[0003] Incremental learning is a learning method that simulates the continuous learning and evolutionary process of organisms. Unlike classic machine learning scenarios, incremental learning data arrives in batches over time. This scenario design is similar to real-world scenarios and puts greater emphasis on the algorithm's memory capacity. Task-based incremental learning is a type of incremental learning where the model needs to learn a series of different tasks sequentially, knowing which task group (i.e., task number) the current data comes from. For a classification task with a total number of categories C, it can be broken down into N subtasks, each performing a classification task of C / N categories. Within each subtask, the model knows the current task number.
[0004] In incremental task learning scenarios, spiking neural networks composed of generalized network neurites (GPNs) suffer from catastrophic forgetting, meaning that the performance of GPNs on older tasks degrades significantly when learning new tasks. While there are mature solutions for catastrophic forgetting based on regularization, replay, and structure, the XdG (Context-dependent Gating) algorithm, as a structure-based approach, can effectively address catastrophic forgetting when directly applied to Integrate-and-Fire (IF) or Leaky Integrate-and-Fire (LIF) spiking neurons. However, when combined with GPN spiking neurons, it fails to alleviate the catastrophic forgetting phenomenon in spiking neural networks, resulting in low classification accuracy and an inability to handle complex incremental task learning. Summary of the Invention In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides a method for constructing a spiking neural network model for task incremental learning, which aims to alleviate the catastrophic forgetting problem of spiking neural networks in task incremental learning, so as to improve the classification accuracy of the model. To achieve the above objectives, according to a first aspect of the present invention, a method for constructing a spiking neural network model for task incremental learning is provided, comprising: using a task incremental learning dataset with classification labels as input, and using task classification results as output to train the spiking neural network to converge, thereby obtaining a trained spiking neural network model; The nth gated parameter neuron layer of the spiking neural network includes: The synaptic current calculation unit is used to calculate the shielded pulse 𝒙̂𝑡 of the input neuron at time t based on the shielded pulse 𝒔̂𝑡𝑙−1 emitted by the previous gated parameter neuron layer at time t. Calculate the synaptic current of the input neuron at time t.
[0005] The mask generation unit is used to randomly generate a mask for each task in the incremental learning process. k represents the task number of the current task; where... The length is consistent with the number of neurons in the l-th gating parameter neuron layer;
[0006] The shielded membrane voltage calculation unit is used to calculate the shielding mask. The membrane voltage v of the neuron at time t t Multiplying these yields the membrane voltage at time t after shielding.
[0007] Pulse delivery module, used for... and The obtained gating value is used to calculate the hidden state membrane voltage h. t To determine whether the neuron fires a pulse s at time t. t ;
[0008] The shielded pulse calculation unit is used to calculate the shielded pulse emitted at time t. And The signal is passed to each neuron in the next layer of gating parameters to calculate the shielded pulses emitted by each neuron in the next layer; where ⊙ represents element-wise multiplication.
[0009] Furthermore, the pulse delivery module includes:
[0010] The gate value calculation unit is used for calculating the gate value based on... and Calculate the output value of the corresponding logic gate at time t; wherein, the logic gate includes a forget gate. Input gate Threshold gate and bypass doors
[0011] The hidden membrane voltage calculation unit is used to calculate the hidden membrane voltage h of the neuron at time t. t :
[0012]
[0013] in, and This represents the output values of the forget gate and the input gate;
[0014] Pulse delivery unit, used to deliver pulse s t , Where ∈(·) is the step function; Indicates the output value of the threshold gate; when At that time, s t =1 indicates pulse delivery; otherwise s t =0 indicates that no pulse is emitted.
[0015] Furthermore, the formula for calculating the output value of the logic gate is as follows:
[0016]
[0017] in, for or Correspondingly, for or for or and These are the membrane voltage weight matrix and synaptic current weight matrix for the corresponding logic gates, respectively, obtained by training the spiking neural network; σ is the activation function.
[0018] Furthermore, the forget gate, input gate, and threshold gate use the Sigmoid function, while the bypass gate uses the Tanh activation function.
[0019] Furthermore, it also includes: a membrane voltage calculation unit for the next time step, used to calculate the membrane voltage v of the neuron at time t+1. t+1 The calculation formula is:
[0020]
[0021] Among them, v reset The preset reset voltage, This is the output value of the bypass gate.
[0022] Furthermore, the synaptic current for:
[0023]
[0024] Among them, W l-1 The synaptic weight matrix of the (l-1)th gating parameter neuron layer is obtained by training the spiking neural network.
[0025] Furthermore, the task incremental learning dataset is audio or image pulse data.
[0026] According to a second aspect of the present invention, a task incremental learning method is provided, comprising: inputting different tasks into a trained spiking neural network model to obtain task classification results;
[0027] The spiking neural network model is constructed using the spiking neural network model construction method for task incremental learning described in any one of the first aspects.
[0028] According to a third aspect of the present invention, an electronic device is provided, including a computer-readable storage medium and a processor;
[0029] The computer-readable storage medium is used to store executable instructions;
[0030] The processor is configured to read executable instructions stored in the computer-readable storage medium to execute the spiking neural network model construction method for task incremental learning as described in any of the first aspects, and / or execute the task incremental learning method as described in the second aspect.
[0031] According to a fourth aspect of the invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method for constructing a spiking neural network model for task incremental learning as described in any of the first aspects, or / and implements the task incremental learning method as described in the second aspect.
[0032] In summary, the above-described technical solutions conceived in this invention can achieve the following beneficial effects:
[0033] (1) The spiking neural network model construction method and task incremental learning method of the present invention consider that the spiking neural network based on gated parameter neurons (GPN) has both temporal and spatial paths. GPN neurons utilize the states of all neurons in the current layer in time, causing changes in the internal state of a single neuron to affect all neurons in that layer. However, while the XdG algorithm can mask the neuron output in the spatial path, it cannot mask the internal connections of neurons in the temporal path. Therefore, directly using the XdG algorithm to only mask the external output of neurons cannot achieve true masking of the spiking neural network based on gated parameter neurons (GPN), resulting in the continued existence of catastrophic forgetting. Based on this, the present invention randomly generates a masking mask for each task in task incremental learning. The membrane voltage v of the neuron at the current moment is obtained by using the corresponding masking mask. t and the pulses s fired by neurons t Shielding is performed to block out certain fixed neurons, while the membrane voltage v t This reflects the temporal changes of neurons, representing the temporal pathway of GPN neurons, and the firing pulses s. t The spatial variations of neurons represent the spatial pathways of GPN neurons, the output values of different logic gates, and the hidden membrane voltage h. t All based on the membrane voltage after shielding The shielded pulse calculation enables complete shielding between GPN neurons in both time and space. After shielding, different neurons are activated for different tasks, so that each task has a relatively independent model, reducing mutual interference between tasks, alleviating catastrophic forgetting, and thus improving task classification accuracy. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the GPN spiking neural network model construction method in an embodiment of the present invention. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0036] Example 1
[0037] like Figure 1 As shown, the method for constructing a spiking neural network model for incremental task learning in this embodiment of the invention includes:
[0038] The task incremental learning dataset with classification labels is used as input, and the task classification result is used as output to train the spiking neural network to make the spiking neural network converge, thus obtaining a trained spiking neural network model. The task incremental learning dataset can be audio or image data, and the spiking neural network model is used to classify audio or image data. Preferably, an audio or image spiking dataset is selected.
[0039] A spiking neural network comprises multiple layers of gated parameter neurons; wherein the l-th layer of gated parameter neurons includes:
[0040] The synaptic current calculation unit is used to calculate the synaptic current of the input neuron at time t. The synaptic current The shielded pulse emitted by the gated parameter neuron layer at time t The weighted calculation yields the following formula:
[0041]
[0042] Among them, W l-1 This represents the synaptic weight matrix of the (l-1)th gating parameter neuron layer, obtained through model training. In this embodiment of the invention, all bolded parameters are in vector form, representing the parameters corresponding to each neuron.
[0043] The mask generation unit is used to randomly generate a mask for each task in the incremental learning process. k represents the task number of the current task, where k can be 1, 2, ..., N, and l represents the l-th gating parameter neuron layer. The length is consistent with the number of neurons in the l-th gating parameter neuron layer;
[0044] The shielded membrane voltage calculation unit is used to calculate the shielding mask for the current task. The membrane voltage v of the neuron at time t t Multiplying these yields the membrane voltage at time t after shielding.
[0045]
[0046] Where Θ represents element-wise multiplication.
[0047] In this invention, at the start of network learning, a mask is randomly generated with the same number of tasks as the number of tasks. Once generated, the mask is fixed, and the same mask is used for each training round for the corresponding task. After being fixed, it can be ensured that the structure of each task model is fixed, and only the corresponding weight matrix is trained.
[0048] In this embodiment of the invention, the length of the mask vector corresponding to each task is consistent with the number of neurons in each layer. Different layers of neurons have different mask vectors to partially mask the GPN neurons. In practical applications, a gating ratio can be set to activate different or the same proportion of neurons for each task. In this embodiment, taking 5 tasks as an example, the gating ratio is 0.8, meaning each task activates 20% of the neurons. In other embodiments, different proportions of neurons can be activated for each task, with all tasks activating 100% of the neurons.
[0049] The gate value calculation unit is used to calculate the membrane voltage after shielding at time t. and the synaptic current input to the neuron at time t Calculate the output value of the corresponding logic gate at time t; where the logic gate includes the forget gate. Input gate Threshold gate and bypass doors Specifically, the formula for calculating the output value of each logic gate is as follows:
[0050]
[0051] Where J can be F, I, T, or B, i.e. for or Correspondingly, for or for or and These are the membrane voltage weight matrix and synaptic current weight matrix for the corresponding logic gates, obtained through model training; σ is the activation function. In this invention, the forget gate, input gate, and threshold gate use the Sigmoid function, and the bypass gate uses the Tanh function.
[0052] The hidden membrane voltage calculation unit is used to calculate the hidden membrane voltage h of the neuron at time t. t :
[0053]
[0054] in, and This represents the output values of the forget gate and the input gate.
[0055] Pulse delivery unit, used to deliver pulse s t Based on the hidden membrane voltage h of the neuron at time t t Determine whether the neuron fires a pulse s at time t. t ;when At that time, st =1 pulse output; otherwise s t =0 No pulse is emitted:
[0056]
[0057] Where ∈(·) is the step function; This represents the output value of the threshold gate.
[0058] In this embodiment of the invention, the gate value calculation unit and the hidden state membrane voltage h are included. t The calculation unit and the pulse emission unit together constitute the pulse emission module.
[0059] The next time step membrane voltage calculation unit is used to calculate the membrane voltage v of the neuron at time t+1. t+1 When a neuron fires a pulse s t When = 1, the membrane voltage v of the neuron at the next moment t+1 via v reset Reset and add a bypass door. The output value, v reset The preset reset voltage; otherwise, s t When = 0, the hidden state membrane voltage h is retained. t And add a bypass door The output value is calculated using the following formula:
[0060]
[0061] The masked pulse calculation unit is used to apply the masking mask of the current task. The pulses s fired by the neurons t By performing shielding, the shielded pulses emitted by the current layer's gated neuron layer at time t are obtained. And the shielded pulse The signal is passed to each neuron in the next layer of gated parameter neurons to calculate the masked pulses emitted by the neurons in the next layer; where the masked pulses... The calculation formula is:
[0062]
[0063] During the training process, the spiking neural network is trained with the goal of minimizing the feature loss between the task classification result and the classification label. The weight matrices of the network are then updated in reverse to make the spiking neural network converge, resulting in a well-trained spiking neural network model.
[0064] Example 2
[0065] This invention provides a task incremental learning method, wherein the task incremental learning process includes N tasks, and the method includes:
[0066] Different tasks are input into a trained spiking neural network model to obtain task classification results; wherein, the spiking neural network model is constructed using the method in Example 1. The task to be classified can be audio or image data.
[0067] Specifically, the spiking neural network performs the following computational operations when learning the k-th task:
[0068] Calculate the synaptic current of the input neuron at time t.
[0069] For each task in the incremental learning process, a mask is randomly generated. For the current task, the mask is... The membrane voltage v of the neuron at time t t Multiplying these yields the shielded membrane voltage at time t.
[0070] Based on the membrane voltage after shielding at time t and the synaptic current input to the neuron at time t Calculate the output value of the corresponding logic gate at time t; where the logic gate includes the forget gate. Input gate Threshold gate and bypass doors
[0071] Calculate the hidden membrane voltage h of the neuron at time t. t :
[0072] Based on the hidden membrane voltage h of the neuron at time t t Determine whether the neuron fires a pulse s at time t. t ; Calculate the membrane voltage v of the neuron at time t+1. t+1 :
[0073] Use the mask of the current task The pulses s fired by the neurons t By performing shielding, the shielded pulses emitted by the current layer's gated neuron layer at time t are obtained. And the shielded pulse The signal is passed to each neuron in the next layer of gating parameters to calculate the shielded pulses emitted by the next layer of neurons.
[0074] For specific steps, please refer to the description of the corresponding computing unit in Example 1, which will not be repeated here.
[0075] The present invention provides a method for constructing a spiking neural network model and a method for incremental task learning. Considering that spiking neural networks based on gated parameter neurons (GPNs) have both temporal and spatial paths, GPN neurons utilize the states of all neurons in their layer temporally, meaning that changes in the internal state of one neuron can affect all neurons in that layer. However, while the XdG algorithm can mask neuron outputs spatially, it cannot mask internal neuron connections temporally. Therefore, directly using the XdG algorithm to only mask external neuron outputs cannot achieve true masking of GPN-based spiking neural networks, resulting in catastrophic forgetting. Based on this, the present invention randomly generates a masking mask for each task in incremental task learning. The membrane voltage v of the neuron at the current moment is obtained by using the corresponding masking mask. t and the pulses s fired by neurons t Shielding is performed to block out certain fixed neurons, while the membrane voltage v t This reflects the temporal changes of neurons, representing the temporal pathway of GPN neurons, and the firing pulses s. t The spatial variations of neurons represent the spatial pathways of GPN neurons, the output values of different logic gates, and the hidden membrane voltage h. t All based on the membrane voltage after shielding The shielded pulse calculation enables complete shielding between GPN neurons in both time and space. After shielding, different neurons are activated for different tasks, so that each task has a relatively independent model, reducing mutual interference between tasks, alleviating catastrophic forgetting, and thus improving task classification accuracy.
[0076] Example 3
[0077] This invention provides an electronic device, including a computer-readable storage medium and a processor;
[0078] Computer-readable storage media are used to store executable instructions;
[0079] The processor is used to read executable instructions stored in a computer-readable storage medium to execute the spiking neural network model construction method for task incremental learning in Embodiment 1, and / or execute the task incremental learning method in Embodiment 2. Related technical solutions are described in the corresponding descriptions of Embodiments 1 and 2, and will not be repeated here.
[0080] Example 4
[0081] This invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method for constructing a spiking neural network model for task incremental learning as described in Embodiment 1, and / or the task incremental learning method as described in Embodiment 2. Related technical solutions are described in the corresponding descriptions of Embodiments 1 and 2, and will not be repeated here.
[0082] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for constructing a spiking neural network model for incremental task learning, characterized in that, include: The task incremental learning dataset with classification labels is used as input, and the task classification result is used as output to train the spiking neural network so that the spiking neural network converges, thus obtaining a trained spiking neural network model. The incremental learning dataset for the task is audio or image data, and the spiking neural network model is used to classify the audio or image data; the spiking neural network's first... Layer-gated parameterized neuron layers include: The synaptic current calculation unit is used to calculate the shielded pulse emitted by the previous layer of gated neurons at time t. Calculate the synaptic current of the input neuron at time t. ; The mask generation unit is used to randomly generate a mask for each task in the incremental learning process. , ∈{0,1}, This indicates the task number of the current task; where, Length and the The number of neurons in each layer of the layer-gated parameter neurons is consistent. The shielded membrane voltage calculation unit is used to calculate the shielding mask. The membrane voltage of the neuron at time t Multiplying these yields the membrane voltage at time t after shielding. ; Pulse delivery module, used for... and The obtained gating value is used to calculate the hidden state voltage. To determine whether the neuron fires a pulse at time t. ; The shielded pulse calculation unit is used to calculate the shielded pulse emitted at time t. , ; and will This information is passed to each neuron in the next layer of gated parameter neurons to calculate the masked pulses emitted by each neuron in the next layer; among which, This is for element-wise multiplication.
2. The method for constructing a spiking neural network model for incremental task learning according to claim 1, characterized in that, The pulse delivery module includes: The gate value calculation unit is used for calculating the gate value based on... and Calculate the output value of the corresponding logic gate at time t; wherein, the logic gate includes a forget gate. Input gate Threshold gate and bypass doors ; The hidden membrane voltage calculation unit is used to calculate the hidden membrane voltage of the neuron at time t. : in, and This represents the output values of the forget gate and the input gate; Pulse delivery unit, used to deliver pulses , ;in, It is a step function; Indicates the output value of the threshold gate; when hour, , indicates pulse delivery; otherwise , indicating that no pulse is emitted.
3. The method for constructing a spiking neural network model for incremental task learning according to claim 2, characterized in that, The formula for calculating the output value of the logic gate is as follows: in, for , , or Correspondingly, for , , or , for , , or ; and These are the membrane voltage weight matrix and synaptic current weight matrix for the corresponding logic gates, obtained through training the spiking neural network. This is the activation function.
4. The method for constructing a spiking neural network model for incremental task learning according to claim 3, characterized in that, The forget gate, input gate, and threshold gate use the Sigmoid function, while the bypass gate uses the Tanh activation function.
5. The method for constructing a spiking neural network model for incremental task learning according to any one of claims 2-4, characterized in that, Also includes: The next time step membrane voltage calculation unit is used to calculate the membrane voltage of the neuron at time t+1. The calculation formula is: in, The preset reset voltage, This is the output value of the bypass gate.
6. The method for constructing a spiking neural network model for incremental task learning according to claim 1, characterized in that, The synaptic current for: in, For the first The synaptic weight matrix of the layer-gated parameter neuron layer is obtained by training the spiking neural network.
7. A task incremental learning method, characterized in that, include: Different tasks are input into a trained spiking neural network model to obtain task classification results; The spiking neural network model is constructed using the spiking neural network model construction method for task incremental learning as described in any one of claims 1-6.
8. An electronic device, characterized in that, Includes computer-readable storage media and processors; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium to execute the spiking neural network model construction method for task incremental learning as described in any one of claims 1-6, or / and to execute the task incremental learning method as described in claim 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for constructing a spiking neural network model for task incremental learning as described in any one of claims 1-6, or / and implements the task incremental learning method as described in claim 7.