Network quantization method, inference method and network quantization device

By constructing a statistical information database and adjusting the quantization step interval according to the data distribution, the problem of reduced quantization accuracy in the existing technology is solved, and higher quantization network accuracy and inference accuracy are achieved.

CN112740233BActive Publication Date: 2024-08-23SOCIONEXT INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201880097850.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-09-27
Publication Date
2024-08-23
Estimated Expiration
2038-09-27

AI Technical Summary

Technical Problem

When existing quantization methods deal with uneven distribution of data, the quantification accuracy is reduced and the inference accuracy cannot be effectively maintained.

Method used

By constructing a statistical information database, the quantization step interval is adjusted according to the distribution of high-frequency and low-frequency areas. The high-frequency area sets a narrow quantization step interval. The low-frequency area may not be quantized, using -1, 0, +1 or binary quantization.

Benefits of technology

It improves the accuracy of the quantization network, reduces the bit allocation in low-frequency areas, and enhances the inference accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112740233B
    Figure CN112740233B
Patent Text Reader

Abstract

A network quantization method for quantizing a neural network (14), comprising: a database construction step (S20), constructing a statistical information database (18) of tensors used by the neural network (14) obtained by inputting a plurality of test data sets (12) into the neural network (14); a parameter generation step (S30), generating a quantization parameter set (22) by quantizing the values ​​of the tensors; and a network construction step (S40), quantizing the neural network (14) using the quantization parameter set (22), wherein in the parameter generation step (S30), based on the statistical information database (18), the quantization step interval in a high-frequency region including values ​​of the tensor whose frequency becomes a maximum value is set to be narrower than the quantization step interval in a low-frequency region, the low-frequency region being a region including values ​​of the tensor whose frequency is lower than that of the high-frequency region and whose frequency is not zero.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to a network quantization method, an inference method, and a network quantization device. Background Art

[0002] In the past, neural networks and other networks were used for machine learning. Here, a model that takes numerical data as input and performs some operations to obtain the output value of the numerical data is called a network. When installing the network on hardware such as computers, in order to reduce hardware costs, it is hoped that the inference accuracy after installation is maintained at the same level as the floating-point accuracy, while building a network with lower calculation accuracy.

[0003] For example, when implementing a network that performs all calculations with floating point precision, the hardware cost increases, and therefore it is required to implement a network that performs calculations with fixed point precision while maintaining inference accuracy.

[0004] In the following, the network with floating point precision is also referred to as the pre-quantization network, and the network with fixed point precision is also referred to as the quantization network.

[0005] Here, the process of dividing a floating point value that can continuously express almost any value into predetermined partitions for encoding is referred to as quantization. More generally, quantization is defined as a process of reducing the number of bits or range of numerical values ​​used in a network.

[0006] When a real number is represented by a limited number of bits due to quantization, the distribution of the input data may be different from the expected distribution. In this case, the quantization error increases, which has a negative impact on the speed of machine learning and the accuracy of inference after learning.

[0007] As a method for solving this problem, for example, there is a method described in the known patent document 1. In the method described in patent document 1, a fixed-point format is defined for each weight in each layer of the convolutional neural network and each data. The machine learning of the convolutional neural network starts with floating-point numbers, and analysis is performed to estimate the distribution of the input data. Then, based on the distribution of the input data, the optimal numerical format for representing the input data value is determined, and quantization is performed using this format. In this way, in patent document 1, the distribution of the input data is first investigated, and a numerical format suitable for the distribution is selected to try to solve the above problem.

[0008] (Prior art literature)

[0009] (Patent Document)

[0010] Patent Document 1 Japanese Patent Application Publication No. 2018-10618 Summary of the invention

[0011] Problems to be solved by the invention

[0012] In the method described in Patent Document 1, the range of the data to be used is considered, and a limited number of bits is allocated for the range that can accommodate the data. Here, if there is unevenness in the data within the range, the data in the interval where there is almost no data is also allocated a number of bits. This means that the amount of meaningful data becomes less in terms of the number of bits. Therefore, the accuracy of quantization is reduced.

[0013] Therefore, in order to solve the above-mentioned problems, the present disclosure aims to provide a network quantization method that can construct a quantization network with good accuracy.

[0014] Means used to solve the problem

[0015] In order to achieve the above-mentioned purpose, a network quantization method involved in one form of the present disclosure quantizes a neural network, and the network quantization method includes: a preparation step of preparing the neural network; a database construction step of constructing a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation step of quantizing the values ​​of the tensors based on the statistical information database and the neural network to generate a quantization parameter set; and a network construction step of quantizing the neural network using the quantization parameter set to construct a quantized network, wherein in the parameter generation step, based on the statistical information database, the quantization step interval in a high-frequency area is set to be narrower than the quantization step interval in a low-frequency area, the high-frequency area being an area including values ​​of the tensor whose frequency becomes a maximum value, and the low-frequency area being an area including values ​​of the tensor whose frequency is lower than that of the high-frequency area and whose frequency is not zero.

[0016] In order to achieve the above-mentioned purpose, a network quantization method involved in one form of the present disclosure quantizes a neural network, and the network quantization method includes: a preparation step, preparing the neural network; a database construction step, constructing a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation step, quantizing the values ​​of the tensors according to the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction step, using the quantization parameter set, quantizing the neural network, thereby constructing a quantized network, in which, according to the statistical information database, a quantization area whose frequency is not zero and a non-quantization area whose frequency is not zero and does not overlap with the quantization area are determined among the values ​​of the tensor, the values ​​of the tensors in the quantization area are quantized, and the values ​​of the tensors in the non-quantization area are not quantized.

[0017] In order to achieve the above-mentioned purpose, a network quantization method involved in one form of the present disclosure quantizes a neural network, and the network quantization method includes: a preparation step, preparing the neural network; a database construction step, constructing a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation step, quantizing the values ​​of the tensors based on the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction step, using the quantization parameter set, quantizing the neural network, thereby constructing a quantized network, in which the values ​​of the tensors are quantized into three values ​​of -1, 0, and +1 based on the statistical information database.

