Double-weight bidirectional predictive coding method and neural network training method

By introducing the dual-weight bidirectional predictive coding method into the deep neural network, and using the coupling of forward and reverse function chains to update the node status, the problem of insufficient biological rationality and robustness in the deep network is solved, and the problem of insufficient biological rationality and robustness in the deep network is realized. Stable training and high-precision learning.

CN118673983AActive Publication Date: 2024-09-20CHINA NANHU ACAD OF ELECTRONICS & INFORMATION TECH

Patent Information

Application Number
CN202310276472.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2024-09-20
Estimated Expiration
2043-03-15

AI Technical Summary

Technical Problem

The error back propagation of the existing deep neural network learning algorithm does not have biological credibility and is sensitive to noise, resulting in poor robustness. Especially in deep networks, it is easy to collapse due to unstable forward errors and cannot continue to learn.

Method used

A dual-weighted bidirectional predictive coding method is proposed. By defining forward and reverse function chains, the intermediate layer node status is independently updated, and the forward and reverse output node status is coupled by a scale factor, adding a feedback link to enhance biological rationality. and robustness.

Benefits of technology

It effectively supplements the biological rationality and avoids the collapse problem caused by the sudden increase in the node status of the middle layer, making the neural network more robust and biologically rational in deep training, and can achieve higher performance on real data sets. Accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673983A
    Figure CN118673983A
Patent Text Reader

Abstract

The invention discloses a double-weight bidirectional predictive coding method and a neural network training method.The double-weight bidirectional predictive coding method comprises the steps that a forward function chain and a reverse function chain are defined between given input and labels, and the forward function chain and the reverse function chain have independent parameters and intermediate layer node states; and updating the node state of the middle layer based on the forward function chain and the reverse function chain. According to the bidirectional predictive coding method, two function chains are defined, on one hand, the biological rationality of the visual cortex is complemented; and on the other hand, bidirectional errors generated by bidirectional linking of the model jointly act on updating of the node state of the middle layer, so that the node state of the middle layer changes in a reasonable interval, and the problem that the StrictPC algorithm cannot be trained in a deep network is solved. In addition, noise generated in the reverse mapping generation process participates in the whole training process, so that the model is more robust.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of neural network, and in particular relates to a dual-weight bidirectional prediction coding method and a neural network training method. Background Art

[0002] As the number of network layers and expression capabilities of deep neural networks continue to increase, they have achieved great success in computer tasks including image classification, video prediction, and image segmentation. However, current deep neural networks still have significant limitations. On the one hand, the back propagation of errors in the learning algorithm currently used by deep neural networks has been proven to be not biologically credible. Back propagation updates weights through chain derivation, and each weight update depends on the activity and calculation of all downstream neurons. But biological synaptic updates only change their connection strength based on local signals (for example, the activity of their neighboring neurons). Moreover, back propagation uses the same weights as forward propagation information. This weight symmetry suggests that neurons should have the same connections in both directions, but this is not biologically reasonable in the brain. On the other hand, deep neural networks currently trained using back propagation are very sensitive to noise. For example, CNN networks can be misled by known imperceptible noise and have poor robustness.

[0003] Predictive coding is an influential theory of cortical function in theoretical neuroscience and computational neuroscience. The core idea of ​​the theory is that the core function of the brain is to minimize the prediction error between what is expected to happen and what actually happens. Predictive coding believes that the visual cortex of the brain is composed of multiple layers and is bidirectionally connected. These structures can predict the activity of the next layer and generate prediction errors that are then transmitted upward to higher layers for processing. Over time, synaptic connections are adjusted, allowing the system to improve in minimizing prediction errors. Therefore, a deep neural network learning method based on predictive coding theory is more biologically reasonable and robust, and can effectively make up for the limitations of current deep neural network learning.

[0004] Existing technologies such as K. Friston extended predictive coding to approximate Bayesian inference of Gaussian generative models, and the variables in the model can be mapped to explicit probability elements of the generative model. This makes predictive coding feasible in artificial neural networks. Beren Millidge et al. proved that predictive coding can be automatically differentiated along any computational graph and implemented predictive coding on shallow CNN networks. This predictive coding derived from variational inference under Gaussian generative models is called the classic StrictPC algorithm.

[0005] The StrictPC algorithm initializes a set of belief values ​​v about the state of each neuron node l , then update the node belief value v l, making it more consistent with the observed values ​​x and y, and the parameters θ. l} l The number of belief values ​​under a set of L is {v l} l The resulting error can be expressed as follows:

[0006] ∈ l =f l (v l-1 θ l )-v l

[0007] Then we can define the sum of the errors as F:

[0008]

[0009] Under the model formulation of approximate Bayesian inference, F is approximated by the variational free energy.

[0010] Further explanation, ∈ l is the error caused by the previous layer prediction, so ∈ l is called the “prediction error”, and F quantifies the total magnitude of the error. In predictive coding, the belief v is updated by minimizing F. l . This is done via gradient descent:

