Space-time domain pulse neural network training method, chip and electronic product

By introducing a space time domain error return strategy in pulsed neural network training, the problem of time domain dependence is ignored is solved, a more efficient training process is achieved, the defects of instability and slow convergence are overcome, and the training efficiency is improved.

CN114565079BActive Publication Date: 2025-01-07SHENZHEN SYNSENSE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210174051.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2025-01-07
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

The existing pulsed neural network training methods ignore the time domain dependence in backpropagation, resulting in high computational cost and instability and slow convergence problems, especially when the sample is large, the update gradient of network configuration parameters becomes very large.

Method used

A space-time domain error return (credit) allocation strategy is proposed. By calculating the second gradient and proxy gradient functions of each time step, the synaptic weight matrix is ​​gradually updated, and the spatiotemporal characteristics of the pulse neural network are fully utilized, and the traditional method is overcome. defect.

Benefits of technology

Considering time domain dependence in the backpropagation of network loss improves training efficiency and avoids the problems of instability and slow convergence, especially for IAF/LIF type neurons with high execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114565079B_ABST
    Figure CN114565079B_ABST
Patent Text Reader

Abstract

The present invention relates to a space-time domain pulse neural network training method, storage medium, computing device, chip and electronic product. In order to overcome the defects of the prior art that only the spatial domain structure of the pulse neural network is focused on and the time domain dependency between pulses is ignored, the present invention obtains the current network loss by inputting the training sample into the pulse neural network, and fully considers the time domain dependency between the network loss of the future time step and the current time step in the second gradient of the current network loss with respect to the weighted post-synaptic input of the current layer. The present invention solves the technical problems of slow convergence and instability of the existing network training methods, ensures that the pulse neural network can converge stably and quickly during training, and achieves the technical effect of reducing the network training time and improving the network performance, which is particularly significant for LIF or IAF neurons. The present invention is applicable to the field of brain-like chips, especially the field of training pulse neural networks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a spatiotemporal pulse neural network training method, storage medium, chip, and electronic product, and in particular to a spatiotemporal error return (credit) allocation strategy for a pulse neural network training method, storage medium, chip, and electronic product. Background Art

[0002] Neuromorphic computing is a highly energy-efficient brain-like intelligent computing. Different from the pure mathematical function-based computing in traditional artificial neural networks (ANN), the neurons used in neuromorphic computing have both temporal and spatial dynamic characteristics at the microscopic level, making them more bionic and a new computing architecture that breaks the von Neumann architecture.

[0003] The research on neuromorphic computing mainly involves the Spiking Neural Network (SNN) model and its training method, as well as neuromorphic hardware (commonly known as brain-like chips). After training, the configuration parameters corresponding to the spiking neural network (synaptic weights, time constants, axon delays, etc.) can be obtained, and by deploying them to neuromorphic hardware, a (neuromorphic) chip that runs at ultra-low power and works like a brain can be obtained.

[0004] Traditional AI chips (based on ANN) face challenges in scalability and power efficiency (Cambrian-MLU220: 16nm process, 10W, 225mm 2 ; Huawei-Ascend 310: 12nm process, 8 watts), while cloud processing solutions face challenges such as network access bandwidth, latency, and privacy infringement. Whether in terms of chip cost or power consumption, traditional AI chips are difficult to give intelligence to tens of billions of IoT devices (which are sensitive to chip prices and power consumption). The nature of event triggering brings very power-saving computing to pulse neural networks, so neuromorphic computing is of great significance for giving everything intelligence. Currently, the power consumption of more influential brain-like chips is mostly between sub-milliwatts and hundreds of milliwatts, which is 2-4 orders of magnitude lower than that of traditional AI chips, which is extremely important for realizing always-on applications.

[0005] The training method of pulse neural network is an extremely important research direction, especially the problem that the activation function (spike function) of neurons is not differentiable due to the discrete pulse characteristics, which does not exist in traditional artificial neural networks. Back propagation is a very effective network training method in traditional artificial neural networks, and in order to learn from and apply this method in pulse neural networks, several results have been proposed, such as proxy gradient technology. The following prior art is hereby incorporated into the technical content disclosed in the present invention in the form of full text introduction, and assists in explaining the meaning and semantics of the technical terms of the present invention when necessary.

[0006] Prior Art 1: Lee, JH, Delbruck, T., & Pfeiffer, M. (2016). Training deepspiking neural networks using backpropagation. Frontiers in neuroscience, 10, 508.

[0007] Prior Art 2: Shrestha, SB, & Orchard, G. (2018, December). SLAYER: spike layererror reassignment in time. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (pp. 1419-1428).

[0008] Prior art 1 back-propagates the error based on the membrane voltage of the spiking neuron, allocating the error to the input signal at a given time step, but only for a single time step, thus ignoring the time domain dependency between spikes.

[0009] Spiking neurons include internal states that depend not only on the current input but also on its previous state. Based on this, the error should not only be back-propagated through layers to reflect the spatial nature of the spiking neural network, but also through time to reflect the temporal nature of the spiking neural network, but this often brings a huge computational cost.