[0018] In order to achieve the above-mentioned purpose, a form of the present invention involves a network quantization method, which includes: a preparation step, preparing the neural network; a database construction step, constructing a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation step, quantizing the values ​​of the tensors based on the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction step, using the quantization parameter set, quantizing the neural network to construct a quantized network, in which the values ​​of the tensors are quantized into two values, -1 and +1, based on the statistical information database.

[0019] In order to achieve the above-mentioned purpose, an inference method involved in one form of the present disclosure includes: a network quantization method; a type selection step, selecting a type of the first type and the second type, in which the input data input to the quantization network is classified; a network selection step, selecting one of the first network subset and the second network subset according to the type selected in the type selection step among the first type and the second type; and an input step, inputting the input data to one of the first network subset and the second network subset selected in the network selection step, the network quantization method further includes a classification step, in which at least a part of the multiple test data sets are classified into a first type and a second type according to statistical information of each of the multiple test data sets, the statistical information database includes a first database subset and a second database subset corresponding to the first type and the second type, respectively, the quantization parameter set includes a first parameter subset and a second parameter subset corresponding to the first database subset and the second database subset, respectively, and the quantization network includes a first network subset and a second network subset constructed by using the first parameter subset and the second parameter subset to quantize the neural network, respectively.

[0020] In order to achieve the above-mentioned purpose, a network quantization device involved in one form of the present disclosure quantizes a neural network, and the network quantization device includes: a database construction unit, which constructs a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation unit, which quantizes the values ​​of the tensors based on the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction unit, which quantizes the neural network using the quantization parameter set, thereby constructing a quantized network, the parameter generation unit, based on the statistical information database, sets the quantization step interval in a high-frequency area to be narrower than the quantization step interval in a low-frequency area, the high-frequency area being an area including values ​​of the tensor whose frequency becomes a maximum value, and the low-frequency area being an area including values ​​of the tensor whose frequency is lower than that of the high-frequency area and whose frequency is not zero.

[0021] In order to achieve the above-mentioned purpose, a network quantization device involved in one form of the present disclosure quantizes a neural network, and the network quantization device includes: a database construction unit, which constructs a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation unit, which quantizes the values ​​of the tensors based on the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction unit, which quantizes the neural network using the quantization parameter set, thereby constructing a quantized network, the parameter generation unit, which determines, based on the statistical information database, a quantization area among the values ​​of the tensor whose frequency is not zero, and a non-quantization area whose frequency is not zero and does not overlap with the quantization area, the values ​​of the tensors in the quantization area are quantized, and the values ​​of the tensors in the non-quantization area are not quantized.

[0022] In order to achieve the above-mentioned purpose, a network quantization device involved in one form of the present disclosure quantizes a neural network, and the network quantization device includes: a database construction unit, which constructs a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation unit, which quantizes the values ​​of the tensors based on the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction unit, which quantizes the neural network using the quantization parameter set, thereby constructing a quantized network, and the parameter generation unit quantizes the values ​​of the tensors into three values ​​of -1, 0, and +1 based on the statistical information database.

[0023] In order to achieve the above-mentioned purpose, a network quantization device involved in one form of the present disclosure quantizes a neural network, and the network quantization device includes: a database construction unit, which constructs a statistical information database of tensors used by the neural network obtained by inputting multiple test data sets into the neural network; a parameter generation unit, which quantizes the values ​​of the tensors based on the statistical information database and the neural network, thereby generating a quantization parameter set; and a network construction unit, which quantizes the neural network using the quantization parameter set, thereby constructing a quantized network, and the parameter generation unit quantizes the values ​​of the tensors into two values, -1 and +1, based on the statistical information database. Summary of the invention

[0025] The present disclosure can provide a network quantization method that can construct a quantization network with good accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 This is a block diagram showing an overview of the functional configuration of the network quantization device according to the first embodiment.

[0027] Figure 2 An example of the hardware configuration of a computer that realizes the functions of the network quantization device according to the first embodiment by software is shown.

[0028] Figure 3 : is a flowchart showing the network quantization method involved in the first embodiment.

[0029] Figure 4 It is a schematic diagram showing a quantization method according to a comparative example.

[0030] Figure 5 This is a schematic diagram showing the quantization method involved in the first embodiment.

[0031] Figure 6 This is a schematic diagram showing the range of quantization according to the modification of the first embodiment.

[0032] Figure 7 This is a schematic diagram showing an example of a method for determining a quantization step size interval according to a variation of the first embodiment.

[0033] Figure 8 This is a schematic diagram of another example of a method for determining a quantization step size according to a variation of the first embodiment.

[0034] Fig. 9 This is a block diagram showing an overview of the functional configuration of a network quantization device according to the second embodiment.

[0035] Fig.10 : is a flowchart showing the network quantization method and inference method involved in embodiment 2. DETAILED DESCRIPTION

[0036] The following uses the accompanying drawings to describe the embodiments of the present disclosure in detail. In addition, the embodiments to be described below are all specific examples of the present disclosure. The numerical values, shapes, materials, standards, constituent elements, configuration positions of constituent elements, and connection methods, steps, and the order of steps shown in the following embodiments are all examples, and their main purpose is not to limit the present disclosure. In addition, the constituent elements of the following embodiments that are not recorded in the independent technical solutions that illustrate the highest concept of the present disclosure are described as arbitrary constituent elements. In addition, each figure is not a rigorous illustration. In each figure, the same number is given to substantially the same structure, and repeated descriptions are omitted or simplified.

[0037] (Implementation Method 1)

[0038] The network quantization method and network quantization device according to the first embodiment will be described.

[0039] [1-1. Network quantization device]

[0040] First, use Figure 1 The configuration of the network quantization device according to this embodiment will be described. Figure 1 2 is a block diagram schematically showing the functional configuration of the network quantization device 10 according to the present embodiment.