[0011] v l ←v l +ηdv l

[0012] where η is the step size,

[0013] Parameter θ l We also use gradient descent to minimize F for learning updates:

[0014] θ l =θ l +η θ dθ l

[0015] where η θ is the step length,

[0016] By continuously iterating v l and θ l Stop until convergence or near convergence.

[0017] Because the update of the intermediate nodes and parameters of the network model is only completed by local error gradient descent, it is more biologically reasonable than the BP neural network. However, the classic StrictPC method only has one feedforward connection, and in the visual cortex of the biological brain, it is found that the transmission of signals in the hierarchical structure of the cerebral cortex is bidirectional. Therefore, the current StrictPC algorithm is not biologically reasonable enough. The update of the intermediate node v in the StrictPC algorithm only depends on the error of the forward transmission, so during the training process of the deep neural network, the v value will suddenly increase due to the instability of the forward error, causing the entire deep network to collapse and unable to continue learning. Summary of the invention

[0018] One of the purposes of the present invention is to provide a dual-weight bidirectional predictive coding method so that network training has biological rationality and strong robustness.

[0019] To achieve the above object, the technical solution adopted by the present invention is:

[0020] A dual-weighted bidirectional predictive coding method for neural network training, the dual-weighted bidirectional predictive coding method comprising:

[0021] Define a forward function chain and a reverse function chain between a given input and a label, wherein the forward function chain and the reverse function chain have independent parameters and intermediate layer node states;

[0022] The intermediate layer node status is updated based on the forward function chain and the reverse function chain.

[0023] Preferably, each intermediate layer of the neural network has a forward mapping function and a reverse mapping function.

[0024] Preferably, the forward mapping function and the reverse mapping function are not inverse functions of each other.

[0025] Preferably, the input and the label given in the definition have a forward function chain and a reverse function chain, including:

[0026] The forward mapping function and the reverse mapping function of each intermediate layer are set to have independent parameters and node states, wherein the parameters include bias and weight;

[0027] Take the forward mapping function of each intermediate layer, define the forward mapping function to flow from the low-level structure to the high-level structure, and the forward mapping functions of all intermediate layers are transferred to form a forward function chain;

[0028] Take the reverse mapping function of each intermediate layer, define the reverse mapping function to flow from the high-level structure to the low-level structure, and the transmission of the reverse mapping functions of all intermediate layers forms a reverse function chain.

[0029] Preferably, the updating of the intermediate layer node state based on the forward function chain and the reverse function chain includes:

[0030] Calculate the forward error and reverse error of each intermediate layer based on the forward function chain and the reverse function chain;

[0031] First, the forward output node state and the reverse output node state of the middle layer are independently updated through error gradient descent, and then the forward output node state and the reverse output node state are coupled through the proportional factor to complete the update of the middle layer node state.

[0032] Preferably, the calculating of the forward error and the reverse error of each intermediate layer based on the forward function chain and the reverse function chain comprises:

[0033] Calculate the forward error and reverse error for each intermediate layer:

[0034] ∈ l =v l -f l (v l-1 θ l )

[0035]

[0036] In the formula, ∈ l is the forward error of the middle layer of the lth layer, is the reverse error of the middle layer of the lth layer, v l is the forward output node state of the middle layer of the lth layer, f l is the forward mapping function of the lth intermediate layer, v l-1 is the forward output node state of the middle layer of the l-1th layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, is the reverse mapping function of the middle layer of the lth layer, is the forward output node state of the middle layer of the l+2th layer, is the parameter of the reverse mapping function of the lth intermediate layer.

[0037] Preferably, the forward output node state and the reverse output node state of the middle layer are independently updated by error gradient descent, and then the forward output node state and the reverse output node state are coupled by a proportional factor to complete the update of the middle layer node state, including:

[0038] Calculate the forward error increment and reverse error increment for each intermediate layer:

[0039]

[0040]

[0041] In the formula, dv l is the positive error increment of the middle layer of the lth layer, is the reverse error increment of the middle layer of the lth layer, ∈ l is the positive error of the middle layer of the lth layer, ∈ l+1 is the forward error of the middle layer of the l+1th layer, f l+1 is the forward mapping function of the l+1th intermediate layer, v l is the forward output node state of the middle layer of the lth layer, θ l+1 is the parameter of the forward mapping function of the l+1th intermediate layer, is the reverse error of the middle layer of the lth layer, is the reverse error of the middle layer of the l-1th layer, is the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, The parameters of the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer;

[0042] The first update of the l-th layer forward output node state v l and the l+1th layer reverse output node state Recorded as intermediate parameters and

[0043]

[0044]

[0045] Where η is the node update step size;

[0046] The forward output node state and the reverse output node state of the middle layer are coupled by the proportional factor to update the forward output node state v of the lth layer for the second time. l and the l+1th layer reverse output node state