[0010] Prior art 2 overcomes the shortcomings of prior art 1 and proposes a time domain credit allocation strategy for backpropagating the error to the front layer of the network, which well reflects the space-time characteristics of the pulse neural network. Due to the explicit definition of the gradient and the vectorization of the variables in time, prior art 2 also has high execution efficiency. The inventor independently studied and found that: in training, the SLAYER scheme has the defects of instability and slow convergence, especially when the sample is large, the update gradient of its network configuration parameters often becomes very large, which is very unfavorable for neural network training. Summary of the invention

[0011] In order to solve or alleviate some or all of the above technical problems, the present invention is implemented through the following technical solutions:

[0012] A space-time domain spiking neural network training method, the spiking neural network comprises a plurality of layers (1, 2, ..., L), the method comprising the following steps:

[0013] Receiving a batch of sample data from a training data set, and using the batch of sample data as input of a spiking neural network, running the spiking neural network and obtaining an output of the spiking neural network;

[0014] According to the output of the pulse neural network, calculate the current network loss

[0015] Starting from the output layer (the Lth layer) of the spiking neural network as the current layer (denoted as l), the current network loss is calculated in reverse order with respect to the synaptic weight matrix W between the current layer (l) and the previous layer (l-1): (l-1) Gradient Until the current network loss is about the input expansion matrix W (0) The gradient of

[0016] Through the current network loss With respect to the gradient of the synaptic weight matrix, the synaptic weight matrix of the spiking neural network is updated;

[0017] Among them, when calculating the current network loss, the synaptic weight matrix W between the current layer (l) and the previous layer (l-1) is (l-1) Gradient Before: At each time step (1, 2, ...n..., T), calculate the current network loss The weighted postsynaptic input z of the current layer (l) (l) The second gradient d (l) ;

[0018] And in calculating the second gradient d with a certain time step as the current time step (n) (l)[n] Before: Based on the current layer (l) and the current time step (n), bring in the proxy gradient function f′ (l) [·], the value of the proxy gradient function f′ is obtained (l) [n], as the first variable corresponding to the current time step (n) The first element value of When calculating the first variable corresponding to the current time step (n) The next element value of (m, m>n), based on the previous element value of the first variable corresponding to the current time step (n) Thus, all element values ​​of the first variable corresponding to the current time step are obtained.

[0019] In certain embodiments, each of the layers includes a plurality of spiking neurons.

[0020] In certain embodiments, the first variable is defined as follows:

[0021]

[0022] in, is an element value of the first variable corresponding to the l-th layer network at the n-th time step, is the first element value of the first variable corresponding to the current time step; is the refractory kernel; “*” is the convolution operation; f′ (l) [·] is the proxy gradient function of the l-th layer network; l is the number of the current layer.

[0023] In certain embodiments, the second gradient is defined as follows:

[0024]

[0025] Among them, d (l) [n] is the second gradient of the l-th layer network at the n-th time step; ∈ is the impulse response kernel; ⊙ is the cross-correlation operation; e (l) [·] is the first gradient of the current network loss with respect to the output impulse response signal of the l-th layer network; n is the time step number, and n = 1, 2, ..., T, where T is the total length of the time step.

[0026] In certain embodiments, the first gradient is defined as follows:

[0027] When l = L,

[0028] When l∈{1,...,L-1}, e (l) [n] = d (l+1) [n]W (l) ;

[0029] Among them, W (l) is the synaptic weight matrix between the lth layer network and the l+1th layer network; a (L) It is the result of convolution of the output pulse sequence of the L-th layer network with the impulse response kernel; is the current network loss.

[0030] In certain embodiments, the current network loss is calculated with respect to the synaptic weight matrix W between the current layer and the previous layer. (l-1) The gradient of is:

[0031]

[0032] Where T is the transposition mark.

[0033] In a certain class of embodiments, after calculating the gradient of the current network loss with respect to the synaptic weight matrix between the current layer and the previous layer, if l∈{2, ..., L}, the layer of the network is shifted forward by one layer, that is, the shifted layer is used as the current layer, and for the new current layer, the gradient of the current network loss with respect to the synaptic weight matrix between the current layer and the previous layer is calculated; if l=1, the network synaptic weight matrix is ​​updated by the gradient of the network loss with respect to the synaptic weight matrix.

[0034] In certain embodiments, the neurons in the spiking neural network are LIF neurons or IAF neurons.

[0035] In some embodiments, the sample data is one or more of visual, auditory, tactile, olfactory, electrocardiographic, electromyographic, vibration, and IMU type signals.

[0036] A storage medium having computer code stored thereon, and the computer code is executed to implement the space-time domain pulse neural network training method as described in any of the above items.

[0037] In certain embodiments, the computer code is source code or machine code that is directly executable by a computer.

[0038] In certain embodiments, the storage medium is located in a server, such as a computer code hosting server or an enterprise technical support server.

[0039] In certain embodiments, the storage medium is located in a computing device that provides training services for the neural network, such as a personal computer or an enterprise private server.