[0041] The network quantization device 10 is a device for quantizing the neural network 14. That is, the network quantization device 10 is a device for converting the neural network 14 of floating point precision into a neural network of fixed point precision, that is, into a quantized network. In addition, the network quantization device 10 may not quantize all tensors used by the neural network 14, as long as at least a part of the tensors are quantized. Here, a tensor refers to a value represented by an n-dimensional arrangement (n is an integer greater than 0) of parameters such as input data, output data, and weights in each layer of the neural network 14. A tensor may include parameters involved in the smallest unit of operation in the neural network 14. In the case where the neural network 14 is a convolutional neural network, the weights and bias values ​​of the functions defined as the convolutional layers may also be included in the tensor. In addition, parameters such as normalization processing in the neural network 14 may also be included in the tensor.

[0042] like Figure 1 As shown, the network quantization device 10 includes a database construction unit 16, a parameter generation unit 20, and a network construction unit 24. In the present embodiment, the network quantization device 10 further includes a machine learning unit 28.

[0043] The database construction unit 16 is a processing unit that constructs a statistical information database 18 of tensors used by the neural network 14 obtained when a plurality of test data sets 12 are input to the neural network 14. The database construction unit 16 calculates statistical information such as the relationship between the value and frequency of each tensor used by the neural network 14 for the plurality of test data sets 12, and constructs the statistical information database 18 of each tensor. The statistical information database 18 includes, for example, at least a part of the statistics such as the mean value, median, mode, maximum value, minimum value, local maximum value, local minimum value, variance, deviation, skewness, kurtosis, etc. of each tensor.

[0044] The parameter generation unit 20 is a processing unit that quantizes the value of the tensor based on the statistical information database 18 and the neural network 14 to generate a quantization parameter set. The parameter generation unit 20 sets the quantization step interval in the high-frequency region including the value of the tensor whose frequency becomes the maximum value to be narrower than the quantization step interval in the low-frequency region, which is a region including the value of the tensor whose frequency is lower than that of the high-frequency region and whose frequency is not zero, based on the statistical information database 18. The detailed processing content of the parameter generation unit 20 will be described later.

[0045] The network construction unit 24 is a processing unit that quantizes the neural network 14 by using the quantization parameter set 22 to thereby construct a quantized network 26 .

[0046] The machine learning unit 28 is a processing unit that performs machine learning on the quantized network 26. The machine learning unit 28 performs machine learning by inputting a plurality of test data sets 12 or other input data sets to the quantized network 26 constructed by the network construction unit 24. Accordingly, the machine learning unit 28 constructs a quantized network 30 with better inference accuracy than the quantized network 26. In addition, the network quantization device 10 does not necessarily need to include the machine learning unit 28.

[0047] With the above configuration, the network quantization device 10 can construct a quantization network with good accuracy.

[0048] [1-2. Hardware configuration]

[0049] Next, use Figure 2 The hardware configuration of the network quantization device 10 according to the present embodiment will be described. Figure 2 An example of the hardware configuration of a computer 1000 that realizes the functions of the network quantization device 10 according to the present embodiment by software is shown.

[0050] Computer 1000 Figure 2 As shown, a computer includes an input device 1001, an output device 1002, a CPU 1003, a built-in storage device 1004, a RAM 1005, a reader 1007, a transceiver 1008, and a bus 1009. The input device 1001, the output device 1002, the CPU 1003, the built-in storage device 1004, the RAM 1005, the reader 1007, and the transceiver 1008 are connected by a bus 1009.

[0051] The input device 1001 is a device that serves as a user interface such as input keys, a touch pad, or a touch panel display, and receives user operations. In addition, the input device 1001 may receive voice operations or remote operations such as a remote controller in addition to user contact operations.

[0052] The built-in storage device 1004 is a flash memory, etc. Furthermore, the built-in storage device 1004 may store in advance at least one of a program for realizing the functions of the network quantification device 10 and an application (Application) utilizing the functions of the network quantification device 10 .

[0053] RAM 1005 is a random access memory (Random Access Memory) and is used to store data and the like when a program or an application is executed.

[0054] The reading device 1007 reads information from a recording medium such as a USB (Universal Serial Bus) memory. The reading device 1007 reads the above-mentioned programs or applications from a recording medium recording such programs or applications, and stores the programs or applications in the built-in storage device 1004 .

[0055] The transceiver 1008 is a communication circuit for wireless or wired communication. The transceiver 1008 communicates with a server device connected to a network, downloads the above-mentioned program or application from the server device, and stores it in the built-in storage device 1004.

[0056] The CPU 1003 is a central processing unit (Central Processing Unit), which copies the program or application stored in the built-in storage device 1004 to the RAM 1005, and sequentially reads instructions included in the program or application from the RAM 1005 for execution.

[0057] [1-3. Network quantization method]

[0058] Next, use Figure 3 The network quantization method according to this embodiment is described. Figure 3 is a flowchart showing a network quantization method according to the present embodiment.

[0059] like Figure 3 As shown, in the network quantization method, firstly, a neural network 14 is prepared (S10). In this embodiment, a neural network 14 that has been learned in advance is prepared. The neural network 14 is a non-quantized neural network, that is, a neural network with floating point precision. In addition, in the learning of the neural network 14, there is no special limitation on the input data used, which can include Figure 1 A plurality of test data sets 12 are shown.

[0060] Next, the database construction unit 16 constructs a statistical information database of tensors used by the neural network 14 obtained when the plurality of test data sets 12 are input to the neural network 14 (S20). In the present embodiment, the database construction unit 16 calculates statistical information such as the relationship between the value and frequency of each tensor used by the neural network 14 for the plurality of test data sets 12, and constructs a statistical information database 18 for each tensor.

[0061] Next, the parameter generation unit 20 quantizes the value of the tensor based on the statistical information database 18 and the neural network 14, thereby generating a quantization parameter set 22 (S30).

[0062] Next, the network construction unit 24 quantizes the neural network 14 using the quantization parameter set 22 to construct the quantized network 26 ( S40 ).

[0063] Next, the machine learning unit 28 causes the quantized network 26 to perform machine learning (S50). The machine learning unit 28 causes the quantized network 26 to perform machine learning by inputting a plurality of test data sets 12 or other input data sets into the quantized network 26 constructed by the network construction unit 24. Thus, a quantized network 30 with good inference accuracy can be constructed through the quantized network 26. In addition, the network quantization method involved in this embodiment does not necessarily need to include the machine learning step S50.