[0047]

[0048]

[0049] Where β is the proportional factor.

[0050] Preferably, the method further includes updating the parameters of each intermediate layer after the iteration, including:

[0051]

[0052]

[0053] θ l =θ l +η θ dθ l

[0054]

[0055] Where dθ l is the positive parameter error increment of the lth intermediate layer, ∈ l is the forward error of the middle layer of the lth layer, f l is the forward mapping function of the lth intermediate layer, v l-1 is the forward output node state of the middle layer of the l-1th layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse parameter error increment of the middle layer of the lth layer, is the reverse error of the middle layer of the lth layer, is the reverse mapping function of the middle layer of the lth layer, is the forward output node state of the middle layer of the l+2th layer, is the parameter of the reverse mapping function of the lth intermediate layer, η θ is the parameter update step size of the forward mapping function, Update step size for the parameters of the reverse mapping function.

[0056] The present invention provides a dual-weight bidirectional predictive coding method, which defines two function chains, respectively in forward and reverse mapping. Compared with the StrictPC algorithm, a feedback link is added. Based on the feedback link, on the one hand, the biological rationality of the visual cortex is supplemented. On the other hand, the bidirectional errors generated by the bidirectional links jointly act on the update of the states of the middle layer nodes, so that the states of the middle layer nodes change within a reasonable range, solving the problem that the StrictPC algorithm cannot be trained in deep networks. In addition, the noise generated by the reverse mapping during the generation process participates in the entire training process, making the trained neural network model more robust.

[0057] A second object of the present invention is to provide a neural network training method so that the network training has biological rationality and strong robustness.

[0058] To achieve the above object, the technical solution adopted by the present invention is:

[0059] A neural network training method, the neural network training method comprising:

[0060] Define the forward and reverse mapping functions used to construct the network layers of the neural network;

[0061] Build a neural network based on the defined network layers;

[0062] The number of training times is set, batch data is input into the neural network, and the dual-weight bidirectional predictive coding method is cyclically called under a given number of training times to train the constructed neural network.

[0063] Preferably, the forward mapping function and the reverse mapping function of the network layer used to construct the neural network are defined, including:

[0064] The network layer includes a convolutional layer, a pooling layer and a linear layer, and the forward mapping function and the reverse mapping function of the network layer are respectively:

[0065] The forward mapping function of the convolution layer is the nn.Conv2d function, and the reverse mapping function of the convolution layer is the nn.ConvTranspose2d function; the forward mapping function of the pooling layer is the nn.MaxPool2d function, and the reverse mapping function of the pooling layer is the nn.MaxUnpool2d function; the forward mapping function of the linear layer is the nn.Linear function, and the reverse mapping function of the linear layer is also the nn.Linear function.

[0066] The present invention provides a neural network training method, which defines two function chains in the neural network, respectively in forward and reverse mapping. Compared with the StrictPC algorithm, a feedback link is added. Based on the feedback link, on the one hand, the biological rationality of the visual cortex is supplemented. On the other hand, the bidirectional errors generated by the bidirectional links jointly act on the update of the states of the middle layer nodes, so that the states of the middle layer nodes change within a reasonable range, solving the problem that the StrictPC algorithm cannot be trained in deep networks. In addition, the noise generated by the reverse mapping during the generation process participates in the entire training process, making the trained neural network model more robust. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 A schematic diagram of double-weighted bidirectional predictive coding in the bidirectional predictive coding method of the present invention;

[0068] Figure 2 This is a network structure diagram of the deep convolutional network constructed in Example 5 of the present invention;

[0069] Figure 3 It is a schematic diagram of the test accuracy of the bidirectional predictive coding algorithm in Example 5 of the present invention and the classic StrictPC algorithm on the Cifar10 data set;

[0070] Figure 4 This is a comparison chart of the accuracy of the bidirectional predictive coding algorithm and the restnet18 algorithm in Example 5 of the present invention under different Gaussian noises on the Cifar10 data set;

[0071] Figure 5 This is a loss comparison diagram of the bidirectional predictive coding algorithm and the restnet18 algorithm in Example 5 of the present invention under different Gaussian noises on the Cifar10 data set;

[0072] Figure 6 This is a comparison chart of the accuracy of the bidirectional predictive coding algorithm, the StrictPC algorithm and the bp algorithm in Example 5 of the present invention under different Gaussian noises on the Cifar10 data set;

[0073] Figure 7 This is a loss comparison diagram of the bidirectional predictive coding algorithm, StrictPC algorithm and bp algorithm in Example 5 of the present invention under different Gaussian noises on the Cifar10 dataset. DETAILED DESCRIPTION

[0074] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0075] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0076] This embodiment discloses a dual-weight bidirectional predictive coding method with biological rationality and strong robustness. The method defines two function chains, forward and reverse, where the forward mapping extracts features from the input, and the reverse mapping is the prediction of the high-level activity of the low-level and the reverse error is also added to the free energy, and the node state is updated by the gradient descent of the free energy.