[0040] A computing device includes a computing unit and a storage medium as described above, and obtains configuration parameters of a pulse neural network by loading or compiling a computer code on the storage medium and executing it by the computing unit.

[0041] In certain embodiments, the computing unit is a CPU or a GPU or a processor dedicated to neural network training.

[0042] A chip includes a pulse neural network processor, on which the configuration parameters of the pulse neural network are deployed, and the configuration parameters of the pulse neural network at least include the synaptic weight matrix of the pulse neural network obtained by the space-time domain pulse neural network training method as described in any of the preceding items.

[0043] An electronic product comprises the chip as mentioned above.

[0044] In a certain type of embodiment, the electronic product also includes a trigger module and a vibration device, as well as a dynamic visual sensor; the trigger module is controlled by the control instructions generated by the electronic product, and sends an enable signal to the vibration device to execute vibration; after receiving the enable signal, the vibration device at least drives the dynamic visual sensor to produce physical vibration.

[0045] In certain embodiments, a dynamic vision sensor is integrated with a spiking neural network processor.

[0046] Some or all of the embodiments of the present invention have the following beneficial technical effects:

[0047] (1) In the back propagation of network loss, in addition to the spatial domain, the temporal domain dependency is also considered, making full use of the spatiotemporal characteristics of the spiking neural network.

[0048] (2) Overcoming the defects of instability and slow convergence during network training in the existing technology.

[0049] (3) For IAF / LIF type neurons, it has very high execution efficiency.

[0050] More beneficial effects will be further introduced in the preferred embodiments.

[0051] The technical solutions / features disclosed above are intended to summarize the technical solutions and technical features described in the specific implementation method section, so the scope of the records may not be exactly the same. However, the new technical solutions disclosed in this section are also part of the many technical solutions disclosed in the invention document. The technical features disclosed in this section, the technical features disclosed in the subsequent specific implementation method section, and some contents in the drawings that are not clearly described in the specification, disclose more technical solutions in a reasonable combination with each other.

[0052] The technical solution formed by combining all the technical features disclosed at any position of the present invention is used to support the generalization of the technical solution, the modification of the patent document, and the disclosure of the technical solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is the SRM spiking neuron model;

[0054] Figure 2 It is a schematic diagram of the structure of a spiking neural network;

[0055] Figure 3 is a schematic diagram of the input layer of a spiking neural network;

[0056] Figure 4 It is a simplified flow chart of the forward process of the network in the present invention;

[0057] Figure 5 It is a detailed flow chart of the forward process of the network in the present invention;

[0058] Figure 6 It is a simplified flow chart of the reverse process of the network in the present invention;

[0059] Figure 7 It is a detailed flow chart of the reverse process of the network in the present invention;

[0060] Figure 8 It is a flow chart for obtaining network configuration parameters;

[0061] Fig. 9 It is a schematic diagram of an electronic device with active acquisition of dynamic visual information;

[0062] Fig.10 This is an example of actively acquiring information through microtremors. DETAILED DESCRIPTION

[0063] Since it is impossible to describe all alternatives, the following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the key points of the technical solutions in the embodiments of the present invention. For other technical solutions and details not disclosed in detail below, they generally belong to technical goals or technical features that can be achieved by conventional means in the art. Due to space limitations, the present invention will not introduce them in detail.

[0064] Unless it means division, " / " in any position in the present invention means logical "or". The serial numbers such as "first" and "second" in any position in the present invention are only used as distinguishing marks for description, and do not imply an absolute order in time or space, nor do they imply that the terms prefixed with such serial numbers and the same terms prefixed with other attributives must have different references.

[0065] The present invention will describe various key points for combining into various specific embodiments, and these key points will be combined into various methods and products. In the present invention, even if the key points are only described when introducing the method / product solution, it means that the corresponding product / method solution also explicitly includes the technical features.

[0066] When describing the existence or inclusion of a certain step, module, or feature at any position in the present invention, it does not imply that such existence is exclusive and unique. Those skilled in the art can obtain other embodiments based on the technical solution disclosed in the present invention and supplemented by other technical means; based on the key points described in the specific embodiments of the present invention, those skilled in the art can replace, delete, add, combine, and change the order of certain technical features to obtain a technical solution that still follows the concept of the present invention. These solutions that do not deviate from the technical concept of the present invention are also within the protection scope of the present invention.

[0067] refer to Figure 1 , which shows the pulse response (SRM) neuron model. The SRM neuron is a neuron model with good versatility. The LIF neuron and IAF neuron can be regarded as two special cases of the SRM neuron.

[0068] Generally, in the field of neuromorphic computing, in order to express LIF neurons through the formula of SRM neurons, it is necessary to use an exponentially decaying impulse response kernel and a refractory period kernel, where the refractory period kernel is further multiplied by a threshold; for IAF neurons, the Heaviside function is used instead of the decaying impulse response kernel. For LIF neurons with synaptic dynamics, the impulse response kernel can be obtained by convolution between two exponential kernels.