[0064] As described above, the network quantization method according to this embodiment can quantize a neural network with good accuracy.

[0065] [1-4. Parameter generation unit]

[0066] Next, a method for generating the quantization parameter set 22 in the parameter generation unit 20 according to the present embodiment will be described in detail.

[0067] As described above, the parameter generation unit 20 quantizes the value of the tensor according to the statistical information database 18 and the neural network 14, thereby generating a quantization parameter set. Figure 4 as well as Figure 5 The following description will be given by comparing the quantification methods of comparative examples. Figure 4 as well as Figure 5 Schematic diagrams showing the quantization method according to the comparative example and the present embodiment, respectively. Figure 4 as well as Figure 5 , a graph showing the relationship between the value and frequency of the tensor used by the neural network 14 is shown.

[0068] exist Figure 4In the distribution example of the tensor value shown, the frequency has two maximum values, and the frequency is low in the area between the two maximum values ​​and the area outside the two maximum values. In the case where the value of this tensor is uneven, for example, according to a comparative example using a quantization method in the prior art described in Patent Document 1, the entire area where the data exists is quantized equally. Figure 4 As an example, an example of quantization with a resolution of 8 bits is shown.

[0069] According to the quantization method of the comparative example, although there is data, since the low-frequency area is also quantized, the number of bits is also allocated to the data in the interval where there is almost no data. This means that the amount of meaningful data is reduced in terms of the number of bits. Therefore, the accuracy of quantization is reduced.

[0070] However, the parameter generation unit 20 involved in the present embodiment sets the quantization step interval in the high-frequency region including the value of the tensor whose frequency becomes the maximum value to be narrower than the quantization step interval in the low-frequency region, which is a region whose frequency is lower than that in the high-frequency region and includes tensor values ​​whose frequency is not zero, based on the statistical information database 18. Accordingly, compared with the above-mentioned comparative example, the number of bits allocated to the low-frequency region in quantization can be reduced. Therefore, since the accuracy of quantization can be improved, a quantization network with good accuracy can be constructed. Figure 5 In the example shown, the high-frequency region includes a first region and a second region having values ​​whose frequencies among the tensor values ​​are maximum, and the low-frequency region includes a third region having values ​​among the tensor values ​​that are between the first region and the second region. Furthermore, the tensor values ​​of at least a part of the low-frequency region may not be quantized. Figure 5 In the example shown, the low-frequency region is composed of the fourth region and the fifth region having values ​​outside the first region and the second region, and the third region, and the value of the tensor in the low-frequency region is not quantized. The first region and the second region constituting the high-frequency region are quantized equally with a resolution of 7 bits. Accordingly, in quantization, the number of bits allocated to the low-frequency region can be reduced to a minimum. Therefore, the accuracy of quantization can be further improved.

[0071] Here, there is no particular limitation on the method of determining the high-frequency region and the low-frequency region. For example, the region consisting of data included in the upper 90% may be defined as the high-frequency region, starting from the data with the highest frequency.

[0072] And, in Figure 5 In the example shown, although the value of the tensor in the low-frequency region is not quantized, it can be quantized with a larger quantization step interval than that in the high-frequency region.

[0073] And, in Figure 5 In the example shown, the quantization step interval is uniform in the high-frequency region, but the quantization step interval may be changed according to the frequency. For example, the quantization step interval may be set so that the quantization step interval becomes narrower as the frequency increases.

[0074] And, in Figure 5 In the example shown, the quantization step size is determined according to the frequency, but it can also be determined using an index according to the frequency. For example, based on the probability distribution p(x) of the value (x) of each element of the tensor as a random variable, the probability distribution q(x) of the value (x) of each element of the quantized tensor as a random variable is measured to determine how much difference there is, and the quantization method (the method for determining the quantization step size, etc.) is used to reduce the difference, and the quantization step size is obtained.

[0075] The following use Figures 6 to 8 To illustrate this example. Figure 6 It is a schematic diagram showing the range of quantization according to a modification of the present embodiment. Figure 7 This is a schematic diagram showing an example of a method for determining a quantization step size according to a modification of the present embodiment. Figure 8 This is a schematic diagram showing another example of a method for determining a quantization step size according to a modification of the present embodiment.

[0076] First, set the range of x to be quantized. For example Figure 6 As shown in the diagram (b) of , all ranges of x where data exists are set as the quantized range. Or, Figure 6 As shown in the graph (c) of , a region with a low frequency is regarded as being outside the range, and a part of the range of the value of x where data exists is set as the quantization range.

