Method and device for testing neuron functions in a neural network
By introducing the nuclear neurons in the neural network, using the input and weight of multiple neurons to calculate the input and weight and weight of multiple neurons, it solves the problem of incorrecting and correcting the error of neuron function in deep neural networks, and achieves efficient efficiency Error identification and correction.
Patent Information
- Application Number
- CN201910110015.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-02-12
- Filing Date
- 2019-02-11
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2039-02-11
AI Technical Summary
In deep neural networks, there are shortcomings in ways to identify and correct neuronal function errors. Traditional solutions usually require architecture changes, training methods, or require dedicated hardware, and are difficult to implement in standard modules.
By setting up a nucleus neurons in the neural network, the input and weight of the school nuclear neurons and multiple neurons are used to generate the second comparison value, and the error is identified by comparing the first and second comparison values.
It achieves efficient identification and correcting neuron function errors without changing the neural network architecture, and improves the robustness and reliability of the system.
Smart Images

Figure CN110162426B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to neural networks and in particular to measures for testing the function of neurons in a neural network. Background Art
[0002] Obviously, machine learning methods are used in order to cope with complex tasks in different fields. In particular, learning-capable systems are suitable for tasks such as image classification, object recognition, language processing, and others. Due to the possibility of arranging highly parallel computing units on a single module, deep neural networks with high parallelism can be implemented.
[0003] In particular, in the case of highly integrated implementations of deep neural networks, hardware errors involving one or more individual neurons become more likely. It is therefore necessary in principle to detect functional errors.
[0004] For error detection and, if necessary, error correction, a form of redundancy is necessary. The manner and method of using redundancy to detect errors and, if necessary, correct them is generally problem-specific. Often, a combination of different forms of redundancy is also used at multiple levels of the overall system. Redundancy can in principle include spatial redundancy (doubling of structures), temporal redundancy (checking performed with a time offset), and coding (redundancy in the form of multiple messages with the same information content).
[0005] Conventional solutions for setting redundancy can also be used in the field of deep neural networks. This includes, for example, duplicating parts of the neural network. However, it can be determined that many of the known solutions for deep neural networks can only be used unsatisfactorily. In particular, conventional solutions for setting redundancy for deep neural networks intervene in the architecture of the deep neural network or change its training method or require special hardware or modify the following hardware: the hardware is not provided in the standard module. Summary of the invention
[0006] According to the invention, a method for testing a function of a neural network is provided according to claim 1 , and a neural network is provided according to the independent claim.
[0007] Further embodiments are described in the dependent claims.
[0008] According to a first aspect, a method for checking the calculation of neuron values of a plurality of neurons of a neural network is provided, the method comprising the following steps:
[0009] - performing or causing the calculation of neuron functions for a plurality of neurons in order to obtain neuron values respectively, wherein the neuron functions are determined by individual weight parameters input for each neuron;
[0010] - calculating a first comparison value as a sum of neuron values of a plurality of neurons;
[0011] - performing or causing a calibration calculation using one or more calibration neuron functions and all neuron inputs of the plurality of neurons in order to obtain a second comparison value as a function of the neuron inputs of the plurality of neurons and as a function of the sum of the weights of the plurality of neurons associated with the respective neuron inputs;
[0012] - An error is detected based on the first and second comparison values.
[0013] It can be provided that a neuron function is determined in each case according to the bias value, wherein neuron values of a plurality of neurons are calculated with the aid of the neuron function according to the bias value, wherein a calibration calculation of the second comparison value is performed using one or more calibration neuron functions according to the sum of all bias values of the plurality of neuron functions.
[0014] The idea of the above method is that in a neural network, calculations are provided by separately implemented check neurons in order to check the neuron functions of a plurality of functional neurons. Here, a conventional neuron function is taken as a starting point, in which a sum is formed from a plurality of weighted inputs and a neuron-specific bias value is applied to the sum in order to generate a neuron value. In a neural network, this neuron value is generally fed to an activation function, which generates a neuron output.
[0015] The weight values and the bias values are available for each neuron and can be processed further accordingly. The test now takes place in the following way: a sum is formed from a plurality of neuron values and this sum is provided as a first comparison value. The first comparison value is compared with a second comparison value, which is determined by a calibration calculation. The calibration calculation comprises: in the case of identical weights associated with the corresponding neuron inputs, a sum of the neuron inputs is pre-calculated and / or a sum of the weights of the neuron inputs associated with a plurality of neurons is pre-calculated and then summed in order to obtain a second comparison value.
[0016] The possibility of using multiplication and addition functions in an efficient manner for the implemented neuron functions results in the possibility of applying the associative laws of mathematics. Thus, the result of the calculation of the sum of the neuron values of a plurality of neurons can be checked by a separate calibration calculation. The calibration calculation can also have a multiplication and addition sequence, which, however, must lead to the above result in another way, provided that the neurons involved function as specified. Thus, it is possible to check the neuron functions of neurons.
[0017] Essentially, the neuron function is tested by testing the sum of the neuron values as a first comparison value using the sum of the products of each of the neuron inputs and the sum of all weights associated with the neuron input (all weight values associated with the neuron input) as a second comparison value. The calibration calculation can be performed in the calibration neuron and results in the same first and second comparison values when the relevant neuron functions as intended.
[0018] Furthermore, one or more calibration neuron functions can be executed by one or more additionally provided calibration neurons.
[0019] Furthermore, the plurality of neurons may be part of a plurality of kernels for computing a convolutional neural network, wherein the calibration calculation is performed based on the calibration kernels, wherein the weights of the neuron functions of the calibration kernels are determined by the sum of the weights of the plurality of kernels associated with the neuron inputs.
[0020] According to one embodiment, the sum of all corresponding data points over all channels within the multidimensional data matrix can be formed as a first comparison value, wherein the second comparison value is determined by applying a calibration calculation using a calibration kernel for the matrix positions of the respectively corresponding data points.
[0021] According to one embodiment, a plurality of neurons may be part of a kernel for computing a convolutional neural network based on a multidimensional data matrix, wherein a calibration calculation is performed based on a plurality of sums of data values of the data matrix for a test dimension, wherein a second comparison value is determined as a sum of products of a weight of the kernel and one of the sums of the data values, respectively.
[0022] According to a further aspect, a device for checking the calculation of neuron values of a plurality of neurons of a neural network is provided, wherein the device is designed to:
[0023] - performing or causing the calculation of a neuron function of a plurality of neurons in order to obtain a neuron value respectively, wherein the neuron function is determined by an individual weight for each neuron input;
[0024] - calculating a first comparison value as a sum of neuron values of a plurality of neurons;
[0025] - performing or causing a calibration calculation using one or more calibration neuron functions and all neuron inputs of the plurality of neurons to obtain a second comparison value based on the neuron inputs of the plurality of neurons and based on the sum of weights of the plurality of neurons associated with the respective neuron inputs; and
[0026] - An error is detected based on the first comparison value and the second comparison value.
[0027] According to another aspect, a testing system for testing the calculation of neuron values of a plurality of neurons of a neural network is provided, the testing system comprising:
[0028] - a plurality of neurons, which are configured to perform calculations of neuron functions of the plurality of neurons in order to obtain neuron values respectively, wherein the neuron function is determined by individual weights for each neuron input;
[0029] - a summing link, used for calculating the first comparison value as the sum of neuron values of multiple neurons;
[0030] - at least one calibration neuron configured to perform a calibration calculation using one or more calibration neuron functions and all neuron inputs of the plurality of neurons to obtain a second comparison value based on the neuron inputs of the plurality of neurons and based on the sum of weights of the plurality of neurons associated with the respective neuron inputs; and
[0031] A comparison block which is designed to detect an error as a function of the first comparison value and the second comparison value. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The embodiments of the present invention are described in more detail below with reference to the attached drawings.
[0033] Figure 1 A schematic diagram of a neuron is shown;
[0034] Figure 2 A schematic diagram of a functional map for illustrating the functionality of nucleus neurons is shown;
[0035] Figure 3 A diagram showing the calculation path of the comparison variable for a row of an input feature map; and
[0036] Figure 4 A diagram showing the application of neuron inspection to an input feature map with multiple channels. DETAILED DESCRIPTION
[0037] The core process of a neural network lies in the neuron function. Figure 1 In FIG. 1 , a neuron 1 for establishing a neural network is schematically shown. The neuron 1 implements a neuron function, which includes a weight w n,i Weighted input value x i The sum of and bias value b n , in order to generate the neuron value:
[0038]
[0039] z corresponds to the number of neuron inputs. It is loaded with a bias value b n It can be optional if necessary. The weight w n,i and the bias value b n are the parameters of the neuron function.
[0040] The neuron value is optionally loaded with an activation function in order to obtain the neuron output. The activation function is handled separately in the hardware implementation and is not considered in detail here.
[0041] Each neuron 1 is therefore connected to a plurality of weight values w associated with the neuron 1 and the corresponding neuron input n,I and the associated bias value b n Neurons with such neuron functions are usually implemented in an integrated manner using a plurality of multiply-accumulate elements (MACs).
[0042] In order to check the functioning capacity of neurons, the following embodiment is described: the embodiment uses the mathematical associative law, according to which the sum of the neuron values of the neurons under consideration corresponds to the sum of the products of each neuron input and the sum of the weights associated with the neuron, including the sum of the bias values. Applicable to:
[0043]
[0044] Where m>1, that is, the number of neurons to be tested. The right side of the equation can be implemented by checking neuron 2.
[0045] exist Figure 2 In FIG. 1 , a functional diagram for realizing such a calibration neuron 2 for two neurons 1 to be tested is schematically depicted. In this case, two neuron inputs x1 and x2 are respectively supplied to the neurons 1 to be tested, where they are respectively correlated with the weights w 1,1 、w 1,2 、w 2,1 、w 2,2 The corresponding neuron outputs o1 and o2 are supplied to the summing element 3 in order to obtain the first comparison value o n .
[0046] In addition, the sum of the weights associated with the corresponding neuron inputs , is calculated in the second summation link 4 and used as the calibration neuron weight w c,1 、w c,2 The sum of weights associated with the corresponding neuron inputs x1 and x2 is fed to the calibration neuron 2. Alternatively, since the weights are determined after training, the sum of weights can be calculated in advance and provided accordingly from a suitable memory.
[0047] In addition, the sum of the bias values b1, b2 associated with the corresponding neuron input is calculated in the third summation link 5 and used as the calibration neuron bias value b c The sum of the bias values b1 and b2 associated with the corresponding neuron inputs is fed to the calibration neuron 2, and the corresponding neuron inputs x1 and x2 are loaded with the sum of the bias values b1 and b2 associated with the corresponding neuron inputs. Alternatively, since the bias values b1 and b2 are determined after training, the sum of the weights can be calculated in advance and provided accordingly from a suitable memory.
[0048] In the check neuron 2, the calculation is based on the check weight w c,1 、w c,2 The sum of the products of the respectively associated neuron inputs, and the correction neuron bias value b is added to the sum c , in order to obtain the second comparison value o c .
[0049] In comparison block 6, a first comparison value o is supplied. n and the second comparison value o c , in order to obtain a comparison result V. In the case where the comparison values are the same, it is determined that there is no error, and in the case where the comparison result V is not the same, it is determined that there is an error. In this way, errors in the calculation of neuron values can be found, wherein the cause of the error may be present in the calculation hardware of the neuron or in the memory for storing neuron parameters, such as weights and bias values. In this way, the calibration neuron 2 can be used to identify an error in a calculation in the calculation of the neuron 1.
[0050] Another application of the calibration method described above is in convolutional neural networks (CNN). Convolutional neural networks are often used for image processing. In general, any type of tensor and matrix with data points can be processed. For better understanding, the individual data points are called pixels of the pixel matrix, and the values of the data points are called pixel values.
[0051] In order to process the pixel matrix PM (which may correspond to the original data matrix or a feature map generated therefrom), the pixel matrix PM is sampled by a so-called kernel of D×D dimensions (often 3×3, 5×5 or 7×7), and the corresponding pixel values processed by the kernel are written into the feature map MK formed therefrom. That is, each kernel forms the resulting pixel values of the feature map MK from the D×D pixel values of the pixel matrix.
[0052] The kernel / filter is part of the CNN. For each computation step, a D×D kernel is fed with D 2 Input values are each multiplied by the associated weight and then added together. To this end, the bias value associated with the kernel is added.
[0053] A layer of the neural network is calculated by repeatedly applying the kernel to each portion of the input data. The kernel is applied multiple times along the x-dimension and the y-dimension with respect to the pixel matrix PM. Compared to conventional neural networks, the multiple applications of the kernel thus correspond to a large set of neurons that are always applied with the same parameters.
[0054] The pixel matrix is sampled at a plurality of positions that are offset in the x and y dimensions. By pre-assuming edge pixels (so-called padding), the dimensions of the feature map MK can correspond to the dimensions of the original pixel matrix PM.
[0055] This behavior is for checking only the dimensions and a single row / column of the pixel matrix PM. Figure 3 . The kernel K here has a dimension D=3 and always processes three adjacent input values i (including so-called padding P in the edge regions in order to ensure for this exemplary embodiment that the feature map MK has the same x- and y-dimensions as the pixel matrix PM) into corresponding neuron values. The kernel K has a constant parameterization (weights and bias values) for the same pixel matrix PM and, in order to analyze a pixel group of dimension D=3, it traverses the entire pixel matrix in order to obtain the pixel values in the feature map MK in each case.
[0056] In order to check the calculation of the characteristic map MK, in addition to filling P, a plurality of test pixels UP1, ..., UP2 are also added to the rows and / or columns (x direction, y direction) of the pixel matrix PM corresponding to the test dimension. D , the inspection pixels UP1, ..., UP DCorresponds to the dimension of the kernel K in the corresponding matrix direction (x or y). When sampling the pixel matrix PM, the test pixel UP is sampled last in the illustrated embodiment, and the calibration pixel KP is determined from this according to the kernel function. The first calibration pixel KP1 can be arranged at the beginning or end of a row or column of the matrix, can only be associated with a row or column of the matrix in another way, or can also be embedded in the row or column.
[0057] Thus, the resulting feature map is provided with a first check pixel KP as a first comparison value V1 at the end of each row and / or each column of the test dimension, which is obtained by processing the test pixel UP by the associated kernel K. In addition, the sum of the regular pixel values of the resulting feature map MK can be contained in the relevant row or the relevant column as a second comparison value V2. Figure 3 In the example shown in FIG. 1 , where the kernel dimension is 3, the pixel values i of the considered row of the pixel matrix PM are obtained for the three test pixels UP1, UP2, UP3. j The following is composed:
[0058]
[0059] .
[0060] In general, the pixel matrix and feature map correspond to p-dimensional tensors and can be viewed as a set of pixels in p-dimensional space. For better explanation, the following takes a three-dimensional pixel matrix as the starting point. Figure 4 As explained in , such a three-dimensional pixel matrix includes multiple channels, for example, the color channels RGB. The pixel matrix PM can then be regarded as a set of pixels in three-dimensional space. Pixels with different x- and y-coordinates but the same z-coordinate belong to one channel. Each of the n kernels in this case generates a two-dimensional feature map, and all n feature maps are connected in series to obtain a three-dimensional feature map with n channels.
[0061] exist Figure 4 In the embodiment shown in , a pixel matrix with m channels is given. In addition, n kernels are given, each of which includes m· D 2 weights and, if necessary, bias values. The kernels have the same dimension. From these n kernels, a feature map with n channels is generated by convolving the pixels of the pixel matrix with the kernel K respectively associated with the channel.
[0062] For a pixel matrix with n channels we get:
[0063]
[0064] Where i denotes the three-dimensional pixel matrix, i(x, y, z) denotes the pixel value of the three-dimensional pixel matrix, and w l (x,y,z) indicates kernel k l The weight of .
[0065] For function testing, one or more calibration channels can be inserted into the characteristic diagram, which contain a first comparison value for each point r, s defined by the x- and y-coordinates. The first comparison value is calculated as the pixel-by-pixel sum of the feature map:
[0066]
[0067] where a = (D+1) / 2, and thus corresponds to the relative condition (Lage) of the patch (Kachel) at the associated query point x, y.
[0068] Furthermore, a calibration kernel is provided, which is determined by the kernel weight as follows:
[0069]
[0070] in
[0071]
[0072] To create a calibration channel, a calibration kernel is thus formed, wherein the weights of the neurons of the calibration kernel correspond to the sum of the weights of the relevant neurons of the individual kernels of the channel for the pixel matrix.
[0073] Right now:
[0074]
[0075] .
[0076] As a calibration offset, give the value o thus determined c The (r,s) complement is added to the sum of all bias values of the kernel.
[0077] The calibration kernel is applied to the pixel matrix to obtain a pixel matrix with a second comparison value V2(o c The second comparison value V2 is compared with the first comparison value V1 to determine an error when they are different.
[0078] In order to detect errors, the weights and bias values of the check kernel are calculated so that they correspond to the sum of the n existing kernel weights or bias values, respectively. This ensures that, in the error-free case, the sum of the n channels of the output feature map must correspond to the check channel.
[0079] The method described above allows single error recognition. If the method is applied along the x-dimension or y-dimension of the pixel matrix PM, the redundancy required for this corresponds to the dimensional increase of PM from (x, y, z) to (x+D, y, z) or (x, y+D, z). If the method is applied along the z-dimension, the redundancy required corresponds to the dimensional increase of PM from (x, y, z) to (x, y, z+1). In addition, the number of calibration pixels for the x-dimension and the y-dimension or the number of calibration channels for the z-dimension can be freely selected, thereby also enabling error correction.
[0080] For error correction, on the one hand, incorrectly calculated pixel values must be identified, and on the other hand, the correct pixel value must be restored. The identification of incorrect pixel values can be achieved by appropriately selected check kernels or check pixels. By subtracting the correctly calculated pixel value from the incorrect check pixel, the correct pixel value can be restored. The number of check pixels required for single error correction is determined as follows:
[0081]
[0082] Here n corresponds to the number of pixels in the considered dimension of the feature map without calibration pixels. This means that incorrectly calculated values can be limited to a set of n / i pixels by i calibration pixels. Additional check pixels can identify the exact location of the erroneous pixel.
Claims
1. A method for checking the calculation of neuron values of a plurality of neurons (1) of a neural network in order to identify calculation errors in the calculation hardware of the neurons, the method comprising the following steps: - performing or causing the calculation of neuron functions of the plurality of neurons (1) in order to obtain neuron values respectively, wherein the neuron values are calculated by means of individual weights (w n,i ) to determine the neuron function; - calculating a first comparison value (V1) as the sum of said neuron values of said plurality of neurons (1); - performing or causing a calibration calculation using one or more calibration neuron functions and all neuron inputs of the plurality of neurons (1) so as to calculate the value of the neuron inputs of the plurality of neurons (1) according to the neuron inputs of the plurality of neurons (1) and according to the weights (w n,i ) and obtain a second comparison value (V2); - detecting an error based on a comparison of the first comparison value (V1) and the second comparison value (V2).
2. The method according to claim 1, wherein: The one or more calibration neuron functions are executed by one or more additionally provided calibration neurons (2).
3. The method according to claim 1 or 2, wherein: The neuron functions are determined respectively according to bias values (b1, b2), wherein with the aid of the neuron functions, the neuron values of the multiple neurons (1) are calculated according to the bias values (b1, b2), wherein using the one or more verification neuron functions, the verification calculation of the second comparison value (V2) is performed according to the sum of all bias values (b1, b2) of the multiple neuron functions.
4. The method according to claim 1 or 2, wherein: The plurality of neurons (1) are part of a plurality of kernels for computing a convolutional neural network based on a multidimensional data matrix having a plurality of channels, wherein the calibration calculation is performed based on the calibration kernels, wherein the weights of the neuron functions of the calibration kernels (2) are calculated by weights (w) associated with the neuron inputs of the plurality of kernels. n,i ) and is determined by 5. The method according to claim 4, wherein: The sum of all mutually corresponding data points across all channels within the multidimensional data matrix is formed as a first comparison value (V1), wherein the second comparison value (V2) is determined for the matrix positions of the respectively mutually corresponding data points by applying the calibration calculation using the calibration kernel.
6. The method according to claim 1, wherein: The plurality of neurons (1) are part of a kernel for calculating a convolutional neural network based on a multidimensional data matrix, wherein the calibration calculation is performed based on a plurality of sums of data values of the data matrix for a test dimension, wherein the second comparison value (V2) is determined as the sum of the products of the weights of the kernel and one of the sums of the data values, respectively.
7. A device for checking the calculation of neuron values of a plurality of neurons (1) of a neural network in order to identify calculation errors in the calculation hardware of the neurons, wherein the device is designed to: - performing or causing the calculation of neuron functions of the plurality of neurons (1) in order to obtain neuron values respectively, wherein the neuron values are calculated by means of individual weights (w n,i ) to determine the neuron function; - calculating a first comparison value as the sum of said neuron values of said plurality of neurons (1); - performing or causing a calibration calculation using one or more calibration neuron functions and all neuron inputs of the plurality of neurons so as to calculate the value of the neuron inputs of the plurality of neurons (1) according to the neuron inputs of the plurality of neurons (1) and according to the weights (w n,i ) and obtain a second comparison value (V2); as well as - detecting an error based on a comparison of the first comparison value (V1) and the second comparison value (V2).
8. A testing system for testing the calculation of neuron values of a plurality of neurons (1) to be tested of a neural network in order to identify calculation errors in the calculation hardware of the neurons, comprising: - a plurality of neurons (1) which are designed to perform calculations of neuron functions in order to obtain neuron values respectively, wherein the neuron functions are determined by individual weights for each neuron input; - a summing section (3), used for calculating the first comparison value (V1) as the sum of the neuron values of the plurality of neurons (1); - at least one calibration neuron (2) configured to perform a calibration calculation using one or more calibration neuron functions and all neuron inputs of the plurality of neurons, so as to obtain a second comparison value based on the neuron inputs of the plurality of neurons (1) and based on the sum of weights of the plurality of neurons (1) associated with the corresponding neuron inputs; A comparison block (6) which is designed to detect an error based on a comparison of the first comparison value (V1) and the second comparison value (V2). 9 . A computer program product comprising a computer program with a program code which is designed to carry out the method according to claim 1 , when the computer program is executed on a computing unit. 10 . A machine-readable storage medium having a computer program stored thereon with a program code, the computer program code being designed to carry out the method according to claim 1 when the computer program is executed on a computing unit.
Citation Information
Patent Citations
Information processing device, operation verifying method, and program
US20100272253A1
Systems and methods for stencil amplification
US20160147514A1