[0077] Example 1

[0078] like Figure 1 As shown, a dual-weight bidirectional predictive coding method includes: defining a forward function chain and a reverse function chain between a given input and a label, the forward function chain and the reverse function chain having independent parameters and intermediate layer node states; and updating the intermediate layer node states based on the forward function chain and the reverse function chain.

[0079] The dual-weight bidirectional predictive coding method of this embodiment is composed of two function chains, forward and reverse, which means that each intermediate layer of the neural network as a training object has a forward mapping function and a reverse mapping function. In addition, the forward mapping function and the reverse mapping function in this embodiment are not inverse functions of each other, and both have independent mapping functions and parameters.

[0080] In this embodiment, a forward mapping function and a reverse mapping function are defined as follows: the forward mapping function of the convolution layer uses the nn.Conv2d function in pytorch, and the reverse mapping function of the convolution layer uses the nn.ConvTranspose2d function in pytorch; the forward mapping function of the pooling layer uses the nn.axPool2d function in pytorch, and the reverse mapping function of the pooling layer uses the nn.MaxUnpool2d function in pytorch; the forward mapping function of the linear layer is the nn.Linear function in pytorch, and the reverse mapping function of the linear layer is also the nn.Linear function in pytorch, but the input and output dimensions are different. The forward mapping function and reverse mapping function of the above modules have independent weight and bias parameters.

[0081] It is easy to understand that the above is the definition method of the forward mapping function and the reverse mapping function provided in this embodiment. In other embodiments, the function can be adjusted according to the actual application scenario.

[0082] When defining the forward function chain and the reverse function chain, first set the forward mapping function and the reverse mapping function of each intermediate layer to have independent parameters (including bias and weight) and node status; then take the forward mapping function of each intermediate layer, define the forward mapping function to flow from the low-level structure to the high-level structure, and the transfer of the forward mapping functions of all intermediate layers forms a forward function chain, and a forward function chain maps input to output; finally, take the reverse mapping function of each intermediate layer, define the reverse mapping function to flow from the high-level structure to the low-level structure, and the transfer of the reverse mapping functions of all intermediate layers forms a reverse function chain, and a reverse function chain completes the mapping of high-level features to low-level features.

[0083] In order to avoid the problem that the node state value suddenly becomes large due to the instability of the forward error during the deep neural network training process, causing the entire deep network to crash and be unable to continue learning. In the iterative training of the neural network in this embodiment, there are middle-layer forward nodes in the forward function chain and middle-layer reverse nodes in the reverse function chain. Based on the forward error and the reverse error, the forward output node state and the reverse node state of the middle layer are first independently updated by error gradient descent, and then the forward output node state and the reverse node state are coupled by the proportional factor to complete the update of the middle-layer node state. The specific update process is as follows:

[0084] Calculate the forward error and reverse error for each intermediate layer:

[0085] ∈ l =v l -f l (v l-1 θ l )

[0086]

[0087] In the formula, ∈ l is the forward error of the middle layer of the lth layer, is the reverse error of the middle layer of the lth layer, v l is the forward output node state of the middle layer of the lth layer, f l is the forward mapping function of the lth intermediate layer, v l-1 is the forward output node state of the middle layer of the l-1th layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, is the reverse mapping function of the middle layer of the lth layer, is the forward output node state of the middle layer of the l+2th layer, is the parameter of the reverse mapping function of the lth intermediate layer.

[0088] Calculate the forward error increment and reverse error increment for each intermediate layer:

[0089]

[0090]

[0091] In the formula, dv l is the positive error increment of the middle layer of the lth layer, is the reverse error increment of the middle layer of the lth layer, ∈ l is the positive error of the middle layer of the lth layer, ∈ l+1 is the forward error of the middle layer of the l+1th layer, f l+1 is the forward mapping function of the l+1th intermediate layer, v l is the forward output node state of the middle layer of the lth layer, θ l+1 is the parameter of the forward mapping function of the l+1th intermediate layer, is the reverse error of the middle layer of the lth layer, is the reverse error of the middle layer of the l-1th layer, is the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, The parameters of the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer;

[0092] The first update of the l-th layer forward output node state v l and the l+1th layer reverse output node state Recorded as intermediate parameters and

[0093]

[0094]

[0095] Where η is the node update step size;

[0096] The forward output node state and the reverse output node state of the middle layer are coupled by the proportional factor to update the forward output node state v of the lth layer for the second time. l and the l+1th layer reverse output node state

[0097]

[0098]

[0099] Where β is the proportional factor.

[0100] After the iteration, update the parameters of each intermediate layer, including:

[0101]

[0102]

[0103] θ l =θ l +η θ dθ l

[0104]