[0069] A neuron receives multiple (1, 2, ..., i, ...) pulse sequences from other neurons, and each pulse sequence includes multiple pulses or pulse events. For the i-th (positive integer) input pulse sequence of the neuron, it is recorded as s i (t). After the pulse sequence is convolved with the impulse response kernel ∈(t) (this process is also called filtering), the impulse response signal a is obtained. i (t), that is: a i (t)=(∈*s i )(t), where * is a convolution operation (in the present invention, * represents convolution), the impulse response signal is the input impulse response signal of the neuron in the figure, and can also be regarded as the output impulse response signal of a neuron in the previous layer of the neuron. The impulse response signal is then passed through the corresponding synaptic weight ω i After quantification, the postsynaptic voltage (PSP) is obtained. After all the postsynaptic voltages received by the neuron are summed up and added to the refractory period response, the membrane voltage u(t) of the neuron is obtained. In other words, Where v is the refractory kernel (also called reset kernel), and s(t) is the output of the neuron. Determined by the symbol of the refractory kernel, the refractory kernel part in the membrane voltage calculation form can also be recorded as -v*s(t). Synaptic weights are important spiking neural network configuration parameters (referred to as network parameters) that spiking neural networks need to learn (be trained).

[0070] Normally, when the membrane voltage exceeds the threshold, a pulse is emitted (the amplitude can be regarded as 1). However, in another embodiment, the neuron can also emit "multiple pulses", that is, the amplitude or number of pulses is determined by the ratio of the membrane voltage to the threshold (corresponding to different implementation methods), such as rounding down the ratio (for details, please refer to the published Chinese invention patent: 2021108083426). After the neuron emits a pulse, its membrane voltage generally returns to the resting potential.

[0071] Regarding the settings of the refractory period core and the impulse response core, those skilled in the art may make different settings according to actual needs, and the present invention is not limited thereto.

[0072] Optionally, in another class of embodiments, the impulse response kernel may also be defined to have an axon delay D property, ie, ∈ D (t) = ∈ (tD). In this type of embodiment, the synaptic delay is also a pulse neural network parameter that the network needs to learn.

[0073] refer to Figure 2 , which is a general description of the structure of a spiking neural network. Each black circle in the figure represents a neuron mentioned above. Several neurons form a layer. The figure shows a spiking neural network with a total of L (positive integer) layers. In the network connection from the lth to the l+1th layer, the weight matrix W (l) , which corresponds to a Space; axon delay D (l) , which corresponds to a space, where N l and N l+1 The numbers of neurons in the lth layer network (abbreviated as the lth layer) and the l+1th layer network are respectively. The bottom of the figure lists some symbols involved in the present invention and the relative description position relationship of each layer.

[0074] refer to Figure 3 , which shows the connection relationship between the input pulse sequence and the input layer (l = 1). The number of input pulse sequences and the number of neurons in the input layer can be different, and the two are connected by the input weight matrix W (0) (also called input expansion matrix, which belongs to the synaptic weight matrix) to establish the mapping relationship.

[0075] The present invention discloses a pulse neural network space-time training method, storage medium and computing device, chip, and electronic product. The pulse neural network training method, also known as the pulse neural network learning method, adjusts the network parameters based on a large amount of training data. The network parameters at the time of initialization cannot enable the pulse neural network to obtain accurate reasoning results according to the input training data (forward process), but the network parameters are adjusted each time according to the error degree of the reasoning result (reverse process), so that the network moves in the direction of being able to more accurately infer the correct result. A large amount of training data is used to assist the network in adjusting the network parameters, and finally obtains relatively ideal network parameters that can basically correctly reason. After the network parameters are deployed to the neuromorphic hardware (brain-like chip), the chip can obtain the ability to complete accurate reasoning according to the actual input environmental signals in specific application scenarios.

[0076] The forward process of the spiking neural network (i.e. running the spiking neural network) is the process of feeding the network's input signal into the network and then letting the network complete the reasoning. Figure 4 as well as Figure 5 , the process includes the following steps:

[0077] Step S401: Receive a batch of sample data from the training data set. The batch of sample data (referred to as sample) includes the network input pulse sequence, the current layer number l=1, the total number of layers of the network L, the network input pulse sequence s (0) [n], time step n = 1, 2, ..., T. The current time step can be recorded as n, n = 1 is the first time step, and n = T is the last time step.

[0078] When training a network model, for a continuous data stream (such as an input pulse event), it is usually divided into multiple samples of equal length, and each sample is divided into T time steps, each time step is equal in length. Then several samples are merged into a batch, and the samples in a batch can be processed in parallel during training. However, in another type of embodiment, the same number of pulse events can also be divided into different time steps, so that the duration of each time step may not be equal. The present invention does not limit the division method of samples and their time steps.

[0079] The forward and reverse training processes of the network can be performed by a training device, which can be a server cluster, a high-performance computer with a GPU, a processor dedicated to network training and computing devices built thereon, a supercomputer, a personal computer, etc.

[0080] The sample can be an environmental signal collected from the environment, such as visual, auditory, tactile, olfactory, vibration, IMU and other types of signals, which can be digital signals or analog signals, or signals converted from other data sets. The environmental signals in the present invention include these types of signals, but are not limited thereto.

