A method, terminal, and storage medium for accelerating the training of spiking neural networks.
By using acceleration devices in pulsed neural network training for backpropagation training and updating synaptic weights, the problem of time-consuming training of pulsed neural networks is solved, and the training process is accelerated.
Patent Information
- Application Number
- CN202011395802.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-03
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-12-03
AI Technical Summary
The training process of pulsed neural networks in the prior art takes a long time, resulting in a significant increase in the computational volume.
By obtaining the pulse sequence and initial synaptic weights for training, an input signal of the pulsed neuron is generated, and the acceleration device is used for backpropagation training, and the synaptic weights are updated to achieve efficient training of the pulsed neural network.
By handing over the most time-consuming parameter update task in pulsed neural network training to a special acceleration device for processing, the speed of parameter update is significantly improved, thereby accelerating the training process of pulsed neural network and solving the problem of the time-consuming training process.
Smart Images

Figure CN112529176B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of neural networks, and in particular to a training method, a terminal and a storage medium for accelerating a pulse neural network. Background Art
[0002] As the third generation of artificial neural networks, the pulse neural network simulates pulse neurons that are closer to the human neural model and add time information. The pulse neural network uses pulses as its transmission information. Pulses are discrete events that occur in time, rather than some continuous values, which are more in line with the process of information propagation in biological nerves. Therefore, the pulse neurons in the pulse neural network are pulse neurons built on the basis of biological synaptic structures. The processing performed by the pulse neuron is to receive the pulses transmitted by the synapse, and generate the post-synaptic membrane voltage through the pulse equation according to the synaptic weight. Once the voltage exceeds a certain threshold, the pulse neuron sends a pulse signal to the next pulse neuron. However, since the pulse signal adds the time element, the amount of calculation of the pulse neural network increases significantly, resulting in a large amount of time cost in its training process. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method, terminal and storage medium for accelerating the training of a pulse neural network in view of the above-mentioned defects of the prior art, aiming to solve the problem that the training process of the pulse neural network in the prior art is time-consuming.
[0004] The technical solution adopted by the present invention to solve the problem is as follows:
[0005] In a first aspect, an embodiment of the present invention provides a training method for accelerating a spiking neural network, wherein the method is applied to an acceleration device, comprising:
[0006] Acquire a pulse sequence and an initial synaptic weight for training, and generate an input signal of a spiking neuron according to the pulse sequence and the initial synaptic weight;
[0007] Acquire an actual output pulse sequence generated based on the input signal;
[0008] The expected output pulse sequence is obtained, the initial synaptic weights are updated according to the actual output pulse sequence and the expected output pulse sequence, and the updated synaptic weights are sent to a host device to implement training of the spiking neural network.
[0009] In one embodiment, the acquiring of a pulse sequence and an initial synaptic weight for training, and generating an input signal of a spiking neuron according to the pulse sequence and the initial synaptic weight comprises:
[0010] Obtaining a scheduling instruction sent by a host device, and obtaining a pulse sequence and an initial synaptic weight for training stored in a host memory according to the scheduling instruction;
[0011] The product of the pulse sequence and the initial synaptic weight is accumulated, and the accumulated data is used as the input signal of the pulse neuron.
[0012] In one embodiment, obtaining an actual output pulse sequence generated based on the input signal comprises:
[0013] Acquire the value of the membrane potential of the spiking neuron generated based on the input signal;
[0014] The actual output pulse sequence is obtained according to the value of the membrane potential of the pulse neuron.
[0015] In one embodiment, obtaining the value of the membrane potential of the spiking neuron generated based on the input signal comprises:
[0016] Obtain the input current of the presynaptic neuron;
[0017] Calculate the membrane potential change of the spiking neuron according to the spiking neuron model;
[0018] The value of the membrane potential of the spiking neuron generated based on the input signal is calculated according to the input current of the presynaptic neuron, the change in the membrane potential of the spiking neuron and the membrane potential equation of the spiking neuron.
[0019] In one embodiment, obtaining the actual output pulse sequence according to the value of the membrane potential of the spiking neuron includes:
[0020] Comparing the value of the membrane potential of the spiking neuron with a preset threshold, and when the value of the membrane potential of the spiking neuron is greater than the preset threshold, acquiring a pulse sequence output by the spiking neuron;
[0021] The pulse sequence output by the pulse neuron is taken as the actual output pulse sequence.
[0022] In one embodiment, the obtaining of the expected output pulse sequence, updating the initial synaptic weights according to the actual output pulse sequence and the expected output pulse sequence, and sending the updated synaptic weights to the host device to implement training of the spiking neural network includes:
[0023] Obtaining a desired output pulse sequence, and calculating an error value between the actual output pulse sequence and the desired output pulse sequence according to a preset error function;
[0024] generating a target synaptic weight set according to the error value and the initial synaptic weight;
[0025] The target synaptic weight set is sent to a host device, so that the host device updates the initial synaptic weights of each intermediate layer of the pulse neural network based on the target synaptic weight set, and the updated synaptic weights are sent to the host device to realize training of the pulse neural network.
[0026] In one embodiment, generating a target synaptic weight set according to the error value and the initial synaptic weight includes:
[0027] Obtaining a preset expected error value, and comparing the error value with the expected error value;
[0028] When the error value is greater than or equal to the expected error value, a target synaptic weight set is generated according to the error value and the initial synaptic weight.
[0029] In one implementation, when the error value is greater than or equal to the expected error value, generating a target synaptic weight set according to the error value and the initial synaptic weight includes:
[0030] When the error value is greater than or equal to the expected error value, according to the error value and a preset back propagation learning algorithm, the change amount of the initial synaptic weight of each intermediate layer of the spiking neural network is calculated in order of connection distance from the output layer of the spiking neural network from near to far;
[0031] Calculating the target synaptic weight of each intermediate layer of the spiking neural network according to the initial synaptic weight of each intermediate layer of the spiking neural network and the change amount of the initial synaptic weight;
[0032] A target synaptic weight set is generated according to all calculated target synaptic weights.
[0033] In a second aspect, an embodiment of the present invention further provides a mobile terminal, which includes: a processor, a storage medium communicatively connected to the processor, the storage medium being suitable for storing a plurality of instructions; the processor being suitable for calling the instructions in the storage medium to consistently implement the steps of any one of the above-mentioned methods for training an accelerated pulse neural network.
[0034] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a plurality of instructions are stored, wherein the instructions are suitable for being loaded and executed by a processor to implement the steps of a method for training an accelerated pulse neural network as described in any one of the above.
[0035] Beneficial effects of the present invention: The embodiments of the present invention obtain a pulse sequence and an initial synaptic weight for training, generate an input signal of a pulse neuron according to the pulse sequence and the initial synaptic weight; obtain an actual output pulse sequence generated based on the input signal; obtain an expected output pulse sequence, and update the initial synaptic weight according to the actual output pulse sequence and the expected output pulse sequence, so as to realize the training of the pulse neural network. The present invention reads the image data through the host device and converts it into a pulse sequence and sets the initial weight. Then, the most time-consuming parameter update task in the pulse neural network training is handled by a special acceleration device, which improves the speed of parameter update and accelerates the training process of the pulse neural network. Thereby solving the problem that the training process of the pulse neural network in the prior art is time-consuming. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 It is a flow chart of a training method for an accelerated spiking neural network provided by an embodiment of the present invention.
[0038] Figure 2 It is a schematic diagram of a flow chart of obtaining an input signal provided by an embodiment of the present invention.
[0039] Figure 3 It is a schematic diagram of a flow chart of obtaining an actual output pulse sequence provided by an embodiment of the present invention.
[0040] Figure 4 It is a schematic diagram of a process for training a pulse neural network provided by an embodiment of the present invention.
[0041] Figure 5 It is a principle block diagram of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0043] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0044] As the third generation of artificial neural networks, the pulse neural network simulates pulse neurons that are closer to the human neural model and add time information. The pulse neural network uses pulses as its transmission information. Pulses are discrete events that occur in time, rather than some continuous values, which are more in line with the process of information propagation in biological nerves. Therefore, the pulse neurons in the pulse neural network are pulse neurons built on the basis of biological synaptic structures. The processing performed by the pulse neuron is to receive the pulses transmitted by the synapse, and generate the post-synaptic membrane voltage through the pulse equation according to the synaptic weight. Once the voltage exceeds a certain threshold, the pulse neuron sends a pulse signal to the next pulse neuron. However, since the pulse signal adds the time element, the amount of calculation of the pulse neural network increases significantly, resulting in a large amount of time cost in its training process.
[0045] In view of the above-mentioned defects of the prior art, the present invention provides a method for accelerating the training of a pulse neural network, which accelerates the training process of the pulse neural network by cooperating with a host device and an acceleration device, allowing the host device to read the image data and convert it into a pulse sequence and set the initial weights. The calculation results completed by the host are saved in global variables, and handed over to the acceleration device for back-propagation training acceleration to determine the target weights of the pulse neural network. The host device then obtains the target weights and finally completes the training of the pulse neural network. The present invention assigns the most time-consuming parameter update task in the pulse neural network training to a special acceleration device, thereby increasing the speed of parameter update and accelerating the training process of the pulse neural network. This solves the problem of the long time-consuming training process of the pulse neural network in the prior art.
[0046] like Figure 1 As shown, the method comprises the following steps:
[0047] Step S100: Obtain a pulse sequence and an initial synaptic weight for training, and generate an input signal of a pulse neuron according to the pulse sequence and the initial synaptic weight.
[0048] The ultimate goal of this embodiment is to update the weights of the synapses connected to the spiking neurons in the spiking neural network to be trained, so as to realize the training of the spiking neural network to be trained. Therefore, it is first necessary to obtain the pulse sequence for training and determine the initial weights of the synapses connected to the spiking neurons in the spiking neural network to be trained. In this embodiment, the initial weights of the synapses connected to the spiking neurons in the spiking neural network to be trained are used as the initial synaptic weights. Then, the input signal of the spiking neuron is generated according to the pulse sequence and the initial synaptic weights, and the training of the spiking neural network to be trained begins.
[0049] In one implementation, in order to improve the training efficiency of the pulse neural network, this embodiment will generate a pulse sequence for training and determine the initial weights of the synapses connected to the pulse neurons in the pulse neural network, which are handled by the host device. Specifically, the host device first reads the training image, and then converts the read training image into the pulse sequence required for training the pulse neural network through Poisson pulse coding. In addition, the host device also needs to perform a random initialization operation on the weights of the synapses connected to the pulse neurons in the pulse neural network to be trained, and use the weights obtained after the random initialization operation as the initial synaptic weights. The host device then copies the pulse sequence and the initial synaptic weights to the global memory of its own device for reading by the acceleration device.
[0050] like Figure 2 As shown, in one implementation, step S100 specifically includes the following steps:
[0051] Step S110, obtaining a scheduling instruction sent by a host device, and obtaining a pulse sequence and an initial synaptic weight for training stored in a host memory according to the scheduling instruction;
[0052] Step S120, accumulating the product of the pulse sequence and the initial synaptic weight, and using the accumulated data as the input signal of the pulse neuron.
[0053] After the acceleration task is started, the host device executes the device kernel task and sends a scheduling instruction to the acceleration device to schedule the acceleration device to perform the acceleration training task. When the acceleration device obtains the scheduling task sent by the host device, it starts and begins the training task, and the training method selects the back propagation method for training. First, the previously generated pulse sequence and the calculated initial synaptic weights stored in the host memory of the host device are obtained, and then the product of the pulse sequence and the initial synaptic weights is accumulated, and the accumulated data is used as the input signal of the pulse neuron to train the weight parameters. Specifically, the pulse sequence is the transmission information in the pulse neural network, and the neurons in the pulse neural network are pulse neurons built on the basis of biological synaptic structure. After the pulse sequence is input into the pulse neural network, the pulse sequence combines with the corresponding synaptic weights to jointly generate the input signal transmitted to the pulse neuron. For example, there are N input pulse sequences X and N corresponding synaptic weights ω. The N Xs and N ωs are multiplied and accumulated accordingly and then passed to the pulse neuron, that is, input = x1*ω1+x2*ω2+x3*ω3+Λxn*ωn.
[0054] In order to complete the training of the spiking neural network, Figure 1 The method further comprises the following steps:
[0055] Step S200: Acquire an actual output pulse sequence generated based on the input signal.
[0056] The training goal of the spiking neural network in this embodiment is to adjust the synaptic weights for the input pulse sequence and the expected output pulse sequence through supervised training of the spiking neural network, so as to minimize the gap between the actual output pulse sequence of the neural network and the expected output pulse sequence. Therefore, in order to realize the training of the spiking neural network, it is first necessary to obtain the actual output pulse sequence output by the spiking neuron.
[0057] like Figure 3 As shown, in one implementation, step 200 specifically includes the following steps:
[0058] Step S210, obtaining a value of a membrane potential of a spiking neuron generated based on the input signal;
[0059] Step S220: obtaining an actual output pulse sequence according to the value of the membrane potential of the spiking neuron.
[0060] Specifically, the spiking neuron operates the input signal to generate the postsynaptic membrane voltage. Once the input signal causes the membrane potential of the spiking neuron to exceed the preset threshold, the spiking neuron sends a pulse signal to the next spiking neuron, and the pulse signal is the actual output pulse sequence. In other words, the spiking neuron will output a pulse sequence only when the postsynaptic membrane voltage exceeds the preset threshold. Therefore, in order to obtain the actual output pulse sequence, this embodiment needs to first calculate the value of the membrane potential of the spiking neuron.
[0061] In order to calculate the value of the membrane potential of the spiking neuron, in one implementation, this embodiment obtains the input current of the presynaptic neuron, then calculates the membrane potential change of the spiking neuron according to the spiking neuron model, and finally calculates the membrane potential value of the spiking neuron according to the input current of the presynaptic neuron, the membrane potential change of the spiking neuron and the membrane potential equation of the spiking neuron. For example, according to the IF neuron model, when the input stimulus causes the membrane potential of the neuron to exceed a certain threshold, a spike pulse is generated, and the membrane potential equation is:
[0062]
[0063] Among them, y>0 is the time constant of membrane potential change, I is the input current of presynaptic neuron, and when the membrane potential V t Exceeding the threshold V th When the potential is high, a discharge pulse is generated. At this time, V t The value of is reset to the resting potential V rest .
[0064] After obtaining the value of the membrane potential of the input pulse neuron, the value of the membrane potential of the pulse neuron is compared with a preset threshold. When the value of the membrane potential of the pulse neuron is greater than the preset threshold, the pulse sequence output by the pulse neuron is obtained and the pulse sequence output by the pulse neuron is used as the actual output pulse sequence.
[0065] In order to complete the training of the spiking neural network, Figure 1 As shown, the method further comprises the following steps:
[0066] Step S300, obtaining an expected output pulse sequence, updating the initial synaptic weights according to the actual output pulse sequence and the expected output pulse sequence, and sending the updated synaptic weights to a host device to implement training of the spiking neural network.
[0067] Specifically, in order to perform supervised learning on the pulse neural network and adjust the synaptic weights, after obtaining the actual output pulse sequence of the pulse neuron, this embodiment also needs to obtain a pre-set expected output pulse sequence, and update the initial synaptic weights through the actual output pulse sequence and the expected output pulse sequence, thereby completing the training of the pulse neural network.
[0068] like Figure 4 As shown, in one implementation, step S300 specifically includes the following steps:
[0069] Step S310, obtaining a desired output pulse sequence, and calculating an error value between the actual output pulse sequence and the desired output pulse sequence according to a preset error function;
[0070] Step S320, generating a target synaptic weight set according to the error value and the initial synaptic weight;
[0071] Step S330, sending the target synaptic weight set to the host device, so that the host device updates the initial synaptic weights of each intermediate layer of the spiking neural network based on the target synaptic weight set, and sending the updated synaptic weights to the host device to train the spiking neural network.
[0072] The main training goal of the pulse neural network in this embodiment is to make the gap between the actual output pulse sequence of the pulse neural network and the expected output pulse sequence as small as possible. Therefore, it is necessary to first obtain the expected output pulse sequence and calculate the error value between the actual output pulse sequence and the expected output pulse sequence according to a preset error function.
[0073] Then, a target synaptic weight set is generated according to the error value and the initial synaptic weight, wherein the target synaptic weight set includes new synaptic weights for updating existing synaptic weights in each intermediate layer of the spiking neural network.
[0074] Specifically, before obtaining the target synaptic weight set, it is necessary to first determine whether the current initial synaptic weight needs to be updated. Therefore, in one implementation, it is necessary to obtain a preset expected error value and compare the error value with the expected error value. Then, when the error value is greater than or equal to the expected error value, it indicates that the weights of the synapses in the current pulse neural network need to be updated, so it is necessary to generate a target synaptic weight set for updating the weights based on the error value and the initial synaptic weights. When the error value is less than the expected error value, it indicates that the weights of the synapses of the current pulse neural network do not need to be updated, then there is no need to change the synaptic weights, and the initial synaptic weights can be used.
[0075] In order to obtain the target synaptic weight set, in one implementation, when the error value is greater than or equal to the expected error value, the embodiment calculates the change in the initial synaptic weight of each intermediate layer of the spiking neural network in order from near to far in terms of the connection distance to the output layer of the spiking neural network according to the error value and the preset back propagation learning algorithm. Specifically, the change in the initial synaptic weight is dominated by the STDP (spike timedependent plasticity) mechanism, wherein the STDP mechanism refers to adjusting the synaptic conductance value according to the difference in the discharge time of the pre- and post-synaptic neurons, thereby changing the magnitude of the current transmission capacity between the pre- and post-synaptic neurons. If the neuron is an excitatory neuron: when the pre-synaptic neuron discharges before the post-synaptic neuron, the synaptic connection between the two neurons is strengthened; if the post-synaptic discharge time is earlier than the pre-synaptic neuron, the synaptic connection is inhibited. The inhibitory neuron is just the opposite: when the pre-synaptic neuron discharges before the post-synaptic neuron, the synaptic connection is inhibited; otherwise, the synaptic connection is strengthened.
[0076] After calculating the change in the initial synaptic weights of each intermediate layer of the spiking neural network, the target synaptic weights of each intermediate layer of the spiking neural network are calculated based on the initial synaptic weights of each intermediate layer of the spiking neural network and the change in the initial synaptic weights. Finally, a target synaptic weight set is generated based on all the calculated target synaptic weights.
[0077] Specifically, the back propagation learning algorithm is a supervised learning method that requires a target output vector and an expected output to be given in advance. The basic principle of the back propagation learning algorithm for processing information is: the input signal is processed by the activation function transformation, and acts on the output layer neurons through the intermediate layer neurons (hidden layer neurons), thereby generating an output signal, and then the deviation between the actual output vector and the corresponding expected output vector is calculated, and the connection weights of the output layer are updated based on the gradient descent rule according to the calculated deviation. Then, the deviation between the output layer and the direct leading layer is estimated with this deviation, and the connection weights of the leading layer are updated with the calculated deviation; the deviation of the previous layer of the leading layer is continued to be estimated, forming a process of transmitting the deviation shown by the output layer to the input layer layer by layer in the opposite direction of the input signal, so that the deviations of all other layers can be obtained, and the deviations calculated by these estimates are used to update the connection weights of each layer. By using the error back propagation algorithm to repeatedly train and adjust the weights of the network, the actual output vector and the expected output vector can be as close as possible. Finally, when the deviation between the vector output by the network and the expected target vector reaches the specified error range, the learning ends, and the network weights and deviations at this time are retained.
[0078] After generating the target synaptic weight set, the acceleration device sends the target synaptic weight set to the host device, so that the host device updates the initial synaptic weights of each intermediate layer of the pulse neural network based on the target synaptic weight set to complete the training of the pulse neural network.
[0079] In summary, because the back propagation learning algorithm of the prior art needs to be differentiated according to the error function, the error function value is minimized. However, the pulse sequences of the pulse neural network training are some discrete sequences that cannot be differentiated. Therefore, the preset back propagation learning algorithm used in the present invention is an improved back propagation learning algorithm. By first giving a desired output pulse sequence and randomly initializing the synaptic weights of the pulse neuron connection, the N input pulse time series X are multiplied and accumulated by the N corresponding synaptic weights ω and passed to the pulse neuron, that is, input = x1*ω1+x2*ω2+x3*ω3+Λxn*ωn. Then the pulse neuron operates on the input signal, and when its membrane potential exceeds the excitation threshold, it emits a pulse, and then returns to the resting potential, waiting for the next input signal to arrive. After the pulse neuron emits the pulse, a pulse time series is output. Then the defined error function (as shown below) is used to calculate the error between the actual output and the target output, and the synaptic weights are updated according to the error and the algorithm. Thereby realizing the use of the back propagation learning algorithm in the pulse neural network training.
[0080]
[0081] In view of the powerful computing power of FPGA (Field-Programmable Gate Array), in one implementation, FPGA devices are used as acceleration devices. FPGA has the characteristics of fast computing speed, small area, high integration, parallel computing, and repeatable configuration. FPGA is a special digital integrated circuit implementation method with the advantages of low power consumption, good flexibility, and strong parallel computing capabilities, making it a large customized platform for neural networks. Compared with traditional low-energy-efficiency hardware such as CPU or GPU, high-energy-efficiency FPGA devices are more conducive to the application of pulse neural networks at the embedded end or edge end. In addition, relevant experimental results also show that the acceleration result of the training method for accelerating pulse neural networks proposed in the present invention is significantly improved compared with the CPU+GPU heterogeneous computing platform.
[0082] Based on the above embodiments, the present invention further provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 5As shown. The intelligent terminal includes a processor, a memory, a network interface, and a display screen connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a training method for accelerating a pulse neural network is implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen.
[0083] Those skilled in the art will understand that Figure 5 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the smart terminal to which the scheme of the present invention is applied. The specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0084] In one implementation, one or more programs are stored in the memory of the intelligent terminal, and the one or more programs are configured to be executed by one or more processors, and the one or more programs include instructions for performing a training method for an accelerated spiking neural network.
[0085] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0086] In summary, the present invention discloses a training method, terminal and storage medium for accelerating pulse neural network, the method comprising: obtaining a pulse sequence and initial synaptic weights for training, generating an input signal of a pulse neuron according to the pulse sequence and the initial synaptic weights; obtaining an actual output pulse sequence generated based on the input signal; obtaining an expected output pulse sequence, updating the initial synaptic weights according to the actual output pulse sequence and the expected output pulse sequence, so as to realize training of the pulse neural network. The present invention reads the image data through the host device and converts it into a pulse sequence and sets the initial weights. Then, the most time-consuming parameter update task in the pulse neural network training is handled by a special acceleration device, which improves the speed of parameter update and accelerates the training process of the pulse neural network. Thereby solving the problem that the training process of the pulse neural network in the prior art is time-consuming.
[0087] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A training method for accelerating a spiking neural network, characterized in that: The method is applied to an acceleration device, comprising: Acquire a pulse sequence and an initial synaptic weight for training, and generate an input signal of a spiking neuron according to the pulse sequence and the initial synaptic weight; Acquire an actual output pulse sequence generated based on the input signal; Acquire an expected output pulse sequence, update the initial synaptic weights according to the actual output pulse sequence and the expected output pulse sequence, and send the updated synaptic weights to a host device to implement training of the spiking neural network; The acquiring of the actual output pulse sequence generated based on the input signal comprises: Obtain the input current of the presynaptic neuron; Calculate the membrane potential change of the spiking neuron according to the spiking neuron model; The value of the membrane potential of the spiking neuron generated based on the input signal is calculated according to the input current of the presynaptic neuron, the change in the membrane potential of the spiking neuron and the membrane potential equation of the spiking neuron; wherein the membrane potential equation is: Among them, y>0 is the time constant of membrane potential change, I is the input current of presynaptic neuron, and when the membrane potential V t Exceeding the threshold V th When the potential is high, a discharge pulse is generated. At this time, V t The value of is reset to the resting potential V rest ; Obtaining an actual output pulse sequence according to the value of the membrane potential of the spiking neuron; The obtaining of the expected output pulse sequence, updating the initial synaptic weights according to the actual output pulse sequence and the expected output pulse sequence, and sending the updated synaptic weights to the host device to implement training of the spiking neural network includes: Obtaining a desired output pulse sequence, and calculating an error value between the actual output pulse sequence and the desired output pulse sequence according to a preset error function; Obtaining a preset expected error value, and comparing the error value with the expected error value; When the error value is greater than or equal to the expected error value, the change in the initial synaptic weights of each intermediate layer of the spiking neural network is calculated in sequence according to the connection distance from the output layer of the spiking neural network from near to far according to the error value and the preset back propagation learning algorithm; wherein the change in the initial synaptic weights is dominated by the pulse time-dependent plasticity mechanism, which refers to adjusting the synaptic conductance value according to the difference in the discharge time of the pre- and post-synaptic neurons, thereby changing the magnitude of the current transmission capacity between the pre- and post-synaptic neurons; if the neuron is an excitatory neuron: when the pre-synaptic neuron discharges before the post-synaptic neuron, the synaptic connection between the two neurons is strengthened, and when the post-synaptic discharge time is earlier than the pre-synaptic neuron, the synaptic connection is inhibited; if the neuron is an inhibitory neuron: when the pre-synaptic neuron discharges before the post-synaptic neuron, the synaptic connection is inhibited, and vice versa, the synaptic connection is strengthened; Calculating the target synaptic weight of each intermediate layer of the spiking neural network according to the initial synaptic weight of each intermediate layer of the spiking neural network and the change amount of the initial synaptic weight; Generate a target synaptic weight set according to all calculated target synaptic weights; The target synaptic weight set is sent to a host device, so that the host device updates the initial synaptic weights of each intermediate layer of the pulse neural network based on the target synaptic weight set, and the updated synaptic weights are sent to the host device to realize training of the pulse neural network.
2. The training method of an accelerated spiking neural network according to claim 1, characterized in that: The step of acquiring a pulse sequence and an initial synaptic weight for training, and generating an input signal of a spiking neuron according to the pulse sequence and the initial synaptic weight comprises: Obtaining a scheduling instruction sent by a host device, and obtaining a pulse sequence and an initial synaptic weight for training stored in a host memory according to the scheduling instruction; The product of the pulse sequence and the initial synaptic weight is accumulated, and the accumulated data is used as the input signal of the pulse neuron.
3. The training method of an accelerated spiking neural network according to claim 1, characterized in that: The step of obtaining the actual output pulse sequence according to the value of the membrane potential of the spiking neuron comprises: Comparing the value of the membrane potential of the spiking neuron with a preset threshold, and when the value of the membrane potential of the spiking neuron is greater than the preset threshold, acquiring a pulse sequence output by the spiking neuron; The pulse sequence output by the pulse neuron is taken as the actual output pulse sequence.
4. A mobile terminal, characterized in that: include: A processor and a storage medium in communication with the processor, wherein the storage medium is suitable for storing a plurality of instructions; the processor is suitable for calling the instructions in the storage medium to implement the steps of a method for training an accelerated pulse neural network as described in any one of claims 1 to 3.
5. A computer-readable storage medium having a plurality of instructions stored thereon, characterized in that: The instructions are suitable for being loaded and executed by a processor to implement the steps of a method for training an accelerated spiking neural network as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Neural network construction, training and recognition method, system, and storage medium
CN111639754A
Neural processor based accelerator system and method
US20170024644A1