[0105] Where dθ l is the forward parameter error increment of the middle layer of the lth layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse parameter error increment of the middle layer of the lth layer, is the parameter of the reverse mapping function of the lth intermediate layer, η θ is the parameter update step size of the forward mapping function, Update step size for the parameters of the reverse mapping function.

[0106] The classic StrictPC algorithm is prone to explosion during deep neural network training, so it cannot learn well on real image data sets and cannot achieve high accuracy. The dual-weighted bidirectional predictive coding method proposed in this embodiment adds a reverse function chain, and the reverse prediction information can be fed back to adjust the update value of the intermediate hidden layer node so that its change is no longer too extreme. This makes the predictive coding available on deep neural networks and can achieve high accuracy on real data sets. In addition, bidirectional predictive coding generates noise in the reverse prediction process and passes it to the forward prediction, which is equivalent to multiple learning in a noisy environment. Therefore, this embodiment has higher robustness than the classic StrictPC algorithm.

[0107] Example 2

[0108] A neural network training method comprises the following steps:

[0109] Step 1: Define the network layer used to build the neural network with a forward mapping function and a reverse mapping function.

[0110] Define the forward mapping function f and reverse mapping function f of the convolutional layer, pooling layer, linear layer, etc. in the neural network b For example, in this embodiment, a forward mapping function and a reverse mapping function are defined as follows: the forward mapping function of the convolution layer uses the nn.Conv2d function in pytorch, and the reverse mapping function of the convolution layer uses the nn.ConvTranspose2d function in pytorch; the forward mapping function of the pooling layer uses the nn.axPool2d function in pytorch, and the reverse mapping function of the pooling layer uses the nn.MaxUnpool2d function in pytorch; the forward mapping function of the linear layer is the nn.Linear function in pytorch, and the reverse mapping function of the linear layer is also the nn.Linear function in pytorch, but the input and output dimensions are different. The forward mapping function and reverse mapping function of the above modules have independent weight and bias parameters.

[0111] It should be noted that this embodiment takes the basic network layers (convolutional layer, pooling layer, linear layer) of the neural network as an example for explanation. If there are new network layers, the forward mapping function and the reverse mapping function can be customized and applied in this application.

[0112] Step 2: Construct a neural network using the convolutional layer, pooling layer, and linear layer with forward mapping functions and reverse inverse functions defined in step 1. The neural network is based on network layers. In practical applications, appropriate network layers can be selected in sequence. This embodiment does not specifically describe how to select network layers to construct a neural network.

[0113] Step 3: Set the number of training times, input batch data into the neural network, and cyclically call the dual-weight bidirectional predictive coding method to train the constructed neural network under the given number of training times. The specific iterative process of a single training is as follows:

[0114] Given input x, label y, initialize the positive belief value and reverse belief value of each layer, that is, the positive output node state v of the middle layer l , the middle layer outputs the node status in reverse Forward loss function L, reverse loss function L b and the number of iterations n.

[0115] L(v L ,y)=CrossEntropyLoss(v L ,y)

[0116]

[0117] In the formula, v L is the forward output node state of the last layer, is the reverse output node state of the first layer, CrossEntropyLoss is the cross entropy loss function, and MSELoss is the mean square loss function.

[0118] In n iterations, the forward error and reverse error of each intermediate layer are calculated:

[0119] ∈ l =v l -f l (v l-1 θ l )

[0120]

[0121] In the formula, ∈ l is the forward error of the middle layer of the lth layer, is the reverse error of the middle layer of the lth layer, v l is the forward output node state of the middle layer of the lth layer, f l is the forward mapping function of the lth intermediate layer, v l-1 is the forward output node state of the middle layer of the l-1th layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, is the reverse mapping function of the middle layer of the lth layer, is the forward output node state of the middle layer of the l+2th layer, is the parameter of the reverse mapping function of the lth intermediate layer.

[0122] Calculate the forward error increment and reverse error increment for each intermediate layer:

[0123]

[0124]

[0125] In the formula, dv l is the positive error increment of the middle layer of the lth layer, is the reverse error increment of the middle layer of the lth layer, ∈ l is the positive error of the middle layer of the lth layer, ∈ l+1 is the forward error of the middle layer of the l+1th layer, f l+1 is the forward mapping function of the l+1th intermediate layer, v l is the forward output node state of the middle layer of the lth layer, θ l+1 is the parameter of the forward mapping function of the l+1th intermediate layer, is the reverse error of the middle layer of the lth layer, is the reverse error of the middle layer of the l-1th layer, is the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, The parameters of the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer;

[0126] The first update of the l-th layer forward output node state v l and the l+1th layer reverse output node state Recorded as intermediate parameters and

[0127]

[0128]

[0129] Where η is the node update step size;

[0130] The forward output node state and the reverse output node state of the middle layer are coupled by the proportional factor to update the forward output node state v of the lth layer for the second time. l and the l+1th layer reverse output node state

[0131]

[0132]

[0133] Where β is the proportional factor.