[0081] Step S402: Convolve the impulse response kernel with the input impulse sequence of the current layer (l-1) , get the input impulse response signal a of the current layer (l-1) .

[0082] refer to Figure 5 , through the convolution operation of the impulse response kernel and the input pulse sequence, the input impulse response signal a of the current layer is obtained (l-1) [n]=(∈*s (l-1) )[n], where * is the convolution operation and n is the time step marker. As the starting point of the network structure, corresponding to the l=1 layer, it should be: a (0) [n]=(∈*s (0) )[n].

[0083] Step S403: Using the current layer synaptic weight matrix W (l-1) The input impulse response signal of the current layer is weighted to obtain the first weighted result W (l-1) a (l-1) [n], and obtain the first convolution result by convolving the refractory period kernel with the output pulse sequence of the current layer, and obtain the current layer membrane voltage u based on the first weighted result and the first convolution result. (l) [n].

[0084] To avoid circular dependency calculations, when calculating membrane voltage in actual training, a convolution (v*s (l) )[n-1], and obtain the membrane voltage of the neurons in the current layer. If the time step ahead is more than 1, it is equivalent to setting the value of the front part of the refractory period nucleus to 0 (if it is 2 time steps ahead, the first bit of the refractory period nucleus is 0, if it is 3 time steps ahead, the first 2 bits of the refractory period nucleus are 0, and so on).

[0085] Step S404: Obtain the current layer output pulse sequence according to the current layer membrane voltage, and use it as the next layer input pulse sequence.

[0086] In a spiking neural network, how to define a neuron to emit a pulse is a known technique, and the present invention is not limited thereto.

[0087] Generally, in certain embodiments, it is determined based on the relationship between the neuron membrane voltage and the pulse emission threshold θ.(l) When [n]>θ, s (l) [n]=1, otherwise s (l) [n]=0.

[0088] In another type of embodiment, according to the foregoing, the "multiple pulses" emitted by neurons are determined by the ratio of the membrane voltage to the threshold value, which determines the amplitude or number of the pulses (corresponding to different implementation methods).

[0089] Step S405: Calculate the current network loss according to the output of the pulse neural network.

[0090] Current network loss (referred to as network loss) (Usually notated in this field, different from the number of network layers L) is the output s of the spiking neural network (L) [1, 2, ..., T]. The loss function of the spiking neural network can be defined in many ways, including but not limited to: mean square error, forward Kullback-Leibler difference, reverse Kullback-Leibler difference, etc. (refer to the published Chinese invention patent 202110550756.3).

[0091] Before executing step S405, steps S402 to S404 are executed cyclically, and the sequence number of the layer in the network is also incremented from l=1 to L. Figure 2 , the pulse sequence output by the neurons in the last layer (layer L) of the network, that is, the output S of the entire network (L) [1, 2, ..., T]. The network loss reflects the gap between the result of reasoning about the input data and the expected result based on the current network configuration parameters (such as the synaptic weight matrix).

[0092] Although in the above description, in the process of examining each layer of the network, the calculation of the state of the layer at all time steps (1, ..., T) has been completed, and the process is carried out layer by layer until the last layer of the network, this is not the only way. In another type of embodiment, the operating state of the entire network containing multiple layers at each time step can be examined separately, and then the operating state of the entire network at the next time step can be examined based on the entire network state at the previous time step. Both can obtain equivalent network operation reasoning results, and the present invention is not limited to the specific implementation method of network state analysis.

[0093] Based on this, the entire network completes reasoning and obtains network loss based on the batch of samples in the training data set. In the subsequent steps, the network configuration parameters are adjusted based on the network loss obtained here.

[0094] The reverse process of the spiking neural network (also known as error back propagation) is the process of adjusting the network configuration parameters (such as the synaptic weight matrix) based on the current network loss. Figure 6 and Figure 7 , which comprises the following steps:

[0095] Step S601: Calculate the current network loss at each time step n=1, 2, ..., T with respect to the l=Lth layer network output impulse response signal a (L) The first gradient of (L) [n].

[0096] The network starts from the last layer, that is, the Lth layer, and calculates the network loss Regarding the l=Lth layer network output impulse response signal a (L) The first gradient The Lth layer outputs the impulse response signal a (L) is the output pulse sequence of the Lth layer network (that is, the output S of the spiking neural network (L) The result of convolving the kernel [1, 2, ..., T]) with the impulse response kernel (from the perspective of signal processing, this process can be regarded as a "filtering" process).

[0097] Step S602: Based on the proxy gradient function, calculate the value of the first variable one by one by increasing the value m (starting from n to T)

[0098] The proxy gradient function is a common practice in the art, and its purpose is to solve the problem of non-differentiability in spiking neural networks. Any reasonable proxy gradient function is feasible here, and the present invention is not limited thereto. For example, the proxy gradient function here can be the proxy gradient function ρ(t) defined in the prior art 2, or it can be a periodic exponential function or a Heaviside function.