[0077] Next, the quantization step interval is set. For example, when all ranges of x where data exists are set as the quantization range ( Figure 6 (b)), and when a part of the range of x values ​​where data exists is set as the quantized range ( Figure 6 The diagram (c) is as follows: Figure 7 The graph (a) and Figure 8 As shown in the graph (a) of , the quantization step size within the quantization range is set.

[0078] Then, if Figure 7 The graph (b) and Figure 8As shown in the graph (b) of , the probability distribution q(x) corresponding to the value of the tensor quantized for the set quantization step is obtained. A plurality of q(x)s with different quantization ranges and quantization step intervals are prepared. Next, as a scale for measuring the difference between the two probability distributions p(x) and q(x), the relative entropy (Kullback-Leibler divergence) is used (the smaller the value of this scale, the closer q(x) is to p(x)), and the scale is determined to be q(x) smaller than the specified value. The quantization step interval set for this q(x) can be used as the quantization step interval to be obtained. For example, the quantization step interval that gives the q(x) with the smallest relative entropy (Kullback-Leibler divergence) can be used as the quantization step interval to be obtained. In addition, the relative entropy (Kullback-Leibler divergence) can be expressed by the following formula (1).

[0079] [Formula 1]

[0080]

[0081] [1-5. Calculation method]

[0082] Next, a description will be given of specific examples of the calculation method in the parameter generation unit 20. As examples of calculation methods that can be used in the quantization method according to the present embodiment, three calculation methods are shown below.

[0083] [1-5-1.m fixed point]

[0084] The following describes the calculation method for quantizing floating-point precision data into m-bit fixed-point data. -n As a scaling factor, x is converted into a value FXP(x, m, n) of m-bit fixed-point precision using the following equation (2).

[0085] [Formula 2]

[0086]

[0087] Here, the function Clip(a, MIN, MAX) is a function that limits the value of the variable a to a range of not less than MIN and not more than MAX, and is defined by the following formula (3).

[0088] [Formula 3]

[0089]

[0090] Furthermore, MIN and MAX of the above-mentioned formula (2) are expressed by the following formulas (4) and (5).

[0091] [Formula 4]

[0092] MIN=-2 m-1 2 -n (4)

[0093] [Formula 5]

[0094] MAX=(2 m-1 -1)·2 -n (5)

[0095] When such a quantization method is used, a sign mode and a decimal point position are adopted as quantization parameters.

[0096] The sign mode is a parameter indicating whether the minimum value of FXP(x, m, n) is greater than or equal to 0. For example, when the minimum value of FXP(x, m, n) is greater than or equal to 0, there is no need to allocate bits to negative values, so the number of bits can be saved by 1.

[0097] The decimal point position is a fixed point position that can express a value above MIN and below MAX. For example, in the case where the distribution of variable x can be approximated by normal distribution (Gaussian distribution), the decimal point position can be determined by obtaining the median, standard deviation and other information included in the above-mentioned statistical information database 18. In addition, although the example of approximating the distribution of variable x by normal distribution is described here, the distribution of variable x is not limited to normal distribution. In the case where the distribution of variable x is approximated by other distributions, the decimal point position can also be appropriately determined according to the distribution shape. For example, in the case where the distribution of variable x is approximated by mixed normal distribution, the decimal point position can be determined according to each of the multiple peaks included in the mixed normal distribution.

[0098] [1-5-2. Logarithm]

[0099] The calculation method of quantizing floating-point precision data using logarithms is described. In this calculation method, the logarithm of the value of the data is taken, and bits are allocated on a logarithmic scale. In this method, the logarithmic maximum value is used as a quantization parameter. The logarithmic maximum value is the maximum value of the logarithm of the maximum value of the value of the floating-point precision data obtained from the statistical information database 18.

[0100] [1-5-3. Three-value and two-value]

[0101] The operation method of quantizing floating-point precision data into three values ​​is described. In this operation method, the floating-point precision data as an example of the value of the tensor is quantized into three values ​​of -1, 0, and +1 according to the statistical information database. In this quantization, four quantization parameters, namely the positive threshold, the negative threshold, the positive scale, and the negative scale are used. The positive threshold is the smallest value quantized to +1, and the negative threshold is the largest value quantized to -1. In addition, the positive scale and the negative scale are coefficients corresponding to +1 and -1, respectively. In more detail, the positive scale is a coefficient used to approximate the value of the floating-point data starting from +1, and the negative scale is a coefficient used to approximate the value of the floating-point data starting from -1.

[0102] For example, the median, minimum value, and maximum value of the data distribution are obtained from the statistical information database 18, and a predetermined range in the positive direction and the negative direction from the median is determined, and the value of the data in the range is quantized to 0. Furthermore, the thresholds in the positive direction and the negative direction of the range are determined as the positive threshold and the negative threshold as the above-mentioned quantization parameter, respectively. Furthermore, the absolute values ​​of the maximum value and the minimum value are assumed to be floating-point approximations of +1 and -1, respectively, and the absolute values ​​of the maximum value and the minimum value are determined as the positive scale and the negative scale as the above-mentioned quantization parameter, respectively.

[0103] Through this quantization method, for example, in the multiplication-addition operation in the convolutional neural network, the multiplication of the weight and the data value can be realized by the multiplication of the weight and +1, 0, or -1. That is, in the multiplication-addition operation, since multiplication is essentially not required, the amount of calculation can be greatly reduced.

[0104] Furthermore, the floating point precision data as an example of the value of the tensor may be quantized into two values, -1 and +1, based on the statistical information database. The binary quantization can be regarded as unifying the value -1 and the value 0 in the three-value quantization into one value -1, and a threshold value having the same value as the positive threshold and the negative threshold can be used. The positive scale and the negative scale are the same as the three-value quantization even in the binary quantization.

[0105] (Implementation Method 2)

[0106] The network quantization method and the like involved in Implementation 2 are described. The network quantization method involved in this implementation is different from the quantization method involved in Implementation 1 in that the test data set is classified into multiple types based on the statistical information of the test data set, and different processing is performed for each type. Hereinafter, an inference method using a quantized network generated by the network quantization method, network quantization device, and network quantization method involved in this implementation is described, focusing on the differences from Implementation 1.

[0107] [2-1. Network quantization device]

[0108] First, use Fig. 9 The configuration of the network quantization device according to this embodiment will be described. Fig. 9 2 is a block diagram schematically showing the functional configuration of the network quantization device 110 according to the present embodiment.

[0109] like Fig. 9 As shown, the network quantization device 110 includes a database construction unit 116, a parameter generation unit 120, and a network construction unit 124. In this embodiment, the network quantization device 110 further includes a machine learning unit 28. The database construction unit 116, the parameter generation unit 120, and the network construction unit 124 of the network quantization device 110 involved in this embodiment are different from the network quantization device 10 involved in the first embodiment.

[0110] As described in Embodiment 1, a quantized network with good accuracy can be obtained by changing the quantization step interval according to the range of the tensor value according to the distribution of the tensor value used by the neural network 14. Therefore, in this embodiment, by performing quantization according to each type of the plurality of test data sets 12, a quantized network with better accuracy can be obtained.

[0111] The database construction unit 116 involved in this embodiment is similar to the database construction unit involved in the first embodiment, and constructs a statistical information database of tensors used by the neural network 14 obtained when multiple test data sets are input to the neural network 14. In this embodiment, the database construction unit 116 classifies at least a part of the multiple test data sets 12 into a first type and a second type based on the statistical information of each of the multiple test data sets 12. For example, when multiple images are used as the multiple test data sets 12, the multiple images are classified into a type of outdoor images during the day and a type of outdoor images at night based on statistical information such as the brightness of the images. As a specific calculation method, for example, the distribution of the tensors of all the data sets for the multiple test data sets 12 can be estimated to follow a mixed normal distribution, and each of the multiple normal distributions included in the mixed normal distribution can be classified as a type. In this case, each of the multiple test data sets 12 can be compared with the multiple normal distributions to classify each test data set.

[0112] The statistical information database 118 constructed by the database construction unit 116 includes a first database subset and a second database subset corresponding to the first type and the second type, respectively. In other words, the database construction unit 116 constructs the first database subset, which includes statistical information of tensors used by the neural network 14 obtained when a test data set belonging to the first type among the multiple test data sets 12 is input to the neural network 14. In addition, the database construction unit 116 constructs the second database subset, which includes statistical information of tensors used by the neural network 14 obtained when a test data set belonging to the second type among the multiple test data sets 12 is input to the neural network 14.

[0113] The parameter generation unit 120, similar to the parameter generation unit 20 in Embodiment 1, quantizes the value of the tensor based on the statistical information database and the neural network, thereby generating a quantization parameter set 122. In this embodiment, the quantization parameter set 122 includes a first parameter subset and a second parameter subset corresponding to the first database subset and the second database subset, respectively.

[0114] The network construction unit 124, like the network construction unit 24 in Embodiment 1, quantizes the neural network using the quantization parameter set 122 to construct a quantized network 126. In this embodiment, the quantized network 126 includes a first network subset and a second network subset corresponding to the first parameter subset and the second parameter subset, respectively.

[0115] Accordingly, in the present embodiment, since quantization networks corresponding to the first type and the second type of the plurality of test data sets 12 are constructed, a quantization network with better accuracy can be constructed.

[0116] In addition, in this embodiment, as in Embodiment 1, the machine learning unit 28 causes the quantized network 126 to perform machine learning. In this embodiment, the machine learning unit 28 performs machine learning by inputting the first type and the second type of test data sets into the first network subset and the second network subset, respectively. The quantized network 126 can construct a quantized network 130 with better accuracy.

[0117] In addition, the database construction unit 116 may also classify the plurality of test data sets 12 into three or more types. Correspondingly, the statistical information database 118 may include three or more database subsets, and the quantization parameter set 122 may include three or more parameter subsets. Furthermore, the quantization network 126 and the quantization network 30 may also include three or more network subsets, respectively.

[0118] [2-2. Network quantization method and inference method]

[0119] Next, use Fig.10 The network quantization method involved in this embodiment and the inference method using the network quantization method are described. Fig.10 : is a flowchart showing the network quantization method and inference method involved in this embodiment.

[0120] The reasoning method involved in this embodiment includes Fig.10 All steps of the flowchart shown in the figure, the network quantization method involved in this embodiment includes Fig.10 The steps from step S10 to step S150 in the flowchart shown.

[0121] like Fig.10 As shown, in the network quantization method and inference method according to the present embodiment, first, similarly to the network quantization method according to the first embodiment, a neural network 14 is prepared (S10).

[0122] Next, the database construction unit 116 classifies at least a part of the plurality of test data sets 12 into the first type and the second type based on each statistical information of the plurality of test data sets 12 ( S115 ).

[0123] Next, the database construction unit 116 constructs a statistical information database 118 of tensors used by the neural network 14 obtained when the plurality of test data sets 12 are input into the neural network 14 (S120). In the present embodiment, the statistical information database 118 includes a first database subset and a second database subset corresponding to the first type and the second type, respectively.

[0124] Next, the parameter generation unit 120 generates a quantization parameter set 122 (S130) by quantizing the value of the tensor according to the statistical information database 118 and the neural network 14. In this embodiment, the quantization parameter set 122 includes a first parameter subset and a second parameter subset corresponding to the first database subset and the second database subset, respectively.

[0125] Next, the network construction unit 24 quantizes the neural network 14 using the quantization parameter set 122, thereby constructing the quantized network 126 (S140). In this embodiment, the quantized network 126 includes a first network subset and a second network subset constructed by quantizing the neural network 14 using the first parameter subset and the second parameter subset, respectively.

[0126] Next, the machine learning unit 28 causes the quantized network 126 to perform machine learning (S150). The machine learning unit 28 causes the quantized network 126 to perform machine learning by inputting a plurality of test data sets 12 or other input data sets into the quantized network 126 constructed by the network construction unit 124. In the present embodiment, the machine learning unit 28 performs machine learning by inputting the first type and the second type of test data sets into the first network subset and the second network subset, respectively. Accordingly, the quantized network 126 can construct a quantized network 130 with better accuracy. In addition, the network quantization method involved in the present embodiment may not necessarily include the machine learning step S150.

[0127] As described above, the network quantization method according to this embodiment can quantize a neural network with high accuracy.

[0128] Next, in the inference method involved in this embodiment, the inference is performed using the constructed quantized network 126 by the above-mentioned network quantization method. Specifically, first, input data is prepared, and the type of the input data input to the quantized network 126 is selected from the first type and the second type (S160). This step 160 can be performed by, for example, analyzing the input data by a computer or the like on which the quantized network 126 is installed, and selecting the type based on the statistical information of the input data.

[0129] Next, one of the first and second network subsets is selected according to the type selected in the type selection step S160 (S170). In step 160, for example, a computer on which the quantization network 126 is installed may select a network subset corresponding to the selected type.

[0130] Next, input data is input to one of the first network subset and the second network subset selected in the network selection step S170 (S180), and inference is performed on the selected network subset.

[0131] The inference method of this embodiment can perform inference using a quantized network that has been quantized with good accuracy as described above, so that an inference result with good accuracy can be obtained. In addition, in this embodiment, since inference is performed using a quantized network that is suitable for the type of input data, an inference result with even better accuracy can be obtained.

[0132] (Variation examples, etc.)

[0133] The network quantization method and the like involved in the present disclosure are described above based on various embodiments, and the present disclosure is not limited to these embodiments. Without departing from the scope of the present disclosure, various forms obtained by performing various modifications that can be thought of by those skilled in the art on the various embodiments, and other forms constructed by combining some of the constituent elements in each embodiment are all included in the scope of the present disclosure.

[0134] For example, in the parameter generation step of the network quantization method involved in the variant of the above-mentioned embodiment 1, a quantization region whose frequency is not zero among the values ​​of the tensor and a non-quantization region whose frequency is not zero and does not overlap with the quantization region can be determined based on the statistical information database, and the values ​​of the tensor in the quantization region can be quantized, and the values ​​of the tensor in the non-quantization region may not be quantized. Furthermore, the parameter generation unit of the network quantization device involved in the variant of the above-mentioned embodiment 1 can determine a quantization region whose frequency is not zero among the values ​​of the tensor and a non-quantization region whose frequency is not zero and does not overlap with the quantization region based on the statistical information database, and the values ​​of the tensor in the quantization region can be quantized, and the values ​​of the tensor in the non-quantization region may not be quantized.

[0135] This variation is equivalent to, for example, the following situation, that is, in the network quantization method and the network quantization device involved in the above-mentioned embodiment 1, at least a part of the first area and the second area are determined as quantized areas, and at least a part of the third area to the fifth area are determined as non-quantized areas, and the values ​​of the tensors in the non-quantized areas are not quantized.

[0136] In this way, by selecting tensor values ​​whose frequency is not zero among the values ​​of the tensor to be quantized, the accuracy of quantization can be improved when the values ​​of the tensor to be quantized include values ​​whose frequency is zero. Therefore, a quantization network with good accuracy can be constructed.

[0137] Furthermore, in the present variation, the quantized region may include values ​​whose frequency among the values ​​of the tensor is extremely large, and the non-quantized region may include values ​​whose frequency among the values ​​of the tensor is lower than that of the quantized region.

[0138] This variation is equivalent to, for example, the following situation, that is, in the network quantization method and the network quantization device involved in the above-mentioned embodiment 1, at least one of the first area and the second area is determined as a quantized area, and at least a part of the third area to the fifth area is determined as a non-quantized area, and the value of the tensor in the non-quantized area is not quantized.

[0139] According to this, since the quantization region includes a value where the frequency of the tensor value becomes a maximum value, the quantization accuracy can be further improved. Therefore, a quantization network with better accuracy can be constructed.

[0140] Furthermore, in the parameter generation step of the network quantization method involved in this variant, an indicator based on frequency can be used to determine the quantization area and the non-quantization area. For example, in the parameter generation step, the quantization area and the non-quantization area can be determined according to a scale for measuring the difference between the distribution of the value of the tensor and the distribution of the value of the quantized tensor. Furthermore, the parameter generation unit of the network quantization device can determine the quantization area and the non-quantization area according to a scale for measuring the difference between the distribution of the value of the tensor and the distribution of the value of the quantized tensor. As such a scale, for example, relative entropy (Kullback-Leibler divergence) can be used.

[0141] Furthermore, the aspects shown below may be included within the scope of one or more aspects of the present disclosure.

[0142] (1) A part of the components constituting the above-mentioned network quantization device may be a computer system consisting of a microprocessor, ROM, RAM, hard disk unit, display unit, keyboard, mouse, etc. A computer program may be stored in the RAM or hard disk unit. The microprocessor realizes its function by operating according to the computer program. Here, the computer program is composed of a plurality of combinations of instruction codes indicating instructions to the computer in order to realize a prescribed function.

[0143] (2) A part of the components constituting the above-mentioned network quantization device may be constituted by a system LSI (Large Scale Integration). The system LSI is a super-multifunctional LSI manufactured by integrating multiple components on a single chip, and specifically, is a computer system constituted by a microprocessor, ROM, RAM, etc. A computer program is stored in the RAM. The microprocessor operates according to the computer program, so that the system LSI realizes its function.

[0144] (3) A part of the components constituting the above-mentioned network quantization device may be composed of an IC card or a single module that can be loaded and unloaded on each device. The IC card or the module is a computer system composed of a microprocessor, ROM, RAM, etc. The IC card or the module may include the above-mentioned super-multifunctional LSI. The microprocessor works according to the computer program, so that the IC card or the module realizes its function. The IC card or the module may be tamper-proof.

[0145] (4) Furthermore, a part of the components constituting the above-mentioned network quantization device may be recorded on a recording medium that can read the computer program or the digital signal by a computer, for example, a floppy disk, a hard disk, a CD-ROM, an MO, a DVD, a DVD-ROM, a DVD-RAM, a BD (Blu-ray (registered trademark) Disc), a semiconductor memory, etc. And the digital signal recorded on these recording media may be.

[0146] Furthermore, a part of the components constituting the above-mentioned network quantization device may transmit the computer program or the digital signal via an electric communication line, a wireless or wired communication line, a network represented by the Internet, data broadcasting, and the like.

[0147] (5) The present disclosure may be the above-mentioned methods. Furthermore, these methods may be computer programs implemented by a computer, or may be digital signals constituted by the computer programs.

[0148] (6) Furthermore, the present disclosure may be a computer system including a microprocessor and a memory, wherein the memory may store the computer program and the microprocessor may operate according to the computer program.

[0149] (7) Furthermore, the program or the digital signal can be executed by another independent computer system by recording it on the recording medium and transferring it, or by transferring the program or the digital signal via the network or the like.

[0150] (8) The above-mentioned embodiments and modifications may be combined.

[0151] Industrial Applicability

[0152] The present disclosure can be applied to image processing methods and the like as a method of implementing a neural network in a computer and the like.

[0153] Explanation of symbols

[0154] 10, 110 Network Quantization Device

[0155] 12 Test Dataset

[0156] 14 Neural Networks

[0157] 16.116 Database Construction Department

[0158] 18.118 Statistical Information Database

[0159] 20, 120 Parameter generation unit

[0160] 22, 122 Quantization parameter set

[0161] 24, 124 Network Construction Department

[0162] 26, 30, 126, 130 Quantized networks

[0163] 28 Machine Learning Department

[0164] 1000 Computer

[0165] 1001 Input Device

[0166] 1002 Output device

[0167] 1003 CPU

[0168] 1004 Internal storage device

[0169] 1005 RAM

[0170] 1007 Reading Device

[0171] 1008 Transceiver

[0172] 1009 Bus

Claims

1. A network quantization method for image processing to quantize neural networks. The network quantization method comprises: A preparation step, preparing the neural network; A database construction step of constructing a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; a parameter generation step, quantizing the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction step, using the quantization parameter set to quantize the neural network, thereby constructing a quantized network, In the parameter generation step, based on the statistical information database, the quantization step interval in the high-frequency area is set to be narrower than the quantization step interval in the low-frequency area. The high-frequency area is an area including values ​​of the tensor whose frequency becomes a maximum value, and the low-frequency area is an area including values ​​of the tensor whose frequency is lower than that of the high-frequency area and whose frequency is not zero.

2. A network quantization method for image processing to quantize neural networks. The network quantization method comprises: A preparation step, preparing the neural network; A database construction step of constructing a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; a parameter generation step, quantizing the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction step, using the quantization parameter set to quantize the neural network, thereby constructing a quantized network, In the parameter generation step, based on the statistical information database, a quantization area in which the frequency of the tensor value is not zero and a non-quantization area in which the frequency is not zero and does not overlap with the quantization area are determined, the value of the tensor in the quantization area is quantized, and the value of the tensor in the non-quantization area is not quantized.

3. A network quantization method for image processing to quantize neural networks. The network quantization method comprises: A preparation step, preparing the neural network; A database construction step of constructing a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; a parameter generation step, quantizing the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction step, using the quantization parameter set to quantize the neural network, thereby constructing a quantized network, In the parameter generation step, the value of the tensor is quantized into three values: -1, 0, and +1 according to the statistical information database.

4. A network quantization method for image processing to quantize neural networks. The network quantization method comprises: A preparation step, preparing the neural network; A database construction step of constructing a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; a parameter generation step, quantizing the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction step, using the quantization parameter set to quantize the neural network, thereby constructing a quantized network, In the parameter generation step, the value of the tensor is quantized into two values, -1 and +1, according to the statistical information database.

5. The network quantization method according to claim 3 or 4, In the parameter generation step, a positive threshold and a negative threshold are determined as quantization parameters based on the statistical information database, wherein the positive threshold is the smallest numerical value quantized to +1, and the negative threshold is the largest numerical value quantized to -1.

6. The network quantization method according to claim 5, In the parameter generation step, a positive scale and a negative scale are determined as quantization parameters based on the statistical information database, and the positive scale and the negative scale are coefficients corresponding to +1 and -1, respectively.

7. The network quantization method according to claim 2, The quantized region includes a value whose frequency among the values ​​of the tensor is maximum, and the non-quantized region includes a value whose frequency among the values ​​of the tensor is lower than that of the quantized region.

8. The network quantization method according to claim 2, In the parameter generation step, the quantized region and the non-quantized region are determined according to a scale for measuring a difference between a distribution of values ​​of the tensor and a distribution of values ​​of the quantized tensor.

9. The network quantization method according to claim 1, The high-frequency region includes a first region and a second region, and the first region and the second region each include a value whose frequency among the values ​​of the tensor becomes maximum. The low-frequency region includes a third region including values ​​of the tensor that are between the first region and the second region.

10. The network quantization method according to claim 1 or 9, In the parameter generating step, the value of the tensor in at least a part of the low-frequency region is not quantized.

11. The network quantization method according to any one of claims 1 to 10, The network quantization method further includes a machine learning step of causing the quantized network to perform machine learning.

12. The network quantization method according to any one of claims 1 to 11, The network quantization method further comprises a classification step, in which at least a part of the plurality of test data sets is classified into a first type and a second type according to statistical information of each of the plurality of test data sets, The statistical information database includes a first database subset and a second database subset corresponding to the first type and the second type respectively. The quantization parameter set includes a first parameter subset and a second parameter subset corresponding to the first database subset and the second database subset respectively. The quantized network includes a first network subset and a second network subset constructed by using the first parameter subset and the second parameter subset to quantize the neural network respectively.

13. A reasoning method comprising: The network quantization method according to claim 12; a type selection step of selecting a type, from among the first type and the second type, into which the input data input to the quantization network is classified; a network selection step of selecting one of the first network subset and the second network subset according to the type selected in the type selection step, among the first type and the second type; as well as An input step of inputting the input data to one of the first network subset and the second network subset selected in the network selection step.

14. A network quantization device for image processing, quantizing a neural network, The network quantization device comprises: A database construction unit that constructs a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; A parameter generation unit, which quantizes the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction unit quantizes the neural network using the quantization parameter set, thereby constructing a quantized network. The parameter generating unit sets the quantization step interval in the high-frequency area to be narrower than the quantization step interval in the low-frequency area based on the statistical information database. The high-frequency area is an area including values ​​of the tensor whose frequency becomes a maximum value, and the low-frequency area is an area including values ​​of the tensor whose frequency is lower than that of the high-frequency area and whose frequency is not zero.

15. A network quantization device for image processing, quantizing a neural network, The network quantization device comprises: A database construction unit that constructs a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; A parameter generation unit, which quantizes the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction unit quantizes the neural network using the quantization parameter set, thereby constructing a quantized network. The parameter generation unit determines, based on the statistical information database, a quantization area in which the frequency of the tensor value is not zero, and a non-quantization area in which the frequency is not zero and does not overlap with the quantization area. The value of the tensor in the quantization area is quantized, and the value of the tensor in the non-quantization area is not quantized.

16. A network quantization device for image processing, quantizing a neural network, The network quantization device comprises: A database construction unit that constructs a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; A parameter generation unit, which quantizes the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction unit quantizes the neural network using the quantization parameter set, thereby constructing a quantized network. The parameter generation unit quantizes the value of the tensor into three values ​​of -1, 0, and +1 based on the statistical information database.

17. A network quantization device for image processing, quantizing a neural network, The network quantization device comprises: A database construction unit that constructs a statistical information database of tensors used by the neural network obtained by inputting a plurality of images as a plurality of test data sets into the neural network; A parameter generation unit, which quantizes the value of the tensor according to the statistical information database and the neural network, thereby generating a quantization parameter set; as well as A network construction unit quantizes the neural network using the quantization parameter set, thereby constructing a quantized network. The parameter generation unit quantizes the value of the tensor into two values ​​of -1 and +1 based on the statistical information database.