[0134] After n iterations, update v l and After that, the parameters θ of the forward mapping of each layer of the neural network are l and the parameters of the inverse mapping The updates are as follows:

[0135]

[0136]

[0137] θ l =θ l +η θ dθ l

[0138]

[0139] Where dθ l is the forward parameter error increment of the middle layer of the lth layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse parameter error increment of the middle layer of the lth layer, is the parameter of the reverse mapping function of the lth intermediate layer, η θ is the parameter update step size of the forward mapping function, Update step size for the parameters of the reverse mapping function.

[0140] Example 3

[0141] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the dual-weighted bidirectional predictive coding method described in Example 1 are implemented.

[0142] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program. 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.

[0143] Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various 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).

[0144] Example 4

[0145] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the neural network training method described in Example 3 are implemented.

[0146] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program. 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.

[0147] Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various 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).

[0148] Example 5

[0149] The present invention adds a reverse function chain to the classic StrictPC, thereby enabling the deep neural network to learn well on real data sets and enhancing the robustness of the model. The effectiveness of the method of the present invention is verified by a specific experiment.

[0150] The experiment constructed a deep convolutional network with 11 intermediate layers, the activation function was tanh function, the normalization method was weight_norm, and the experiment was conducted on the Cifar10 dataset. The network structure of the deep convolutional network is as follows Figure 2 As shown, from the input layer Vin to the output layer Vout, the 11 intermediate layers are named layer 1 to layer 11 in sequence, where the functions of each layer are as follows:

[0151] The first layer is the convolution layer. The forward mapping function of the convolution layer is the convolution function Conv2d with a convolution kernel of 3*3, 3 input channels, and 128 output channels. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with a convolution kernel of 3*3, 128 input channels, and 3 output channels.

[0152] The second layer is the pooling convolution layer. The forward mapping function of the pooling layer is the maximum pooling function Maxpool with kernel_size of 2 and stride of 2. The forward mapping function of the convolution layer is the convolution function Conv2d with convolution kernel 3*3, input channel number 128 and output channel number 256. The reverse mapping function of the pooling layer is the inverse maximum pooling function MaxUnpool with kernel_size of 2 and stride of 2. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with convolution kernel 3*3, input channel number 256 and output channel number 128.

[0153] The third layer is the pooling convolution layer. The forward mapping function of the pooling layer is the maximum pooling function Maxpool with kernel_size of 2 and stride of 2. The forward mapping function of the convolution layer is the convolution function Conv2d with convolution kernel 3*3, input channel number 256 and output channel number 512. The reverse mapping function of the pooling layer is the inverse maximum pooling function MaxUnpool with kernel_size of 2 and stride of 2. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with convolution kernel 3*3, input channel number 512 and output channel number 256.

[0154] The 4th layer is the pooling convolution layer. The forward mapping function of the pooling layer is the maximum pooling function Maxpool with kernel_size of 2 and stride of 2. The forward mapping function of the convolution layer is the convolution function Conv2d with convolution kernel 3*3, 512 input channels and 120 output channels. The reverse mapping function of the pooling layer is the inverse maximum pooling function MaxUnpool with kernel_size of 2 and stride of 2. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with convolution kernel 3*3, 120 input channels and 512 output channels.

[0155] The fifth layer is the convolution layer. The forward mapping function of the convolution layer is the convolution function Conv2d with a convolution kernel of 1*1, 120 input channels, and 256 output channels. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with a convolution kernel of 1*1, 256 input channels, and 120 output channels.

[0156] The 6th layer is the convolution layer. The forward mapping function of the convolution layer is the convolution function Conv2d with a convolution kernel of 1*1, 256 input channels, and 80 output channels. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with a convolution kernel of 1*1, 80 input channels, and 256 output channels.

[0157] The 7th layer is the convolution layer. The forward mapping function of the convolution layer is the convolution function Conv2d with a convolution kernel of 3*3, 80 input channels, and 64 output channels. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with a convolution kernel of 3*3, 64 input channels, and 80 output channels.

[0158] The 8th layer is the convolution layer. The forward mapping function of the convolution layer is the convolution function Conv2d with a convolution kernel of 3*3, 64 input channels, and 100 output channels. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with a convolution kernel of 3*3, 100 input channels, and 64 output channels.

[0159] The 9th layer is the pooling convolution layer. The forward mapping function of the pooling layer is the maximum pooling function Maxpool with kernel_size of 2 and stride of 2. The forward mapping function of the convolution layer is the convolution function Conv2d with convolution kernel 3*3, input channel number 100 and output channel number 50. The reverse mapping function of the pooling layer is the inverse maximum pooling function MaxUnpool with kernel_size of 2 and stride of 2. The reverse mapping function of the convolution layer is the deconvolution function ConvTranspose2d with convolution kernel 3*3, input channel number 50 and output channel number 100.