[0099] In some embodiments, the entire network uses a unified proxy gradient function. In other embodiments, each layer uses a different proxy gradient function, where the proxy gradient function of the lth layer network is denoted by f′ (l) [·] = f′ (l) [u (l) [·]]. In other embodiments, all network layers use certain proxy gradient functions respectively. For example, when L>2, some layers in the L-layer network select the first type of proxy gradient function, while other layers select the second type of proxy gradient function.

[0100] Calculate an element value of the first variable corresponding to the l-th layer network at the n-th time step When , the calculation formula is as follows:

[0101]

[0102] When calculating, start from m=n (The result is f′ (l) [n]), and then calculate (Using the aforementioned ), and then calculate (Used to ), and iterate until m = T, and finally get This resulted in to The value of ).

[0103] Step S603: Calculate the network loss at each time step with respect to the weighted post-synaptic input z of the lth layer (l) The second gradient d of [n] (l) [n].

[0104] Mathematically, the following formula holds true:

[0105]

[0106] The weighted postsynaptic input z of layer l is (l) [n] = W (l-1) a (l-1) [n], and have:

[0107]

[0108] Where ⊙ is a cross-correlation operation. According to the results of the above steps S601 and S602, it is easy to obtain the second gradient d (l) The value of [n].

[0109] In certain embodiments, when calculating the second gradient, the impulse response kernel may also be the aforementioned impulse response kernel with axon delay ∈ D (t)=∈(tD).

[0110] For the nth time step d (l) [n], its dependence (l) [n→T] and In other words, the present invention allocates the network loss credit from the nth to Tth time steps to the current nth time step. This step embodies the time domain dependency between pulses in the present invention.

[0111] Step S604: Calculate the network loss with respect to the synaptic weight matrix W (l-1) Gradient

[0112] Synaptic weight matrix W (l-1) It is the connection weight matrix between the lth layer (current layer) and the l-1th layer (previous layer) network.

[0113] The formula for calculating the gradient is:

[0114]

[0115] Where T is the transposition mark.

[0116] For the back propagation process of the entire network, after executing step S604 once, the current layer moves backward (relative to the forward process during network inference) by one layer, the number of layers l decreases by 1, and then step S605 is executed, and then steps S602, S603, and S604 are executed in sequence. Thus, the error is back propagated layer by layer (reflecting the spatial domain characteristics) to the input layer (the first layer). After executing step S604, if l=1, the loop is jumped out and step S606 is executed.

[0117] Step S605: For each time step, calculate the network loss with respect to the impulse response signal a of the lth layer network output (l) The first gradient of [n] (l) [n].

[0118] For the first gradient, To propagate to the previous layer, by calculating e (l) [n] = d (l+1) [n]W (l) (When l=1, 2, ..., L-1) the first gradient of the output impulse response signal of the l-th layer network is obtained. For non-L-th layer networks, the calculation of the first gradient is based on the synaptic weight matrix and the second gradient.

[0119] Step S606: Update the network synaptic weight matrix by using the gradient of the network loss with respect to the synaptic weight matrix.

[0120] The updated synaptic weight matrix is ​​obtained by calculating the gradient of the network loss obtained in the above steps with respect to the synaptic weight matrix. The updating method here is a technique well known in the art, and any suitable optimization scheme is feasible. The present invention is not limited to a specific updating method. For example, Where η is the learning rate, W *(l) is the updated synaptic weight matrix, and W (l) is the synaptic weight matrix before updating, l = 0, 1, 2, ..., L-1; and various known stochastic gradient descent (SGD) and Adam methods.

[0121] The forward process and the reverse process described above complete the learning for a batch of samples. In fact, a large number of such batches including samples are needed to support the updating / learning / training of network configuration parameters (such as synaptic weight matrices).

[0122] Of course, in addition to the synaptic weight matrix of the network, other network configuration parameters such as axon delay need to be updated in practical applications.

[0123] In certain embodiments, the neurons in the spiking neural network are LIF neurons or IAF neurons, that is, SRM neurons are specialized as LIF neurons or IAF neurons.

[0124] refer to Figure 8 , as a complete procedure for training and using a spiking neural network, it covers the following steps:

[0125] Step S1: Collect sample data to form a training data set. The sample data can be obtained by using a dynamic vision sensor (DVS) to obtain an event stream. According to the actual application data needs, DVS can be used to collect gestures (such as fists, scissors, etc.), data on people falling, face data, sitting posture data, etc. A microphone can also be used to collect voice data, such as voice about command words (turn on the light, open, close, third gear, etc.). It can also be data collected by an inertial sensor IMU, electrocardiogram / electromyography signals, etc.

[0126] Step S2: Using the training data set at least for training the synaptic weight matrix of the pulse neural network, and continuously updating the value of the synaptic weight matrix during the training.

[0127] The method for updating the value of the synaptic weight matrix here may be any of the aforementioned methods.

[0128] Step S3: By deploying the device, at least the value of the synaptic weight matrix is ​​downloaded to the brain-like chip.

[0129] The deployment device can be a computing device, such as various types of computers, on which dedicated deployment software is deployed, through which at least the value of the synaptic weight matrix of the aforementioned pulse neural network is downloaded to the brain-like chip.

