A training method for a spiking neural network based on a self-recurrent neuron model
Through the pulse neural network training method of the self-falling neuron model, the calculation and storage consumption problems caused by the increase in pulse frequency are solved by limiting the pulse excitation conditions and amplitude, and efficient pulse neural network training is achieved, improving the accuracy and efficiency of the neural network.
Patent Information
- Application Number
- CN202211419727.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-11-14
AI Technical Summary
With the complexity of the pulse neural network, the pulse transmission frequency increases, resulting in increased computing and storage consumption, reducing the accuracy and working efficiency of the neural network.
The self-falling neuron model is used to trigger pulse excitation only when the neuron membrane voltage exceeds the initial threshold and starts to decay, and the pulse amplitude is determined by the ratio of the membrane voltage to the initial threshold, setting the maximum excitation upper limit of the pulse, and training the pulse neural network with the error backpropagation algorithm.
The number of pulse excitation is reduced, sparse pulse sequences are obtained, storage resources and calculation consumption are saved, and the accuracy and efficiency of the neural network are improved.
Smart Images

Figure CN115660072B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of spiking neural networks, and particularly to a training method for a spiking neural network based on a self-resetting neuron model. Background Art
[0002] With the development of neural networks, spiking neural networks have low energy consumption and stronger parallel capabilities, and can accelerate the operation efficiency on dedicated neuromorphic computing platforms, thus being widely applied. However, with the complication of the network structure, the spike emission frequency also increases sharply, resulting in more computational and storage consumption. At the same time, the redundant spike sequence may reduce the working efficiency of the neural network.
[0003] The LIF neuron is the most commonly used neuron at present, and the shape of the action potential does not need to be deliberately described. In order to obtain the relationship between the instantaneous voltage and the input current, the basic electrical theory is used to explain this problem. When the membrane voltage rises to the threshold, an action potential will be induced to generate a spike. In the absence of input, the membrane potential will exponentially decay to the resting potential. With the increase in the network structure and the number of pre-neurons, it will lead to the rapid accumulation of the membrane voltage of the post-neuron. Due to the relatively single spike triggering mechanism of conventional neurons, the spike excitation frequency will increase sharply and form a redundant spike sequence, causing the neuron to process too much information and even update to an incorrect neuron state.
[0004] Chinese Patent CN114037047A discloses a training method for a spiking neural network, specifically converting a target convolutional neural network into an initial spiking neural network and training the initial spiking neural network in both the time domain and the space domain, solving the problem of the long time step required for a single forward inference. However, obtaining a spiking neural network using the conversion method is restricted by aspects such as the accuracy and results of the artificial neural network, and the training cost is high.
[0005] Chinese Patent CN113255905A discloses a signal processing method for neurons in a spiking neural network and a training method for this network, specifically introducing a multi-spike mechanism into the signal processing of neurons and adding techniques such as suppressing the neuron activity degree as a loss to achieve efficient training of the spiking neural network. Although a self-learning training method is used and the multi-spike mechanism is introduced, this mechanism leads to an increase in the number of spikes. At the same time, different loss calculations are added, and under the combined action of these two mechanisms, it will lead to additional computational consumption in the network. Summary of the Invention
[0006] The object of the present invention is to solve the problem that with the complication of existing spiking neural networks, the spiking emission frequency increases, resulting in more computational and storage consumption, and reducing both the accuracy and working efficiency of the neural network. Thus, a training method for a spiking neural network based on a self-falling neuron model is provided.
[0007] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0008] A training method for a spiking neural network based on a self-falling neuron model, characterized in that it includes the following steps:
[0009] Step 1: Collect and preprocess the original image, set the structural parameters of the spiking neural network, and establish the spiking neural network;
[0010] The spiking neural network includes several layers, and each layer includes at least one neuron;
[0011] Step 2: Use the neurons in the spiking neural network to encode the preprocessed original image to generate a spike train, and then perform signal processing to generate a new spike train;
[0012] The signal processing of the neuron on the encoded spike train specifically includes a reception period, an accumulation period, and an activation period; the reception period is: at least one neuron receives the preprocessed spike train or the spike train output by the upper-layer neuron; the accumulation period is: the neuron calculates the sum based on its own membrane voltage and the received spike train, and updates the current membrane voltage of the neuron; the activation period is: set an initial firing threshold, observe the state of the current membrane voltage of the neuron, and when it meets the firing condition, trigger the neuron to emit a spike;
[0013] The firing condition of the neuron is: within a single simulation time step, the change state of the current membrane voltage of the neuron simultaneously satisfies: ① the current membrane voltage exceeds the initial firing threshold; ② the current membrane voltage is lower than the membrane voltage of the neuron at the previous moment;
[0014] Step 3: Complete the forward transmission of the neural network, calculate the error between the predicted value and the target value of the spiking neural network using the loss function, and obtain the loss of the spiking neural network;
[0015] Step 4: Train the spiking neural network using the error backpropagation algorithm according to the loss of the spiking neural network;
[0016] Step 5: Set the accuracy threshold of the spiking neural network. When the loss of the spiking neural network is less than or equal to the accuracy threshold Q, end the training; otherwise, adjust the structure or structural parameters of the spiking neural network, return to Step 2, and retrain the spiking neural network until a spiking neural network that meets the accuracy requirements is obtained.
[0017] Furthermore, during the activation period of step 2, the amplitude of the neuron excitation pulse is determined by the ratio of the current membrane voltage to the initial excitation threshold;
[0018] The output o of the neuron in layer n+1 at time t t,n+1 It is expressed as:
[0019]
[0020] Among them, V th represents the initial excitation threshold; u t,n+1 represents the current membrane voltage of the neuron in layer n+1 at time t; u t -1,n+1 Represents the membrane voltage of the n+1th layer neuron at time t-1.
[0021] Furthermore, in step 2, the amplitude of the neuron excitation pulse is the value rounded down by the Gaussian function of the ratio of the current membrane voltage to the initial excitation threshold, or the value rounded up by the Gaussian function of the ratio, or the linear transformation or nonlinear transformation of the rounded value.
[0022] Furthermore, step 2 also includes setting a maximum excitation upper limit of the pulse during the activation period to limit excessive increase of the pulse, take into account the requirements of time and space, and improve the utilization rate of its pulse sequence; the amplitude of the neuron excitation pulse is the smaller value of the ratio of the current membrane voltage to the initial excitation threshold and the set maximum excitation upper limit of the pulse.
[0023] Furthermore, during the accumulation period of step 2, the current membrane voltage u of the n+1th layer neuron at time t is t,n+1 It is expressed as:
[0024] u t,n+1 =γu t-1,n+1 (1-o t-1,n+1 )+w n o t,n-1
[0025] Where, γ represents the time constant; u t-1,n+1 represents the current membrane voltage of the neuron in the n+1th layer at time t-1; o t -1,n+1 represents the output of the n+1th layer neuron at time t-1; w n Represents the network weights of the n-th layer neurons.
[0026] Furthermore, in step 3, the loss function is the mean square error between the predicted value of the spiking neural network and the target value of the spiking neural network, which is expressed as:
[0027]
[0028] Among them, x i represents the predicted value of the i-th neuron in the last layer of the spiking neural network; y represents the target value of the spiking neural network; N represents the number of neurons in the last layer of the spiking neural network, that is, the number of categories that the neural network needs to classify.
[0029] Furthermore, in step 4, the surrogate gradient function is used for backpropagation in the error backpropagation algorithm to adjust the weights of the spiking neural network;
[0030] The surrogate gradient function h(u) is expressed as:
[0031]
[0032] where u represents the membrane voltage of the final output neuron; sign() represents the sign function; a is a parameter that determines the sharpness of the curve; V th represents the initial firing threshold.
[0033] Furthermore, the parameter a that determines the sharpness of the curve is a = 1.
[0034] Furthermore, in step 2, the maximum firing limit of the pulse is 3; in step 5, Q = 0.1.
[0035] Furthermore, step 1 is specifically:
[0036] 1.1. Fill the original image into a square with a filling size of 4;
[0037] 1.2. Randomly crop the filled image;
[0038] 1.3. Randomly horizontally flip the cropped image with a probability of 0.5;
[0039] 1.4. Scale the cropped image proportionally so that it falls within the interval [0, 1];
[0040] 1.5. Set the structural parameters of the spiking neural network, including the hyperparameter learning rate of 0.001 and the initial firing threshold of 0.5. Various factor conditions such as the learning rate decay strategy can be freely selected.
[0041] Compared with the prior art, the beneficial technical effects of the present invention are as follows:
[0042] 1. The training method of the spiking neural network based on the self-falling neuron model provided by the present invention is for a spiking neural network composed of neurons. Only when the membrane voltage of the neuron exceeds the initial threshold and its membrane voltage begins to decay, that is, when the membrane voltage of the neuron model itself falls back, will a pulse be triggered to reduce the number of emitted pulses and simplify the pulse sequence. At the same time, the pulse excitation is a highly variable pulse. After the membrane voltage meets the excitation condition, the final pulse amplitude will be determined based on the ratio of the self-membrane voltage to the initial threshold, thus making up for the accuracy loss caused by the reduction of pulses.
[0043] 2. The training method of the spiking neural network based on the self-falling neuron model provided by the present invention is used to process the control and transmission process of information. Under the action of neurons, the number of neuron pulse excitations in the network will be greatly reduced. The obtained sparser pulse sequence saves a large amount of storage resources and computational consumption. At the same time, a new type of neuron is used to construct a spiking neural network and train it.
[0044] 3. In the training method of the spiking neural network based on the self-falling neuron model of the present invention, the way neurons process data adopts a pulse excitation mechanism different from that of existing neural networks. Usually, when the membrane voltage exceeds the threshold, a pulse is excited. However, in the present invention, it is set that the membrane voltage of the neuron exceeds the initial threshold and keeps increasing until the membrane voltage decays before a pulse is excited, greatly reducing the generation of pulses and significantly reducing the computational consumption.
[0045] 4. In the training method of the spiking neural network based on the self-falling neuron model of the present invention, the way neurons process data adopts a pulse pattern different from that of existing neural networks. Usually, when the membrane voltage exceeds the threshold, a binary 01 pulse is excited. In the present invention, it is set that the amplitude of the pulse excited when the membrane voltage of the neuron exceeds the initial threshold is determined by the ratio of the membrane voltage to the initial threshold. At the same time, the maximum excitation limit of the pulse is set to limit the excessive increase of the pulse, taking into account the requirements of time and space while increasing the pulse information representation ability and improving the utilization rate of its pulse sequence. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic structural diagram of the spiking neural network in the embodiment of the spiking neural network based on neurons of the present invention;
[0047] Figure 2 It is a schematic diagram of the principle of the neuron pulse excitation mechanism in the embodiment of the present invention;
[0048] Figure 3 It is a flowchart of the training method of the spiking neural network based on the self-falling neuron model of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0049] To make the objectives, advantages, and features of the present invention clearer, the following further elaborates in detail on a training method for a spiking neural network based on a self-falling neuron model proposed by the present invention in combination with the accompanying drawings and specific embodiments. Those skilled in the art should understand that these implementation manners are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0050] This embodiment takes a neural network for identifying the Fashion-MNIST dataset as an example to illustrate the present invention. As Figure 1 shown, the spiking neural network based on the new neuron includes an encoding layer, a first downsampling layer, a convolutional layer, a second downsampling layer, a first fully connected layer, and a second fully connected layer connected in sequence. Each layer of the neural network contains at least one neuron. The encoding layer is used to receive the original data and encode it to obtain a pulse sequence. The convolutional layer is used to extract the feature information of the picture. Both the first downsampling layer and the second downsampling layer reduce the computational amount by taking the average value of the feature points in the neighborhood. The first fully connected layer and the second fully connected layer are both used to realize the learning of the neural network. If a more complex classification task needs to be performed, the number of network layers and the number of neurons in each layer can be changed according to one's own experience to adapt to more complex data processing tasks.
[0051] Training the above spiking neural network specifically includes the following steps:
[0052] Step 1: Collect and receive the original data and perform preprocessing, set the structural parameters of the spiking neural network, and establish the spiking neural network;
[0053] In order to increase the noise data and improve the robustness and generalization ability of the model, the following preprocessing is performed on the original dataset:
[0054] 1.1. Fill the original image into a square with a filling size of 4;
[0055] 1.2. Randomly crop the filled image;
[0056] 1.3. Randomly horizontally flip the cropped image with a certain probability (set to 0.5);
[0057] 1.4. Perform normalization processing (Normalization) on each channel of the cropped image, that is, scale the cropped image proportionally so that it falls into a specific interval, such as the [0, 1] interval;
[0058] 1.5. Set the structural parameters of the spiking neural network: the initial firing threshold is 0.5, the maximum firing limit of the pulse is 3, and the hyperparameter learning rate is 0.001. Various factor conditions such as the learning rate decay strategy can be freely selected.
[0059] Step 2: Use the neurons in the spiking neural network to encode the preprocessed original image to generate a spike train, and then perform signal processing to generate a new spike train;
[0060] The signal processing of the neuron is specifically as follows:
[0061] Receiving period: At least one neuron receives the preprocessed spike train or the spike train output by the upper-layer neuron;
[0062] Accumulation period: The neuron calculates the sum based on its own membrane voltage and the received spike train, and updates the current membrane voltage of the neuron;
[0063] The current membrane voltage u of the (n + 1)-th layer neuron at time t during the accumulation period t,n+1 is expressed as:
[0064] u t,n+1 = γu t-1,n+1 (1 - o t-1,n+1 ) + w n o t,n-1
[0065] where γ represents the time constant; u t-1,n+1 represents the current membrane voltage of the (n + 1)-th layer neuron at time t - 1; o t -1,n+1 represents the output of the (n + 1)-th layer neuron at time t - 1; w n represents the network weight of the n-th layer.
[0066] Activation period: Set an initial firing threshold, observe the state of the current membrane voltage of the neuron, and when it meets the firing condition, trigger the neuron to emit a spike;
[0067] The firing condition of the neuron is: within a single simulation time step, the change state of the current membrane voltage of the neuron simultaneously satisfies: whether the current membrane voltage exceeds the initial threshold, and the current membrane voltage is lower than the membrane voltage of the neuron at the previous moment, that is, it meets the spike firing requirement and is allowed to emit a spike, and no response is given in other cases.
[0068] The amplitude of the spike emitted by the neuron is determined by the ratio relationship between the current membrane voltage and the initial firing threshold, and can be the value obtained by rounding down the ratio Gaussian function, the value obtained by rounding up the ratio Gaussian function, or some linear or non-linear transformation of the rounded value.
[0069] The output o of the (n + 1)-th layer neuron at time t t,n+1 is expressed as:
[0070]
[0071] where V th represents the initial firing threshold.
[0072] Based on the complexity of different data sets, the maximum excitation limit of the pulse can be set to improve the calculation efficiency. Compare the ratio value of the current membrane voltage to the initial excitation threshold with the set maximum excitation limit of the pulse, and select the smaller value as the amplitude of the final excitation pulse.
[0073] Step 3: Complete the neural network transmission, calculate the error between the predicted value and the target value of the spiking neural network using the loss function, and obtain the loss of the spiking neural network.
[0074] Select the mean squared error as the loss function MSE, which is expressed as:
[0075]
[0076] where, x i represents the predicted value of the i-th neuron in the last layer of the spiking neural network; y represents the target value of the spiking neural network; N represents the number of neurons in the last layer of the spiking neural network, that is, the number of categories that the neural network needs to classify.
[0077] Step 4: Train the spiking neural network using the error backpropagation algorithm according to the loss of the spiking neural network.
[0078] Specifically, the surrogate gradient function is used for backpropagation in the error backpropagation algorithm to adjust the weights of the spiking neural network. The surrogate gradient function h(u) is expressed as:
[0079]
[0080] where, u represents the membrane voltage of the final output neuron; sign() represents the sign function; a is a parameter that determines the sharpness of the curve, usually set to 1.
[0081] Step 5: Set the accuracy threshold of the spiking neural network. When the loss of the spiking neural network is less than or equal to the accuracy threshold Q = 0.1, end the training; otherwise, adjust the structure or parameter of the spiking neural network and retrain until a spiking neural network that meets the accuracy requirements is obtained.
[0082] In summary, for the above spiking neural network training method based on neurons, the neuron only emits a pulse when the membrane voltage exceeds the initial threshold and the membrane voltage begins to decay, determines the amplitude of the excitation pulse based on the ratio of its own membrane voltage to the initial threshold, to make up for the accuracy loss caused by the reduction of pulses. At the same time, the number of neuron pulse excitations is greatly reduced, and the obtained sparser pulse sequence saves a large amount of storage resources and computing consumption. After the neuron processes the signal, finally, train the spiking neural network to obtain a spiking neural network suitable for complex data processing tasks.
[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present invention.
Claims
1. A training method for a spiking neural network based on a self - falling neuron model, characterized in that, It includes the following steps: Step 1: Collect and preprocess the received original image, set the structural parameters of the spiking neural network, and establish the spiking neural network; The spiking neural network includes several layers, and each layer includes at least one neuron; Step 2: Use the neurons in the spiking neural network to encode the preprocessed original image to generate a pulse sequence, and then perform signal processing to generate a new pulse sequence; The signal processing of the neuron on the encoded pulse sequence specifically includes a reception period, an accumulation period, and an activation period; the reception period is: at least one neuron receives the preprocessed pulse sequence or the pulse sequence output by the upper-layer neuron; the accumulation period is: the neuron calculates the sum based on its own membrane voltage and the received pulse sequence, and updates the current membrane voltage of the neuron; the activation period is: set an initial firing threshold, observe the state of the current membrane voltage of the neuron, and when it meets the firing condition, trigger the neuron to emit a pulse; The firing condition of the neuron is: within a single simulation time step, the change state of the current membrane voltage of the neuron simultaneously satisfies: ① the current membrane voltage exceeds the initial firing threshold; ② the current membrane voltage is lower than the membrane voltage of the neuron at the previous moment; Step 3: Complete the forward transmission of the neural network, calculate the error between the predicted value and the target value of the spiking neural network using the loss function, and obtain the loss of the spiking neural network; Step 4: Train the spiking neural network using the error backpropagation algorithm according to the loss of the spiking neural network; Step 5: Set the accuracy threshold of the spiking neural network. When the loss of the spiking neural network is less than or equal to the accuracy threshold Q, end the training; On the contrary, adjust the structure or structural parameters of the spiking neural network, return to Step 2, and retrain the spiking neural network until a spiking neural network that meets the accuracy requirements is obtained.
2. The training method of the spiking neural network based on the self-falling neuron model according to claim 1, wherein: In the activation period of Step 2, the amplitude of the pulse emitted by the neuron is determined by the ratio relationship between the current membrane voltage and the initial firing threshold; The output o of the (n + 1)-th layer of neurons at time t t,n+1 is expressed as: Among them, V th represents the initial excitation threshold; u t,n+1 represents the current membrane voltage of the (n + 1)-th layer neuron at time t; u t-1,n+1 represents the membrane voltage of the (n + 1)-th layer neuron at time t - 1.
3. The training method of the spiking neural network based on the self-falling neuron model according to claim 2, wherein: In Step 2, the amplitude of the pulse emitted by the neuron is the floor value of the ratio Gaussian function of the current membrane voltage to the initial firing threshold, or the ceiling value of the ratio Gaussian function, or a linear transformation or a non-linear transformation of the rounded value.
4. The training method of the spiking neural network based on the self-falling neuron model according to any one of claims 1-3, wherein: Step 2 further includes: setting a maximum firing upper limit for the pulse in the activation period; the amplitude of the pulse emitted by the neuron is the smaller value between the ratio relationship value of the current membrane voltage to the initial firing threshold and the set maximum firing upper limit value of the pulse.
5. The training method of the spiking neural network based on the self-falling neuron model according to claim 4, wherein: During the accumulation period of step 2, the current membrane voltage u of the (n + 1)-th layer of neurons at time t t,n+1 is expressed as: n t,n+1 = γu t-1,n+1 (1 - o t-1,n+1 ) + w n o t,n-1 where γ represents the time constant; u t-1,n+1 represents the membrane voltage of the (n + 1)-th layer neuron at time t - 1; o t-1,n+1 represents the output of the (n + 1)-th layer neuron at time t - 1; w n represents the network weight of the n-th layer neuron.
6. The training method of the spiking neural network based on the self-falling neuron model according to claim 5, wherein: In step 3, the loss function is the mean square error between the predicted value of the spiking neural network and the target value of the spiking neural network, expressed as: where x i represents the predicted value of the i-th neuron in the last layer of the spiking neural network; y represents the target value of the spiking neural network; N represents the number of neurons in the last layer of the spiking neural network.
7. The training method of the spiking neural network based on the self-falling neuron model according to claim 6, characterized in that: In step 4, an alternative gradient function is used for backpropagation in the error backpropagation algorithm to adjust the weights of the spiking neural network; The alternative gradient function h(u) is expressed as: Among them, u represents the membrane voltage of the final output neuron; sign() represents the sign function; a is a parameter determining the sharpness of the curve; V th represents the initial excitation threshold.
8. The training method of the spiking neural network based on the self-falling neuron model according to claim 7, characterized in that: The parameter a that determines the sharpness of the decision curve is a = 1.
9. The training method of the spiking neural network based on the self-falling neuron model according to claim 1, characterized in that: In step 2, the maximum firing limit of the pulse is 3; In step 5, Q = 0.
1.
10. The training method of the pulsed neural network based on the self-falling neuron model according to claim 1, characterized in that, Step 1 is specifically: 1.
1. Fill the original image into a square with a filling size of 4; 1.
2. Randomly crop the filled image; 1.
3. Randomly horizontally flip the cropped image with a probability of 0.5; 1.
4. Scale the cropped image proportionally so that it falls within the interval [0, 1]; 1.
5. Set the structural parameters of the spiking neural network, including the hyperparameter learning rate of 0.001 and the initial firing threshold of 0.5.
Citation Information
Patent Citations
Signal processing method for neurons in spiking neural network and network training method
CN113255905A
Training method of spiking neural network
CN114037047A
Ultra-low delay pulse neural network based on space-time information and learning method
CN114091659A
Low-power-consumption target detection method based on convolutional spiking neural network
CN114926737A