[0160] The 10th layer is a linear layer (fully connected layer). The forward mapping function of the linear layer is a linear function with an input dimension of 200 and an output dimension of 512. The reverse mapping function of the linear layer is a linear function with an input dimension of 512 and an output dimension of 200.

[0161] The 11th layer is a linear layer. The forward mapping function of the linear layer is a linear function Linear with an input dimension of 512 and an output dimension of the output layer dimension. The reverse mapping function of the linear layer is a linear function Linear with an input dimension of the output layer dimension and an output dimension of 512.

[0162] like Figure 3 As shown in the figure, the test accuracy of the bidirectional predictive coding algorithm and the StrictPC algorithm on the Cifar10 dataset, the horizontal axis is the epoch number (iteration number), and the vertical axis is the test accuracy (test accuracy). The rectangular line is the double-weighted bidirectional predictive coding (DoubleWeight BiPC, referred to as BiPC), and it can be seen that it can reach more than 80% accuracy on the Cifar10 dataset. In addition, the five-pointed star line is the classic StrictPC algorithm, and it can be seen that the StrictPC algorithm will suddenly experience a drop in accuracy in deep convolutional network training and cannot complete the image classification task on the real dataset.

[0163] like Figure 4 As shown in the figure, the horizontal axis is log(std) (Gaussian noise), and the vertical axis is accuracy (accuracy). The rectangular lines are the test accuracy of the bi-weighted bidirectional predictive coding (BiPC test acc), and the triangular lines are the test accuracy of the restnet18 algorithm (restnet18 test acc). Figure 5 As shown in the figure, the horizontal axis is log(std) (Gaussian noise), and the vertical axis is loss (loss), where the rectangular line is the test loss of dual-weight bidirectional predictive coding (BiPC test loss), and the triangular line is the test loss of the restnet18 algorithm (restnet18 test loss). Figure 4 , 5 The figure shows the robustness comparison results of deep DNNs with the same structure, all of which are 80% test accuracy neural network models. It can be seen that when using Gaussian noise of different var levels for attack, the bidirectional predictive coding algorithm of the present invention is more robust than the existing restnet18 algorithm.

[0164] like Figure 6As shown in the figure, the horizontal axis is log(std) (Gaussian noise), and the vertical axis is accuracy (accuracy), where the rectangular line is the test accuracy of the bi-weighted bidirectional predictive coding (BiPC test acc), the five-pointed star line is the test accuracy of the StrictPC algorithm (strict test acc), and the triangle line is the test accuracy of the bp algorithm (bp testacc). Figure 7 As shown in the figure, the horizontal axis is log(std) (Gaussian noise), and the vertical axis is loss (loss), where the rectangular lines are the test loss of dual-weight bidirectional predictive coding (BiPC test loss), the five-pointed star lines are the test loss of the StrictPC algorithm (strict test loss), and the triangular lines are the test loss of the bp algorithm (bp test loss). Figure 6 , 7 The robustness comparison results of the shallow DNN with the same structure and the neural network model with the same test accuracy are shown in the figure. It can be seen that when using Gaussian noise with different var levels for attack, the robustness is from large to small: bi-weighted bidirectional predictive coding (BiPC)>strictPC algorithm>bp algorithm.

[0165] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0166] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.

Claims

1. A dual-weight bidirectional predictive coding method for neural network training, It is characterized in that The dual-weight bidirectional predictive coding method comprises: Define a forward function chain and a reverse function chain between a given input and a label, wherein the forward function chain and the reverse function chain have independent parameters and intermediate layer node states; The intermediate layer node status is updated based on the forward function chain and the reverse function chain.

2. The dual-weighted bidirectional predictive coding method according to claim 1, It is characterized in that Each intermediate layer of the neural network has a forward mapping function and a reverse mapping function.

3. The dual-weighted bidirectional predictive coding method according to claim 2, It is characterized in that The forward mapping function and the reverse mapping function are not inverse functions of each other.

4. The dual-weighted bidirectional predictive coding method according to claim 2, It is characterized in that The definition provides a forward function chain and a reverse function chain between the given input and the label, including: The forward mapping function and the reverse mapping function of each intermediate layer are set to have independent parameters and node states, wherein the parameters include bias and weight; Take the forward mapping function of each intermediate layer, define the forward mapping function to flow from the low-level structure to the high-level structure, and the forward mapping functions of all intermediate layers are transferred to form a forward function chain; Take the reverse mapping function of each intermediate layer, define the reverse mapping function to flow from the high-level structure to the low-level structure, and the transmission of the reverse mapping functions of all intermediate layers forms a reverse function chain.

5. The dual-weighted bidirectional predictive coding method according to claim 1, It is characterized in that The updating of the intermediate layer node status based on the forward function chain and the reverse function chain includes: Calculate the forward error and reverse error of each intermediate layer based on the forward function chain and the reverse function chain; First, the forward output node state and the reverse output node state of the middle layer are independently updated through error gradient descent, and then the forward output node state and the reverse output node state are coupled through the proportional factor to complete the update of the middle layer node state.