[0130] A storage medium having computer code stored thereon, wherein the computer code is executed to implement the space-time domain pulse neural network training method as described in any of the above items.

[0131] A computing device, which includes a computing unit and the storage medium as described above, obtains the configuration parameters of the pulse neural network by loading or compiling the computer code on the storage medium and executing it by the computing unit.

[0132] After the brain-like chip (including the pulse neural network processor) is deployed with the aforementioned network configuration parameters including the synaptic weight matrix, it can complete specific functions after power-on. The chip is usually deployed in electronic products (toys, home appliances, cars, etc.) to play its role in detecting environmental (visual, auditory, electrocardiographic, electromyographic, etc.) signals and making judgments on environmental signals through pulse neural networks (for example, when an event is detected, a corresponding type of activation signal is sent). Usually, brain-like chips are event-triggered mechanisms, so compared to traditional solutions, they can achieve the effect of ultra-low power consumption to detect event occurrences.

[0133] Event imaging devices, such as dynamic vision sensors (DVS), are deployed with multiple independent dynamic vision pixel units, each of which independently senses changes in light brightness and independently outputs a pulse event when the light changes. The pulse event usually includes the coordinates, timestamp, and polarity of the pixel. This novel sensor eliminates the problem of large amounts of data redundancy caused by traditional visual sensors transmitting visual information to the next level in frames. Generally speaking, DVS can efficiently capture dynamic information, which is very suitable for the needs of event triggering systems.

[0134] Generally, visual information acquisition equipment tries its best to avoid sensor jitter. For example, pan / tilt devices can alleviate the jitter problem of video recording equipment, and various anti-shake algorithms and sensors are used. However, in some scenarios, the target object is not moving, or the motion information is insufficient, and electronic devices such as robots and cameras have difficulty in obtaining current status information. Therefore, it is difficult to make accurate decisions in this case.

[0135] Based on this, the present invention also proposes a solution for solving this type of problem. When the target object is not moving or the motion information is insufficient, the event imaging device can still obtain the current state information to provide information for reasonable decision-making. Fig. 9 , which shows an electronic product (electronic device) with active environment detection capability. The electronic product also includes a trigger module, a vibration device, and a dynamic visual sensor; the trigger module is controlled by the control instruction generated by the electronic product, and sends an enable signal for executing vibration to the vibration device; after receiving the enable signal, the vibration device at least drives the dynamic visual sensor to generate physical vibration.

[0136] Therefore, the DVS can capture the current environmental signal due to the vibration, and pass the captured pulse event to the pulse neural network processor for processing. In some embodiments, the DVS can be integrated with the pulse neural network processor to form a sensing and computing chip. In some embodiments, the vibration device is part of the electronic device. In some embodiments, the trigger module can formulate specific trigger logic and corresponding control instructions according to the needs of the user. For example, it can be periodic triggering, triggering after the pulse neural network processor issues a specific output (such as detecting a specific event), and continuous detection of subsequent states. In some embodiments, the DVS includes two or more DVS (binocular active detection dynamic vision).

[0137] Fig.10 This is an application example. For example, after detecting that a target person has fallen, in order to detect the latest current state of the target person, the vibration device responds to the control signal sent by the trigger module, causing the DVS to vibrate slightly, thereby capturing the visual information in the current field of view through the DVS. Based on the latest information, the latest visual state information can be obtained and handed over to the next level system for further processing.

[0138] Although the present invention has been described with reference to specific features and embodiments of the present invention, various modifications, combinations, and substitutions may be made thereto without departing from the present invention. The scope of protection of the present invention is not intended to be limited to the specific embodiments of the processes, machines, manufactures, compositions of matter, devices, methods, and steps described in the specification, and these methods and modules may also be implemented in one or more products and methods that are associated, interdependent, mutually coordinated, and preceding / following stages.

[0139] Therefore, the specification and drawings should be simply regarded as an introduction to some embodiments of the technical solution defined by the attached claims. The attached claims should be interpreted according to the principle of maximum reasonable interpretation, and are intended to cover as much as possible all modifications, changes, combinations or equivalents within the scope of the present invention, while avoiding unreasonable interpretations.

[0140] In order to achieve better technical effects or meet the needs of certain applications, those skilled in the art may make further improvements to the technical solution based on the present invention. However, even if this part of the improvement / design is creative and / or progressive, as long as it relies on the technical concept of the present invention and covers the technical features defined in the claims, the technical solution should also fall within the protection scope of the present invention.

[0141] Some of the technical features mentioned in the attached claims may have alternative technical features, or the order of certain technical processes and the order of material organization may be reorganized. After knowing the present invention, ordinary technicians in this field can easily think of these replacement means, or change the order of technical processes and the order of material organization, and then use basically the same means to solve basically the same technical problems and achieve basically the same technical effects. Therefore, even if the above-mentioned means and / or order are clearly defined in the claims, these modifications, changes, and substitutions should fall within the scope of protection of the claims based on the principle of equivalents.

