Neural network processing device, neural network processing method, and program
The neural network processing device and method address processing speed limitations on embedded hardware by using conversion-quantization processes to reduce calculation load, enabling efficient CNN signal processing on FPGAs and microcontrollers.
Patent Information
- Application Number
- JP2021079516
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-05-10
- Publication Date
- 2024-10-16
- Estimated Expiration
- 2041-05-10
AI Technical Summary
Conventional neural networks face processing speed limitations when implemented on embedded hardware like FPGAs and microcontrollers due to the computational demands of large input values with many digits.
A neural network processing device and method that includes a memory for input signals and weights, a convolution calculation unit, and a processing unit that performs conversion-quantization processes using a table to associate input and output values, reducing bit precision and quantizing data to minimize calculation load.
This approach suppresses the reduction in processing speed and enhances performance on embedded hardware by reducing calculation load through conversion-quantization processes, allowing faster CNN signal processing.
Smart Images

Figure 0007568198000001 
Figure 0007568198000002 
Figure 0007568198000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a neural network processing device and a neural network processing method. [Background technology]
[0002] In recent years, Convolutional Neural Networks (CNNs) have been attracting attention as a deep neural network for classifying images into multiple categories. CNNs are characterized by having a convolutional layer in a deep neural network. In the convolutional layer, a filter is applied to input data. More specifically, in the convolutional layer, a filter window is slid at a fixed stride, and the filter elements are multiplied by the corresponding elements of the input data, and a multiply-add operation is performed to obtain the sum.
[0003] Fig. 13 is a diagram showing the flow of signal processing in a general CNN. A CNN has an input layer, an intermediate layer, and an output layer (see, for example, Non-Patent Document 1 and Non-Patent Document 2). In the intermediate layer, a convolution operation is performed to multiply an input signal by a weight.
[0004] As shown in Fig. 13, in the intermediate layer, the result of the convolution operation is subjected to detection processing using ReLU (Rectified Linear Units) and normalization such as BN (Batch Normalization) (hereinafter, these may be collectively referred to as "transformation") as necessary. In addition, pooling processing may be performed in some cases.
[0005] The features of the input signal extracted through the convolution operation are applied to a classifier consisting of a fully connected layer, and the classification result is output from the output layer. In this way, one of the characteristics of neural networks such as CNN is that product-sum operations and transformation operations are repeated.
[0006] Here, the input values and weights of the input data used in CNN may contain decimal points, but in the product-sum operation of conventional neural networks such as CNN, the operation process is performed in a form that ensures the number of digits of the operation result, as shown in the values of "input signal," "weight," and "convolution operation" in Figure 13. Thus, in conventional neural networks such as CNN, in the intermediate layers that are made up of multiple layers, a large number of operation processes are required for a large number of input values with a large number of digits. [Prior art documents] [Non-patent literature]
[0007] [Non-Patent Document 1] K.He,X.Zhang,S.Ren,and J.Sun.Deep residual learning for image recognition.In Proc.of CVPR,2016.(*ResNet) [Non-Patent Document 2] Hideki Aso et al., "Deep Learning", Kindaikagakusha, November 2015 Summary of the Invention [Problem to be solved by the invention]
[0008] However, when implementing conventional neural networks such as CNNs using embedded hardware such as field programmable gate arrays (FPGAs) or microcontrollers, there are limitations on computational resources, and the slowdown in processing speed caused by the need to perform numerous calculations on a large number of input values with many digits is an issue.
[0009] The present invention has been made to solve the above-mentioned problems, and aims to provide a neural network processing device and a neural network processing method that can suppress a decrease in the processing speed of a neural network even when embedded hardware is used. [Means for solving the problem]
[0010] In order to solve the above-mentioned problems, a neural network processing device according to the present invention is characterized in that it comprises a first memory that stores an input signal given to a neural network, a second memory that stores weights of the neural network, a calculation unit that performs a convolution calculation of the neural network including a product-sum calculation of the input signal and the weights, a third memory that stores a table that correlates the input and output of the conversion-quantization process, in which the calculation result of the convolution calculation by the calculation unit is used as an input, the input value is converted based on predefined conditions, and the converted data is quantized by reducing the bit precision of the converted data as an output, and a processing unit that refers to the table to obtain the output of the conversion-quantization process that corresponds to the calculation result by the calculation unit.
[0011] In order to solve the above-mentioned problems, a neural network processing method according to the present invention includes a first step of storing an input signal given to a neural network in a first memory, a second step of storing weights of the neural network in a second memory, a third step of performing a convolution operation of the neural network including a product-sum operation of the input signal and the weights, a fourth step of storing a table in a third memory that correlates the input and output of the conversion-quantization process, in which a result of the convolution operation in the third step is used as an input, the input value is converted based on a predefined condition, and the converted data is quantized by reducing the bit precision of the converted data as an output, and the fifth step of referring to the table to obtain the output of the conversion-quantization process that corresponds to the operation result in the third step. Effect of the Invention
[0012] According to the present invention, the result of the convolution operation is converted based on predefined conditions, and the output of the conversion-quantization process that reduces the bit precision of the converted data and quantizes it is obtained by referring to a table that correlates the input and output of the conversion-quantization process corresponding to the result of the convolution operation. Therefore, even when embedded hardware is used, a decrease in the processing speed of the neural network can be suppressed. [Brief description of the drawings]
[0013] [Figure 1] FIG. 1 is a block diagram illustrating an outline of the functions of a CNN processing device according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a block diagram showing a hardware configuration of a CNN processing device according to an embodiment of the present invention. [Diagram 3] FIG. 3 is a diagram for explaining an outline of the flow of a CNN processing method according to an embodiment of the present invention. [Figure 4] FIG. 4 is a block diagram illustrating the function of the processing unit according to the first embodiment. [Diagram 5] FIG. 5 is a diagram for explaining the configuration of a table according to the first embodiment. [Figure 6] FIG. 6 is a diagram for explaining the function of the processing unit according to the first embodiment. [Figure 7] FIG. 7 is a block diagram illustrating the function of a processing unit according to the second embodiment. [Figure 8] FIG. 8 is a diagram for explaining the configuration of a table according to the second embodiment. [Figure 9] FIG. 9 is a diagram for explaining the flow of the CNN processing method according to the second embodiment. [Figure 10] FIG. 10 is a block diagram illustrating the function of a processing unit according to the third embodiment. [Figure 11] FIG. 11 is a diagram for explaining the configuration of a table according to the third embodiment. [Figure 12]FIG. 12 is a diagram for explaining the flow of a CNN processing method according to the third embodiment. [Figure 13] FIG. 13 is a diagram for explaining the calculation process of a conventional CNN. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Preferred embodiments of the present invention will now be described in detail with reference to FIGS. [Overview of the CNN processing unit] The neural network processing device according to the present invention is a CNN processing device 1 that uses a CNN as a neural network.
[0015] The CNN processing device 1 according to the present embodiment is a processing device that performs a multiply-and-accumulate operation between an input signal given to the CNN and the weight of the CNN, outputs the operation result, and further applies ReLU to the operation result to convert the result of the multiply-and-accumulate operation. This operation process includes a multiply-and-accumulate operation of a convolution layer in an intermediate layer of the CNN (hereinafter, sometimes referred to as a "convolution operation"), and a conversion operation that converts the operation result of the convolution operation based on a predefined condition. In the following, as an example of "conversion", a case where ReLU is applied to the operation result of the convolution operation will be described.
[0016] The CNN processing device 1 performs a convolution operation between the input signal and the weights, applies ReLU to the operation result, and obtains an output of one convolution layer.
[0017] In the following, for simplicity of explanation, it is assumed that the calculation result calculated by applying ReLU to the result of the product-sum calculation of the convolution layer is used as the input signal of the next convolution layer. The CNN processing device 1 repeatedly performs the product-sum calculation and the transformation calculation of the input signal and the weight, and executes the product-sum calculation and the transformation process the number of times according to the number of convolution layers of the preset CNN model.
[0018] [Functional blocks of the CNN processing unit] The above-mentioned CNN processing device 1 includes an input buffer (first memory) 10, a weight buffer (second memory) 11, a convolution calculation unit (calculation unit) 12, a calculation result buffer 13, a processing unit 14, an output buffer 15, and a storage unit (third memory) 16.
[0019] The input buffer 10 is a memory that stores an input signal given to the CNN. More specifically, the input buffer 10 is realized by a main storage device 103 described later, and the input buffer 10 stores, for example, image data given from the outside. The input signal given to the input buffer 10 may be image data that has been pre-processed in advance. Examples of the pre-processing include monochrome conversion, contrast adjustment, and brightness adjustment. In addition, the input signal may be reduced to a bit depth set according to a CNN model that is preset in the CNN processing device 1.
[0020] The value of the input signal provided to the input buffer 10 may be, for example, a value including a decimal point expressed as a floating-point array with 32-bit or 16-bit precision, or a value obtained by reducing such a value to a predetermined bit number representation.
[0021] The weight buffer 11 is a memory that stores the weights of the CNN. More specifically, the weight buffer 11 is realized by a main storage device 103 described later, and CNN weight parameters that are pre-stored in a server (not shown) installed outside the CNN processing device 1, a storage unit 16, or the like are loaded into the weight buffer 11. In this embodiment, values including a decimal point expressed in a floating-point array with 32-bit or 16-bit precision, or values obtained by reducing these values to a preset bit number representation, are used as the weight values.
[0022] The convolution calculation unit 12 performs CNN convolution calculation including a product-sum calculation between the input signal stored in the input buffer 10 and the weight stored in the weight buffer 11. More specifically, the convolution calculation unit 12 reads out the input signal and the weight from the input buffer 10 and the weight buffer 11, respectively, and performs convolution calculation according to the convolution layer constituting the CNN model preset in the CNN processing device 1. The calculation result output by the convolution calculation unit 12 is supplied to the calculation result buffer 13.
[0023] The calculation result buffer 13 buffers the result of the convolution calculation performed by the convolution calculation unit 12 .
[0024] The processing unit 14 refers to the table 160 stored in the storage unit 16, and outputs the result of performing a transform and quantization process (hereinafter, sometimes referred to as a "transform-quantization process") on the result of the convolution operation read from the operation result buffer 13. More specifically, the processing unit 14 reads the result of the convolution operation stored in the operation result buffer 13, and refers to the table 160 in which the input / output relationship of the transform-quantization process is stored, to obtain and output a value corresponding to the input of the transform-quantization process.
[0025] Here, the conversion of the result of the convolution operation includes, for example, application of an activation function such as ReLU, normalization using BN, etc., and refers to converting the result of the convolution operation based on a predefined condition. The activation function determines the result of the convolution operation.
[0026] The ReLU applied to the result of the convolution operation is a ramp function that converts the result of the convolution operation to 0 if it is negative, and to a linearly transformed value if it is positive. In this way, the input / output relationship of the process that converts the result of the convolution operation such as ReLU is specified in advance.
[0027] On the other hand, the value obtained by converting the result of the convolution operation through ReLU or the like is quantized by reducing the bit precision in order to reduce the calculation load. Data quantization includes well-known fractional processing such as rounding off, rounding up, rounding down, and rounding to nearest, and refers to restricting the value obtained by converting the result of the convolution operation through ReLU, for example, a value including a decimal point, by converting it into an integer.
[0028] The processing unit 14 refers to a table 160 in which the input to the ReLU, that is, the result of the multiplication and addition operation, and the value obtained by further quantizing the output of the ReLU are stored in association with each other. Therefore, the processing unit 14 can simultaneously perform the conversion process and the quantization process by the ReLU of the result of the convolution operation.
[0029] That is, the processing unit 14 refers to the table 160 and acquires a value that has undergone two arithmetic processes, namely, a conversion process using ReLU or the like and a quantization process, corresponding to the result of the convolution operation.
[0030] The output buffer 15 temporarily stores the output obtained by the processing unit 14 .
[0031] The storage unit 16 includes a table 160. The storage unit 16 stores the output from the processing unit 14 that is temporarily stored in the output buffer 15.
[0032] Table 160 stores the input and output of the conversion-quantization process in association with each other. More specifically, table 160 stores data in which the input of a conversion process such as a predefined ReLU is associated with the output of a value converted by the ReLU and quantized by a preset rounding process.
[0033] [Hardware configuration of CNN processing unit] Next, an example of the hardware configuration of the CNN processing device 1 having the above-mentioned functions will be described with reference to the block diagram of FIG.
[0034] As shown in FIG. 2, the CNN processing device 1 can be realized, for example, by a computer including a processor 102, a main memory device 103, a communication interface 104, an auxiliary memory device 105, and an input / output device 106 connected via a bus 101, and a program that controls these hardware resources.
[0035] The main memory device 103 stores in advance programs for the processor 102 to perform various controls and calculations. The processor 102 and the main memory device 103 realize the functions of the CNN processing device 1 including the convolution calculation unit 12 and the processing unit 14 shown in FIG.
[0036] The main memory device 103 realizes the input buffer 10, weight buffer 11, calculation result buffer 13, and output buffer 15 described with reference to FIG.
[0037] The communication interface 104 is an interface circuit for communicating with various external electronic devices via the communication network NW. Input signals such as image data and weights used by the CNN processing device 1 may be received from an external server or the like via the communication interface 104.
[0038] The auxiliary storage device 105 is composed of a readable / writable storage medium and a drive for reading and writing various information such as programs and data from and to the storage medium. The auxiliary storage device 105 can use a semiconductor memory such as a hard disk or a flash memory as the storage medium.
[0039] The auxiliary storage device 105 has a storage area for storing input data and weights acquired from the outside, and a program storage area for storing programs for the CNN processing device 1 to perform CNN arithmetic processing such as convolution operations. The auxiliary storage device 105 realizes the storage unit 16 described in Fig. 1. Furthermore, for example, it may have a backup area for backing up the above-mentioned data and programs.
[0040] The input / output device 106 is configured with an I / O terminal for inputting signals from an external device and outputting signals to an external device. A display device (not shown) may be provided to display the calculation results output by the CNN processing device 1 via the input / output device 106.
[0041] Here, the program stored in the program storage area of the auxiliary storage device 105 may be a program that is processed in time series according to the sequence of the CNN processing method described in this specification, or may be a program that is processed in parallel or at a required timing such as when called. In addition, the program may be processed by one computer, or may be processed in a distributed manner by multiple computers.
[0042] [CNN processing method] Next, an overview of the operation of the CNN processing device 1 having the above-mentioned configuration will be described with reference to Fig. 3. First, the input buffer 10 and the weight buffer 11 temporarily store the input signal A and the weight U provided from a server or the like installed outside the CNN processing device 1, respectively (steps S1 and S2).
[0043] The input signal A is vectorized input image data and has vertical and horizontal dimensions. The value of the input signal A is expressed, for example, as a value including a multiple-digit decimal point. On the other hand, the weight U is an element of a kernel expressed as a matrix, and is a parameter that is adjusted and updated by CNN learning and is finally determined. The value of the weight U also has vertical and horizontal dimensions, and each element is expressed, for example, as a value including a multiple-digit decimal point.
[0044] Next, the convolution operation unit 12 reads out the input signal A and the weight U from the input buffer 10 and the weight buffer 11, respectively, and performs a convolution operation (step S3). More specifically, the convolution operation unit 12 multiplies the vector of the input signal A by the matrix of the weight U.
[0045] Specifically, the convolution operation unit 12 slides a window of a preset CNN filter at a predetermined stride. At each location of the filter, the convolution operation unit 12 multiplies an element of the weight U by a corresponding element of the input signal A, and calculates the sum.
[0046] The convolution operation unit 12 stores the operation result X of the convolution operation using this product-sum operation in a corresponding location of the operation result buffer 13 (step S4).
[0047] Thereafter, the processing unit 14 reads the result X of the convolution operation from the operation result buffer 13, and refers to the table 160 in the storage unit 16 to obtain the output Y obtained by subjecting the operation result X to a conversion and quantization process (step S5). The obtained output Y is temporarily stored in the output buffer 15, and is read and output by the processor 102 (step S6).
[0048] If necessary, a well-known pooling process may be performed on the output Y acquired by the processing unit 14 (see Non-Patent Document 2). The output Y obtained in step S6 is input to a fully connected layer constituting a subsequent classifier (not shown) as the output of the feature extraction unit of the CNN, and image data of the input signal A is discriminated.
[0049] As described above, the CNN processing device 1 according to the present invention stores in the storage unit 16 the table 160 that associates inputs to a conversion process such as ReLU with outputs obtained by quantizing values converted by ReLU. The CNN processing device 1 refers to the table 160 to obtain the output of the conversion-quantization process corresponding to the calculation result of the convolution operation. Therefore, the calculation load of the CNN processing device 1 can be reduced compared to the case where the conversion process such as ReLU and the quantization process for the converted values are each executed independently. As a result, it is possible to speed up the signal processing of the CNN.
[0050] [First embodiment] Next, as a specific example of the CNN processing device 1 having the above-mentioned configuration, a CNN processing device 1 according to a first embodiment of the present invention will be described. FIG. 4 is a block diagram showing the functional configuration of the processing unit 14 of the CNN processing device 1. Other configurations of the CNN processing device 1 are similar to the configuration described in FIG. 1. FIG. 5 is a diagram explaining the data structure of a table 160. FIG. 6 is a diagram explaining the conversion-quantization processing by the processing unit 14.
[0051] [Functional block of processing section] The processing unit 14 includes an input determination unit 140 and an output acquisition unit 141 . The input determination unit 140 reads the result of the convolution operation from the operation result buffer 13, compares it with each input interval of the pre-set transform-quantization process, and determines the input interval that includes the result of the convolution operation, i.e., the input value of the transform-quantization process.
[0052] Here, table 160 stored in memory unit 16 stores data that associates each of the input intervals into which the input for the transformation-quantization process is divided into a number of consecutive intervals with a value obtained by quantizing a value transformed by ReLU or the like.
[0053] 5, the input of the transform-quantization process is divided into five intervals, and data in which each input interval and the output of the transform-quantization process are associated with each other is stored in the table 160. For example, when the calculation result X of the convolution calculation is "1", the input determination unit 140 determines that the calculation result X falls within the input interval "1≦X<2" by comparing with each input interval.
[0054] The output acquisition unit 141 refers to the table 160 stored in the storage unit 16 and acquires the output Y of the conversion-quantization process corresponding to the input interval according to the determination result by the input determination unit 140.
[0055] Specifically, as shown in Fig. 6, the output acquisition unit 141 acquires an output Y of the transformation-quantization process corresponding to any one of the five input intervals determined by the input determination unit 140. In the example of the transformation-quantization process shown in Fig. 6, two arithmetic processes are performed in combination: a transformation process using ReLU and a quantization process using a preset fractional rounding process.
[0056] [CNN processing method] Next, the operation of the CNN processing device 1 according to the present embodiment having the above-mentioned input determination unit 140 will be described with reference to Fig. 3. Note that in the CNN processing method according to the present embodiment, steps S1 to S4 are the same as the processes described in the overview of the CNN processing method.
[0057] First, the input buffer 10 and the weight buffer 11 temporarily store the input signal A and the weight U provided from a server or the like installed outside the CNN processing device 1, respectively (steps S1 and S2).
[0058] Next, the convolution operation unit 12 reads out the input signal A and the weight U from the input buffer 10 and the weight buffer 11, respectively, and performs a convolution operation (step S3). More specifically, the convolution operation unit 12 multiplies the vector of the input signal A by the matrix of the weight U.
[0059] Next, the convolution operation unit 12 stores the operation result X of the convolution operation using this product-sum operation in a corresponding location of the operation result buffer 13 (step S4).
[0060] Thereafter, the processing unit 14 reads the result X of the convolution operation from the operation result buffer 13, and refers to the table 160 in the storage unit 16 to obtain the output Y obtained by converting and quantizing the operation result X (step S5). More specifically, the input determination unit 140 compares the value of the result X of the convolution operation, i.e., the input X of the conversion and quantization process, for each input interval of the conversion and quantization process that is set in advance, and determines the input interval that includes the value of the operation result X. Thereafter, the output acquisition unit 141 refers to the table 160 to obtain the output Y of the conversion and quantization process that corresponds to the input interval determined by the input determination unit 140.
[0061] The acquired output Y is temporarily stored in the output buffer 15, and is read and output by the processor 102 (step S6).
[0062] As described above, according to the CNN processing device 1 of the first embodiment, it is determined which of a plurality of consecutive input intervals of the transform-quantization processing the result of the convolution operation, i.e., the input value of the transform-quantization processing, is included in, and based on the determination result, the table 160 is referenced to obtain the output of the transform-quantization processing.
[0063] Therefore, since the conversion process such as ReLU and the quantization process of the result of the convolution operation can be performed by determining the input interval and referring to table 160, it is possible to reduce the computational load of the CNN and suppress a decrease in processing speed even when embedded hardware is used.
[0064] Furthermore, table 160 showing the input / output relationship of the transformation-quantization process is stored in a storage area of hardware such as auxiliary storage device 105. Therefore, by changing the values of table 160 according to the form of the neural network, a neural network having a desired processing function can be realized more flexibly by hardware.
[0065] [Second embodiment] Next, a second embodiment of the present invention will be described. In the following description, the same components as those in the first embodiment are given the same reference numerals, and the description thereof will be omitted.
[0066] In the first embodiment, the processing unit 14 includes the input determination unit 140, and the input determination unit 140 compares the result of the convolution operation with a plurality of consecutive input intervals in the transform-quantization process. In contrast, in the second embodiment, the processing unit 14 includes a threshold processing unit (first threshold processing unit) 142 that performs threshold processing on the input of the transform-quantization process. The following description will focus on configurations that differ from the first embodiment.
[0067] [Functional block of processing section] The processing unit 14 includes an output acquisition unit 141 and a threshold processing unit 142 . The threshold processing unit 142 reads out the result of the convolution operation from the operation result buffer 13, and compares the result with a threshold value that is set in advance for the input of the transform-quantization process.
[0068] Here, in table 160A of storage unit 16 according to the present embodiment, as shown in FIG. 8, for example, five thresholds are set for the input of the transform-quantization process, and data is stored that associates each threshold with the output of the transform-quantization process.
[0069] For example, the threshold processing unit 142 compares whether the calculation result X of the convolution calculation is less than a set threshold or is equal to or greater than the threshold. Specifically, when the calculation result X of the convolution calculation is "1", the threshold processing unit 142 outputs a comparison result that the calculation result X ("1") is less than the set threshold "2" and equal to or greater than the threshold "1".
[0070] The output acquisition unit 141 refers to the table 160A based on the comparison result by the threshold processing unit 142, and acquires the output Y of the conversion-quantization process corresponding to the input threshold value according to the comparison result. The output acquired by the output acquisition unit 141 is temporarily stored in the output buffer 15.
[0071] [CNN processing method] Next, the operation of the CNN processing device 1 according to the present embodiment having the above-mentioned threshold processing unit 142 will be described with reference to Fig. 9. In the CNN processing method according to the present embodiment, steps S1 to S4 are the same as the processes described in the overview of the CNN processing method in Fig. 3.
[0072] First, the input buffer 10 and the weight buffer 11 temporarily store the input signal A and the weight U provided from a server or the like installed outside the CNN processing device 1, respectively (steps S1 and S2).
[0073] Next, the convolution operation unit 12 reads out the input signal A and the weight U from the input buffer 10 and the weight buffer 11, respectively, and performs a convolution operation (step S3). More specifically, the convolution operation unit 12 multiplies the vector of the input signal A by the matrix of the weight U.
[0074] Next, the convolution operation unit 12 stores the operation result X of the convolution operation using this product-sum operation in a corresponding location of the operation result buffer 13 (step S4).
[0075] Thereafter, the processing unit 14 reads the result X of the convolution operation from the operation result buffer 13, and refers to the table 160A in the storage unit 16 to obtain the output Y obtained by subjecting the operation result X to the transformation and quantization processing (step S5A). More specifically, the threshold processing unit 142 compares the result X of the convolution operation with a threshold value that is preset for the input of the transformation and quantization processing, and outputs a threshold value that is lower than the operation result X. Thereafter, the output obtaining unit 141 refers to the table 160A to obtain the output Y corresponding to the threshold value of the input output by the threshold processing unit 142.
[0076] The acquired output Y is temporarily stored in the output buffer 15, and is read and output by the processor 102 (step S6).
[0077] As described above, according to the CNN processing device 1 of the second embodiment, a threshold value set in advance for an input to the transform-quantization process and a table 160A that associates the threshold value with an output from the transform-quantization process are stored in the storage unit 16. Furthermore, the output acquisition unit 141 acquires the output from the transform-quantization process by referring to the table 160A based on a result of comparing the result of the convolution operation with the threshold value.
[0078] Therefore, the conversion process such as ReLU for the result of the convolution operation and the quantization process of the result of the convolution operation can be performed by threshold processing. Therefore, when the output of the conversion-quantization process monotonically increases or decreases, the output of the conversion-quantization process can be uniquely determined by comparing with the threshold.
[0079] In particular, when the CNN processing device 1 is realized by a certain hardware, the comparison using the input interval requires sequential processing, whereas the comparison between the input and the threshold can be performed in a lump. Therefore, according to the CNN processing device 1, even when built-in hardware is used, the CNN arithmetic processing can be performed at a higher speed.
[0080] [Third embodiment] Next, a third embodiment of the present invention will be described. In the following description, the same components as those in the first and second embodiments are given the same reference numerals, and the description thereof will be omitted.
[0081] In the second embodiment, a case was described in which the threshold processing unit 142 compares the input of the transform-quantization process with a preset threshold when the output of the transform-quantization process monotonically increases or decreases. In contrast, in the third embodiment, threshold processing is performed only within one of the input intervals to which the value of the input of the transform-quantization process belongs, based on division information that identifies an input interval in which the output of the transform-quantization process monotonically increases and an input interval in which the output of the transform-quantization process monotonically decreases. The following description will focus on configurations that differ from the first and second embodiments.
[0082] [Functional block of processing section] The processing unit 14 includes an input determination unit 140, an output acquisition unit 141, and a threshold processing unit (second threshold processing unit) 142. The input determination unit 140 determines the input interval of the transform-quantization process to which the result X of the convolution operation by the calculation unit belongs, based on division information that identifies an input interval in which the output of the transform-quantization process monotonically increases and an input interval in which the output of the transform-quantization process monotonically decreases.
[0083] The threshold processing unit 142 compares the calculation result X by the convolution calculation unit 12 with a plurality of thresholds that are preset for the input of the transformation-quantization process within the range of the input determined by the input determination unit 140, and outputs a threshold corresponding to the calculation result X.
[0084] The output acquisition unit 141 refers to the table 160B stored in the storage unit 16, and acquires the output Y of the transform-quantization process corresponding to the threshold value output by the threshold processing unit 142.
[0085] The storage unit 16 stores a table 160B. As shown in Fig. 11, the table 160B stores division information for identifying an input section in which the output of the transform-quantization process monotonically increases and an input section in which the output of the transform-quantization process monotonically decreases, a plurality of thresholds set in advance for the input of the transform-quantization process, and data in which the outputs of the transform-quantization process corresponding to the respective thresholds are associated with each other.
[0086] The division information includes, for example, information indicating the vertex at which the monotonically increasing and monotonically decreasing sections switch when the output, which is further quantized from the result of a convolution operation via a transformation process such as an activation function, is composed of a monotonically increasing section and a monotonically decreasing section like a quadratic function.
[0087] As shown in the example of FIG. 11, in the input / output relationship of the transform-quantization process, the output Y monotonically increases and decreases with the input X=6 as the boundary.
[0088] 11, for example, it is assumed that the calculation result X (input X) of the convolution calculation is less than "6" (X<6). In this case, the input determination unit 140 determines that the input X to the transformation-quantization process belongs to the section of monotonically increasing inputs.
[0089] [CNN processing method] Next, the operation of the CNN processing device 1 according to the present embodiment having the above-mentioned configuration will be described with reference to Fig. 12. Note that in the CNN processing method according to the present embodiment, steps S1 to S4 are similar to the processes described in the overview of the CNN processing method in Fig. 3.
[0090] First, the input buffer 10 and the weight buffer 11 temporarily store the input signal A and the weight U provided from a server or the like installed outside the CNN processing device 1, respectively (steps S1 and S2).
[0091] Next, the convolution operation unit 12 reads out the input signal A and the weight U from the input buffer 10 and the weight buffer 11, respectively, and performs a convolution operation (step S3). More specifically, the convolution operation unit 12 multiplies the vector of the input signal A by the matrix of the weight U.
[0092] Next, the convolution operation unit 12 stores the operation result X of the convolution operation using this product-sum operation in a corresponding location of the operation result buffer 13 (step S4).
[0093] Thereafter, the processing unit 14 reads the result X of the convolution operation from the operation result buffer 13, and refers to the table 160B in the storage unit 16 to obtain the output Y obtained by subjecting the operation result X to transformation and quantization processing (step S5B).
[0094] More specifically, the input determination unit 140 determines the section of the input to which the input X to the transform-quantization process, i.e., the operation result X of the convolution operation, belongs, based on the division information that identifies the section of the input in which the output of the transform-quantization process monotonically increases and the section of the input in which the output of the transform-quantization process monotonically decreases.
[0095] Thereafter, the threshold processing unit 142 compares the operation result X (input X) of the convolution operation with a threshold preset for the input X of the transform-quantization process within the input section determined by the input determination unit 140, and outputs a threshold according to the comparison result. Thereafter, the output acquisition unit 141 refers to the table 160B and acquires the output Y of the transform-quantization process corresponding to the threshold output by the threshold processing unit 142.
[0096] The acquired output Y is temporarily stored in the output buffer 15, and is read and output by the processor 102 (step S6).
[0097] As described above, according to the CNN processing device 1 of the third embodiment, a section to which the input X of the transform-quantization process belongs is determined based on division information that identifies a section in which the output Y of the transform-quantization process monotonically increases and a section in which the output Y of the transform-quantization process monotonically decreases. Then, within the determined input section, threshold processing is performed on the input X to the transform-quantization process, and the output Y of the transform-quantization process is obtained by referring to table 160B.
[0098] Therefore, even if the input / output relationship of the transform-quantization process is not monotonically increasing or decreasing, threshold processing is performed for each section that is monotonically increasing and decreasing, so that CNN calculation processing can be performed faster.
[0099] The above describes embodiments of the neural network processing device, neural network processing method, and neural network processing program of the present invention. However, the present invention is not limited to the described embodiments, and various modifications that can be envisioned by a person skilled in the art can be made within the scope of the invention described in the claims.
[0100] For example, in the embodiment described above, CNN has been given as an example of a neural network, but the neural network employed by the neural network processing device is not limited to CNN.
[0101] It should be noted that the various functional blocks, modules, and circuits described in connection with the embodiments disclosed herein may be implemented using a general purpose processor, a GPU, a digital signal processor (DSP), an application specific integrated circuit (ASIC), an FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of the above designed to achieve the functions described above.
[0102] A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any such configuration of computing devices. [Explanation of symbols]
[0103] 1...CNN processing device, 10...input buffer, 11...weight buffer, 12...convolution calculation unit, 13...calculation result buffer, 14...processing unit, 15...output buffer, 16...memory unit, 101...bus, 102...processor, 103...main memory device, 104...communication interface, 105...auxiliary memory device, 106...input / output device, 160...table, NW...communication network, U...weight, A...input signal.
Claims
1. a calculation unit that performs a first convolution calculation of the neural network, the first convolution calculation including a first product-sum calculation of image data provided to the neural network and a first weight; a processing unit to which a first operation result of the first convolution operation is input as an operation result of the operation unit, the processing unit acquiring the processing result corresponding to the first operation result by using data indicating a relationship between the operation result and a processing result obtained when a transform-quantization process including a predetermined transform and quantization is performed on the operation result, and outputting the acquired processing result as a first processing result; The calculation unit performs a second convolution calculation of the neural network including a second product-sum calculation of the first processing result and a second weight; a second operation result of the second convolution operation is input to the processing unit as the operation result of the operation unit; The processing unit obtains the processing result corresponding to the second calculation result using the data, and outputs the obtained processing result as a second processing result; The quantization included in the transform-quantization process is quantization that reduces bit precision from the image data. A neural network processing device comprising:
2. 2. The neural network processing device according to claim 1, the image data includes values that include decimals; The quantization in the transform-quantization process is a quantization process that converts the predetermined transformed value into a value that does not contain a decimal point. A neural network processing device comprising:
3. 3. The neural network processing device according to claim 1, A storage unit that stores parameters included in the data and used in the transformation-quantization process; A replacement unit that replaces the parameters according to the state of the neural network. A neural network processing device comprising:
4. 4. The neural network processing device according to claim 1, The processing unit includes: a table included in the data, which associates a plurality of input intervals obtained by dividing the calculation results of the calculation unit into a plurality of intervals with the processing results; an input determination unit that determines an input interval including the first operation result or the second operation result as the operation result of the operation unit, using the table; an output acquisition unit that acquires the processing result related to the input section determined by the input determination unit using the table; A neural network processing device comprising:
5. 4. The neural network processing device according to claim 1, The processing unit includes: a threshold processing unit that compares the first calculation result or the second calculation result as the calculation result of the calculation unit with a plurality of preset thresholds included in the data, and outputs a threshold value among the plurality of thresholds that is lower than the calculation result of the calculation unit; an output acquisition unit that acquires the processing result corresponding to the threshold output from the threshold processing unit by using data indicating a relationship between the threshold and the processing result, which is included in the data; A neural network processing device comprising:
6. 6. The neural network processing device according to claim 5, The processing unit further includes an identification unit that identifies whether the processing result monotonically increases or monotonically decreases with respect to the first operation result or the second operation result as the operation result of the operation unit, The threshold processing unit selects a threshold to be used in the comparison from the plurality of thresholds that are set in advance based on the discrimination result of the discrimination unit. A neural network processing device comprising:
7. 7. The neural network processing device according to claim 1, The image data is image data that has been pre-processed in advance. A neural network processing device comprising:
8. 8. The neural network processing device according to claim 1, The image data, the first weight, or the second weight is further provided with a communication interface for acquiring the image data, the first weight, or the second weight from an external server. A neural network processing device comprising:
9. 9. The neural network processing device according to claim 1, The transformation in the transformation-quantization process includes a normalization operation. A neural network processing device comprising:
10. 10. The neural network processing device according to claim 1, further comprising an output section for outputting a signal to an external display device; The output unit outputs the calculation result of the neural network in the neural network processing device to the display device. A neural network processing device comprising:
11. 11. The neural network processing device according to claim 1, The processing unit may comprise one or more of a processor, an application specific integrated circuit, a programmable logic device, and discrete components. A neural network processing device comprising:
12. A first calculation step in which a calculation unit of a neural network processing device performs a first convolution calculation of the neural network including a first product-sum calculation of image data provided to the neural network and a first weight; a first processing step in which a processing unit of the neural network processing device, to which a first operation result of the first convolution operation is input as an operation result of the operation unit, acquires the processing result corresponding to the first operation result by using data indicating a relationship between the operation result and a processing result obtained when a transformation-quantization process including a predetermined transformation and quantization is performed on the operation result, and outputs the acquired processing result as a first processing result; a second calculation step in which the calculation unit performs a second convolution calculation of the neural network including a second product-sum calculation of the first processing result and a second weight; a second processing step in which the processing unit, to which a second operation result of the second convolution operation is input as the operation result of the operation unit, acquires the processing result corresponding to the second operation result using the data, and outputs the acquired processing result as a second processing result, The quantization included in the transform-quantization process is quantization that reduces bit precision from the image data.
2. A neural network processing method comprising:
13. Computer, a calculation unit that performs a first convolution calculation of the neural network, the first convolution calculation including a first product-sum calculation of image data provided to the neural network and a first weight; and a processing unit to which a first operation result of the first convolution operation is input as an operation result of the operation unit, the processing unit functions as a processing unit that acquires the processing result corresponding to the first operation result by using data indicating a relationship between the operation result and a processing result obtained when a transform-quantization process including a predetermined transform and quantization is performed on the operation result, and outputs the acquired processing result as a first processing result; The calculation unit performs a second convolution calculation of the neural network including a second product-sum calculation of the first processing result and a second weight; a second operation result of the second convolution operation is input to the processing unit as the operation result of the operation unit; The processing unit obtains the processing result corresponding to the second calculation result using the data, and outputs the obtained processing result as a second processing result; The quantization included in the transform-quantization process is quantization that reduces bit precision from the image data. A program characterized by:
Citation Information
Patent Citations
Information processing apparatus, image recognition apparatus and method of setting parameter for convolution neural network
JP2018142049A
Arithmetic processing unit and method for controlling the same
JP2018147182A
Storage device and method for performing convolution operations
US20160179434A1