6. The dual-weighted bidirectional predictive coding method according to claim 5, It is characterized in that The calculating of the forward error and the reverse error of each intermediate layer based on the forward function chain and the reverse function chain includes: Calculate the forward error and reverse error for each intermediate layer: ∈ l =v l -f i (v l-1 ;θ l ) In the formula, ∈ l is the forward error of the middle layer of the lth layer, is the reverse error of the middle layer of the lth layer, v l is the forward output node state of the middle layer of the lth layer, f l is the forward mapping function of the lth intermediate layer, v l-1 is the forward output node state of the middle layer of the l-1th layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, f l b is the reverse mapping function of the middle layer of the lth layer, is the forward output node state of the middle layer of the l+2th layer, is the parameter of the reverse mapping function of the lth intermediate layer.

7. The dual-weighted bidirectional predictive coding method according to claim 5, It is characterized in that First, the forward output node state and the reverse output node state of the middle layer are independently updated by error gradient descent, and then the forward output node state and the reverse output node state are coupled by the proportional factor to complete the update of the node state of the middle layer, including: Calculate the forward error increment and reverse error increment for each intermediate layer: In the formula, dv l is the positive error increment of the middle layer of the lth layer, is the reverse error increment of the middle layer of the lth layer, ∈ l is the positive error of the middle layer of the lth layer, ∈ l+1 is the forward error of the middle layer of the l+1th layer, f l+1 is the forward mapping function of the l+1th intermediate layer, v l is the forward output node state of the middle layer of the lth layer, θ l+1 is the parameter of the forward mapping function of the l+1th intermediate layer, is the reverse error of the middle layer of the lth layer, is the reverse error of the middle layer of the l-1th layer, is the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer, The parameters of the reverse mapping function of the l-1th intermediate layer, is the reverse output node state of the middle layer of the l+1th layer; The first update of the l-th layer forward output node state v l and the l+1th layer reverse output node state Recorded as intermediate parameters and Where η is the node update step size; The forward output node state and the reverse output node state of the middle layer are coupled by the proportional factor to update the forward output node state v of the lth layer for the second time. l and the l+1th layer reverse output node state Where β is the proportional factor.

8. The dual-weighted bidirectional predictive coding method according to claim 1, It is characterized in that It also includes updating the parameters of each intermediate layer after the iteration, including: Where dθ l is the positive parameter error increment of the lth intermediate layer, ∈ l is the forward error of the middle layer of the lth layer, f l is the forward mapping function of the lth intermediate layer, v l-1 is the forward output node state of the middle layer of the l-1th layer, θ l is the parameter of the forward mapping function of the lth intermediate layer, is the reverse parameter error increment of the middle layer of the lth layer, is the reverse error of the middle layer of the lth layer, f l b is the reverse mapping function of the middle layer of the lth layer, is the forward output node state of the middle layer of the l+2th layer, is the parameter of the reverse mapping function of the lth intermediate layer, η θ is the parameter update step size of the forward mapping function, Update step size for the parameters of the reverse mapping function.

9. A neural network training method, It is characterized in that The neural network training method comprises: Define the forward and reverse mapping functions used to construct the network layers of the neural network; Build a neural network based on the defined network layers; The number of training times is set, batch data is input into the neural network, and the dual-weight bidirectional predictive coding method described in claim 1 is cyclically called to train the constructed neural network under the given number of training times.

10. The neural network training method according to claim 9, It is characterized in that The definition of the forward mapping function and the reverse mapping function of the network layer for constructing the neural network includes: The network layer includes a convolutional layer, a pooling layer and a linear layer, and the forward mapping function and the reverse mapping function of the network layer are respectively: The forward mapping function of the convolution layer is the nn.Conv2d function, and the reverse mapping function of the convolution layer is the nn.ConvTranspose2d function; the forward mapping function of the pooling layer is the nn.MaxPool2d function, and the reverse mapping function of the pooling layer is the nn.MaxUnpool2d function; the forward mapping function of the linear layer is the nn.Linear function, and the reverse mapping function of the linear layer is also the nn.Linear function.

Citation Information

Patent Citations

  • Fan gearbox state prediction method and system

    CN114239396A

  • Flow prediction method for intelligent traffic control system

    CN115470886A

  • Methods and systems for improved major histocompatibility complex (MHC)-peptide binding prediction of neoepitopes using a recurrent neural network encoder and attention weighting

    US20210202043A1

  • System and method for machine learning architecture with invertible neural networks

    US20220383110A1

  • System and method for molecular property prediction using hypergraph message passing neural network (HMPNN)

    US20230037388A1

Cited By

  • Single-weight bidirectional predictive coding method and neural network training method

    CN118673981A

  • A single-weight bidirectional predictive coding method and a neural network training method

    CN118673981B