[0142] In conjunction with the various method steps or modules described in the embodiments disclosed herein, they can be implemented in hardware, software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application or design constraints of the technical solution. A person of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered outside the scope of protection claimed by the present invention.

Claims

1. A method for training a space-time domain spiking neural network, the spiking neural network comprising a plurality of layers, characterized in that: The method comprises the following steps: Receive a batch of sample data from a training data set, and use the batch of sample data as input of a spiking neural network, run the spiking neural network and obtain output of the spiking neural network; wherein the sample data is one or more of visual, auditory, tactile, olfactory, electrocardiographic, electromyographic, vibration, and IMU type signals; According to the output of the pulse neural network, calculate the current network loss; Starting from the output layer of the spiking neural network as the current layer, the gradient of the current network loss with respect to the synaptic weight matrix between the current layer and the previous layer is calculated in reverse order until the gradient of the current network loss with respect to the input expansion matrix is ​​calculated; Update the synaptic weight matrix of the spiking neural network through the gradient of the current network loss with respect to the synaptic weight matrix; Wherein, before calculating the gradient of the current network loss with respect to the synaptic weight matrix between the current layer and the previous layer: at each time step, calculate the second gradient of the current network loss with respect to the weighted post-synaptic input of the current layer; And before calculating the second gradient with a certain time step as the current time step: based on the current layer and the current time step, the proxy gradient function is introduced, and the value of the obtained proxy gradient function is used as the first element value of the first variable corresponding to the current time step; when calculating the subsequent element value of the first variable corresponding to the current time step, based on the previous element value of the first variable corresponding to the current time step, all element values ​​of the first variable corresponding to the current time step are obtained.

2. A space-time domain spike neural network training method according to claim 1, characterized in that: The first variable is defined as follows: ; in, For the An element value of the first variable corresponding to the layer network at the nth time step, is the first element value of the first variable corresponding to the current time step; is the refractory kernel; "*" is the convolution operation; It is The proxy gradient function of the layer network; is the sequence number of the current layer.

3. A space-time domain spike neural network training method according to claim 2, characterized in that: The second gradient is defined as follows: ; in, For the The second gradient of the layer network at the nth time step; is the impulse response kernel; For cross-correlation operations; is the current network loss about The layer network outputs the first gradient of the impulse response signal; n is the time step number, and n=1,2,…,T, where T is the total length of the time step.

4. A space-time domain spike neural network training method according to claim 3, characterized in that: The first gradient is defined as follows: when =L, ; when {1,…,L-1}, ; in, It is Layer network and +1 synaptic weight matrix between layers of the network; It is the result of convolution of the output pulse sequence of the L-th layer network with the impulse response kernel; is the current network loss.

5. A space-time domain spike neural network training method according to claim 4, characterized in that: Calculate the current network loss about the synaptic weight matrix between the current layer and the previous layer The gradient of is: ; in, The transpose mark.

6. A space-time domain spike neural network training method according to claim 5, characterized in that: After calculating the gradient of the current network loss with respect to the synaptic weight matrix between the current layer and the previous layer, if {2,…,L}, then the network layer is shifted forward by one layer, that is, the shifted layer is taken as the current layer, and for the new current layer, the gradient of the current network loss with respect to the synaptic weight matrix between the current layer and the previous layer is calculated; if =1, the network synaptic weight matrix is ​​updated by the gradient of the network loss with respect to the synaptic weight matrix.

7. The space-time domain spike neural network training method according to any one of claims 1 to 6, characterized in that: The neurons in the spiking neural network are LIF neurons.

8. A space-time domain spike neural network training method according to any one of claims 1 to 6, characterized in that: The neurons in the spiking neural network are IAF neurons.

9. A storage medium having computer code stored thereon, characterized in that: By executing the computer code, the space-time domain pulse neural network training method described in any one of claims 1 to 8 is implemented.

10. A computing device, characterized in that: The computing device includes a computing unit and a storage medium as described in claim 9, and the configuration parameters of the pulse neural network are obtained by loading or compiling the computer code on the storage medium and executing it by the computing unit.

11. A chip comprising a spiking neural network processor, characterized in that: The pulse neural network processor is deployed with configuration parameters of the pulse neural network, and the configuration parameters of the pulse neural network at least include the synaptic weight matrix of the pulse neural network obtained by the space-time domain pulse neural network training method as described in any one of claims 1-8.

12. An electronic product, characterized in that: The electronic product comprises the chip as claimed in claim 11.

13. The electronic product according to claim 12, characterized in that: The electronics also include a trigger module and a vibration device, as well as a dynamic vision sensor; The trigger module is controlled by the control instruction generated by the electronic product and sends an enabling signal for executing vibration to the vibration device; After receiving the enabling signal, the vibration device at least drives the dynamic vision sensor to generate physical vibration.

Citation Information

Patent Citations

  • Neural network configuration parameter training and deploying method and device for coping with device mismatch

    CN113313233A

  • Method for generating spatial-temporal upsampler of pulse array signal

    CN110426560A

  • Training method of convolutional pulse neural network based on reweighted membrane voltage

    CN112633497A