WO2019059191A1 - ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム - Google Patents

ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム Download PDF

Info

Publication number
WO2019059191A1
WO2019059191A1 PCT/JP2018/034522 JP2018034522W WO2019059191A1 WO 2019059191 A1 WO2019059191 A1 WO 2019059191A1 JP 2018034522 W JP2018034522 W JP 2018034522W WO 2019059191 A1 WO2019059191 A1 WO 2019059191A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
circuit
value
bias
input
Prior art date
Application number
PCT/JP2018/034522
Other languages
English (en)
French (fr)
Inventor
啓貴 中原
Original Assignee
国立大学法人東京工業大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 国立大学法人東京工業大学 filed Critical 国立大学法人東京工業大学
Priority to US16/648,319 priority Critical patent/US11741348B2/en
Priority to CN201880057412.5A priority patent/CN111095301A/zh
Publication of WO2019059191A1 publication Critical patent/WO2019059191A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions

Definitions

  • the present invention relates to a neural network circuit device, a neural network, a neural network processing method, and a program for executing a neural network.
  • FFNN forward propagation neural networks
  • RBF radial basis function
  • RBFN uses a radiation basis function as an activation function used for error back propagation.
  • CNN Convolutional Neural Network
  • ADAS advanced driver assistance system
  • Patent Document 1 discloses a processing apparatus including a processing unit that solves a problem using a weight value and an input signal learned between nodes of a loose coupling in a hierarchical neural network based on a check matrix of an error correction code. Is described.
  • the existing CNN is composed of a short precision (multi-bit) product-sum operation circuit, and a large number of multiplication circuits are required. For this reason, there existed a fault to which area and power consumption became large. Therefore, circuits have been proposed which constitute CNN using only binarized precision, ie, +1 and -1 (or 0 and 1) (see, for example, non-patent documents 1 to 4).
  • Non-Patent Documents 1 to 4 the accuracy of CNN recognition is lowered by reducing the accuracy to two values. In order to avoid this and maintain the accuracy of the binarized CNN, a batch normalization circuit is required.
  • the present invention has been made in view of such circumstances, and an object thereof is to provide a neural network circuit device, a neural network, a neural network processing method, and a program for executing a neural network, which do not require bias.
  • a neural network circuit device is a neural network circuit device including at least an input layer, one or more intermediate layers, and an output layer, wherein two of the intermediate layers
  • the logic circuit unit that receives the input value xi and the weight wi and performs logic operation, the summation circuit unit that sums the outputs of the logic circuit unit, the bias of the variation due to binarization, the normalization range is expanded, and the center
  • a batch normalization circuit unit that corrects the shift processing and an activation function circuit unit that converts the batch-normalized signal B of the summed signal Y with an activation function fsgn (B), and
  • the signal Y taken is represented by the following equation However, ⁇ : scaling factor ⁇ : shift value ⁇ ′ B : average value excluding bias.
  • a neural network circuit device a neural network, a neural network processing method, and an execution program of the neural network, which do not require bias.
  • DNN deep neural network
  • Y activation function fact
  • B activation function fsgn
  • FIG. 1 is a diagram for explaining an example of the structure of a deep neural network (DNN).
  • a deep neural network (DNN) 1 has an input layer 11, an arbitrary number of intermediate layers, a hidden layer 12, and an output layer 13. Is configured.
  • the input layer 11 has a plurality (here, eight) of input nodes (neurons).
  • the hidden layer 12 is plural (here, three layers (hidden layer 1, hidden layer 2, hidden layer 3)). In practice, the number n of hidden layers 12 reaches, for example, 20 to 100.
  • the output layer 13 has a number (here, four) of output nodes (neurons) to be identified.
  • the number of layers and the number of nodes (number of neurons) are an example.
  • all nodes of the input layer 11 and the hidden layer 12 are connected, and all nodes of the hidden layer 12 and the output layer 13 are connected.
  • an arbitrary number of nodes (see ⁇ in FIG. 1) exist.
  • This node is a function that receives an input and outputs a value.
  • a configuration is built by layering layers with multiple nodes. The propagation applies a weight to the received input, converts the received input to the next layer with an activation function, and outputs the result.
  • the activation function is a non-linear function such as a sigmoid function or a tanh function, or a ReLU (Rectified Linear Unit function).
  • the error back propagation method propagates an error from the output layer 13 and adjusts the weight of each layer.
  • a CNN suitable for image processing can be constructed. Further, by putting feedback into the deep neural network 1, it is possible to configure a RNN (Recurrent Neural Network) in which a signal propagates in both directions.
  • RNN Recurrent Neural Network
  • FIG. 2 is a diagram showing an example of the configuration of the neural network circuit of the comparative example.
  • the neural network circuit 20 of the comparative example can be applied to the neural network circuit 2 constituting the deep neural network 1 of FIG.
  • the neural network circuit 20 inputs an input node for inputting input values (determination data) X1 to Xn (multibit), an input unit 21 for inputting weights W1 to Wn (multibit), and a bias W0 (multibit).
  • Bias W0 input unit 22 a plurality of multiplication circuits 23 that receive input values X1 to Xn and weights W1 to Wn, and multiply the input values X1 to Xn by weights W1 to Wn, respectively, the sum of each multiplication value and bias W0
  • an activation function circuit 25 for converting the summed signal Y with an activation function fact (Y).
  • the neural network circuit 20 receives the input values X1 to Xn (multi-bit), multiplies them by the weights W1 to Wn, and then adds the signal W including the bias W0 to the activation function circuit 25. By passing through, processing that imitates human neurons is realized.
  • FIG. 3 is a diagram showing the activation function fact (Y) in the neural network circuit 20 shown in FIG.
  • the abscissa represents the signal Y obtained by summing, and the ordinate represents the value of the activation function fact (Y).
  • the symbol 3 in FIG. 3 is a positive activation value (state value) in the range of ⁇ 1, and the symbol ⁇ in FIG. 3 is the negative activation value in the range of ⁇ 1. is there.
  • the neural network circuit 20 (see FIG. 2) realizes high recognition accuracy with multiple bits. Therefore, in the activation function circuit 25 (see FIG. 2), a non-linear activation function fact (Y) can be used. That is, as shown in FIG.
  • the non-linear activation function fact (Y) sets an activation value taking a value in the range of ⁇ 1 in the portion where the slope is non-zero (see the dashed box in FIG. 4). it can. Therefore, the neural network circuit 20 can realize various activities, and the recognition accuracy has become a practical value.
  • the neural network circuit 20 requires a large amount of multiplication circuits 23.
  • the neural network circuit 20 requires a large amount of memory due to the multi-bit input / output and weight, and the read / write speed (memory capacity / band) is also a problem.
  • the neural network circuit 20 of the comparative example shown in FIG. 2 is configured of a product-sum operation circuit with short precision (multiple bits). For this reason, a large number of multiplication circuits 21 are required, resulting in a large area and power consumption. In addition, a large amount of memory is required because the input / output and weight are many bits, and the speed of reading and writing (memory capacity and bandwidth) has been a problem. Therefore, a circuit has been proposed in which the neural network circuit 2 (see FIG. 1) is configured using only binarized precision, ie, +1 and -1 (non-patent documents 1 to 4). Specifically, it is conceivable to replace the multiplication circuit 21 of the neural network circuit 20 shown in FIG. 2 with a logic gate (for example, an XNOR gate circuit).
  • a logic gate for example, an XNOR gate circuit
  • FIG. 4 is a diagram showing an example of a configuration of a binarization neural network circuit in which the multiplication circuit 21 of the neural network circuit 20 shown in FIG. 2 of the comparative example is replaced with an XNOR gate circuit.
  • the binarization neural network circuit 30 of the comparative example can be applied to the neural network circuit 2 of FIG. As shown in FIG.
  • the binarization neural network circuit 30 of the comparative example has an input node for inputting the input values x1 to xn (binary) and an input unit 31 for inputting the weights w1 to wn (binary);
  • a bias w0 input unit 32 for inputting a bias w0 (binary), a plurality of XNOR gate circuits 33 for receiving input values x1 to xn and weights w1 to wn, and performing XNOR (Exclusive NOR: negative exclusive OR) logic
  • a summing circuit 34 for summing the XOR logic value of each XNOR gate circuit 33 and the bias w0, and an activation function for converting the batch normalized signal B of the summed signal Y with the activation function fsgn (B)
  • a circuit 35 for summing the XOR logic value of each XNOR gate circuit 33 and the bias w0, and an activation function for converting the batch normalized signal B of the summed signal Y with
  • the multiplication circuit 23 (see FIG. 2) is replaced by an XNOR gate circuit 33 that implements XNOR logic. For this reason, it is possible to reduce the area required when configuring the multiplication circuit 23. Further, since all of the input values x1 to xn, the output values z, and the weights w1 to wn are binary (-1 and +1), the amount of memory can be significantly reduced as compared to the case of multiple values, Memory bandwidth can be improved.
  • FIG. 5 is a diagram showing an activation function fsgn (B) in the binarization neural network circuit 30 shown in FIG. 4 of the comparative example.
  • the abscissa represents the signal Y obtained by summing, and the ordinate represents the value of the activation function fsgn (B).
  • the symbol 5 in FIG. 5 is a positive activation value having a value in the range of ⁇ 1
  • the symbol ⁇ in FIG. 5 is a negative activation value having a value in the range of ⁇ 1.
  • the binarization neural network circuit 30 simply binarizes the input values x1 to xn and the weights w1 to wn. For this reason, as shown in the symbol a of FIG.
  • Non-Patent Documents 1 to 4 describe techniques for performing batch normalization to maintain the accuracy of the existing binarization neural network.
  • FIG. 6 is a diagram showing an example of the configuration of a binarization neural network circuit 40 provided with a batch normalization circuit (BN: Batch Normalization) that corrects the binarized accuracy of the comparative example and maintains the recognition accuracy of CNN. is there.
  • BN Batch Normalization
  • the binarization neural network circuit 40 of the comparative example has input nodes x1 to xn for inputting input values x1 to xn (binary) and an input unit for inputting weights w1 to wn (binary). 31.
  • a plurality of XNOR gates which receive bias B (multi-bit) input bias B input section 32 and input values x1 to xn and weights w1 to wn and take XNOR (Exclusive NOR: negative exclusive OR) logic
  • a circuit 33 a summing circuit 34 for summing the sum of each XNOR logic value of the XNOR gate circuit 33 and the bias B, and batch normalization for correcting deviation bias of variation due to binarization by processing for widening the normalization range and shifting the center
  • the circuit 41 is configured to include an activation function circuit 35 that converts the batch-normalized signal B of the summed signal Y with the activation function fsgn (B).
  • the batch normalization circuit 41 calculates a difference between the weight-sum signal Y and the average value ( ⁇ B ), a subtractor 42, and outputs of the subtractor 42 and minibatch dispersion values ( ⁇ 2 B ) and constants ( ⁇ ) ,
  • the second multiplication circuit 44 that performs normalization with the scaling ( ⁇ ) value (multi-bit) on the output of the first multiplication circuit 43, and the scaling factor ( ⁇ ) And the adder 45 for performing two classifications by shifting according to the shift value ( ⁇ ) (multi-bit).
  • the parameters of the scaling factor ( ⁇ ) and the shift value ( ⁇ ) are obtained in advance during learning.
  • weights are updated for each learning data, computation time is required and it depends on specific data. Therefore, a method is employed in which updating is performed in units of batch data.
  • a mini-batch is a unit that further reduces the batch, and this mini-batch is currently used.
  • the binarization neural network circuit 40 includes the batch normalization circuit 41 to correct the binarized accuracy and maintain the CNN recognition accuracy.
  • the logic circuit is not limited to the XNOR gate but may be any logic gate as long as it is a logic circuit that takes the XNOR logic between the input values x1 to xn and the weights w1 to wn. For example, the sum may be calculated using an XOR circuit, and the negation of the activation function may be taken.
  • FIG. 7 and 8 are diagrams for explaining the effect of batch normalization of the binarization neural network circuit 40 of the comparative example.
  • FIG. 7 is a diagram showing normalization with the scaling factor ( ⁇ ) of the comparative example
  • FIG. 8 is a diagram showing restrictions of ⁇ 1 to +1 with the shift value ( ⁇ ) of the comparative example.
  • Batch normalization is a circuit that corrects the bias of variation due to binarization, and after weighting summation, normalization with scaling factor ( ⁇ ) is performed, then 2 classifications by appropriate activation with shift value ( ⁇ ) I do. These parameters are obtained in advance during learning. Specifically, it is as follows.
  • the multiplication circuit 42 (see FIG. 6) of the batch normalization circuit 41 has the width (“the result”) Y after the summation of weights by the scaling factor ( ⁇ ). 2 ”(see shaded portion in FIG. 7).
  • the width in FIG. 5 (refer to the shaded portion in FIG. 5)
  • the non-uniform width is suppressed by normalizing the width to “2” by the scaling factor ( ⁇ ).
  • the adder 45 (see FIG. 6) of the batch normalization circuit 41 shifts the normalized value by the scaling factor ( ⁇ ) to the shift value ( It is limited by ⁇ ) to be in the range of -1 to +1. That is, as can be seen by comparison with the width in FIG. 5 (see the shaded portion in FIG. 5), when the width in FIG. 5 (see the shaded portion in FIG. 5) The center of this width is set to 0 by limiting the value after normalization by the scaling factor ( ⁇ ) to ⁇ 1 to +1 according to the shift value ( ⁇ ). In the example of FIG. 5, the activation value on the negative side (see the symbol x in the dashed box in FIG. 5) is returned to the negative side that should have been. This reduces the occurrence of errors and can improve recognition accuracy. Thus, the batch normalization circuit 41 is necessary for the binarization neural network circuit 40 of the comparative example.
  • the bias needs to be many bits. Further, the bias value changes every moment according to the learning data and the learning period. If there is no bias, it will not withstand practical use. For example, in the example of FIG. 10 described later, it is assumed that the Classification Error is about 90%. The direct issue of having a bias is that a circuit with high accuracy is needed. Such high precision circuits have a large area and power consumption.
  • the point of view of the present invention is to discover that it is possible to obtain an NN which does not require a bias term by analytically determining an NN equivalent to the NN to which a batch normalization operation has been introduced. That is, assuming that the signal input to the batch normalization circuit 41 (see FIG. 6) of the binarization neural network circuit 40 after weighting product addition is Y, the signal output from the batch normalization circuit 41 (equivalent to Y The signal) Y ′ (intermediate value) is expressed by the following equation (1).
  • scaling factor
  • ⁇ B average value of minibatch
  • B dispersion value of minibatch
  • constant (constant for avoiding division by 0)
  • the scaling factor ( ⁇ ), shift value ( ⁇ ), minibatch average value ( ⁇ B ), minibatch dispersion value ( ⁇ 2 B ), and constant ( ⁇ ) are obtained by batch normalization at the time of learning It is a value.
  • the output through the activation function of the binarization neural network circuit 40 is +1 or -1 (0 or 1 depending on the signal assignment). Further, even if the intermediate signal of the binarization neural network circuit 40 is converted by the coefficient ⁇ // ( ⁇ 2 B + ⁇ ) -1 of the above equation (1), the value passing through the activation function does not change. it can. Therefore, the above equation (1) becomes the following equation (2).
  • the value of the binarization activation function is +1 or -1 (0 or 1 depending on the assignment of the signal) whether the intermediate value Y 'is positive or negative. Therefore, the value f'sgn (Y) of the binarization activation function is determined by the condition of the following equation (3).
  • ⁇ ′ B is an average value excluding bias.
  • the above equation (6) means the following. That is, the above equation (6) indicates that a binary neural network can be correctly realized by learning using a neural network from which a bias is removed and batch normalization. At this time, it can be said that the circuit configuration for realizing the above equation (6) learns ⁇ ′ B , that is, learns a value obtained by subtracting the average value of the minibatch and the bias value which has been conventionally learned.
  • FIG. 9 is a view showing a configuration of a binarization neural network circuit of a neural network according to an embodiment of the present invention.
  • the same components as in FIG. 6 of the comparative example are assigned the same reference numerals.
  • the binarization neural network circuit of this embodiment provides an implementation technique for a deep neural network.
  • the binarization neural network circuit 100 can be applied to the neural network circuit 2 of FIG.
  • the binarization neural network circuit 100 (neural network circuit device) is a binarization neural network circuit which does not require a bias. As shown in FIG.
  • the binary neural network circuit 100 has an input node for inputting input values x1 to xn (xi) (binary) and an input unit for inputting weights w1 to wn (wi) (binary).
  • 101 an XNOR gate circuit 102 (logic circuit unit) that receives input values x1 to xn and weights w1 to wn and performs XNOR logic, a summing circuit 103 (summation circuit unit) that sums each XNOR logic value, 2 Batch normalization circuit 41 which corrects the bias of variation due to digitization by processing to widen the normalization range and shift the center, and convert batch-normalized signal B of signal Y obtained by summing up by activation function fsgn (B) And an activation function circuit 35.
  • the binarization neural network circuit 100 is a binarized CNN which eliminates the need for the bias term represented by the equation (6).
  • a binarization neural network circuit 100 is applied to the hidden layer 12 (see FIG. 1) of the deep neural network 1.
  • the deep neural network 1 evaluates the learning values for the input values.
  • the weights are all different for each recognition object of the client.
  • it may be different every time by learning.
  • the coefficients are all the same in image processing, and in this respect, HW differs greatly between NN and image processing.
  • the XNOR gate circuit 102 may be any logic circuit part including exclusive OR. That is, as long as it is a logic circuit that takes the logic between the input values x1 to xn and the weights w1 to wn, any gate circuit may be used instead of the XNOR gate. For example, it may be anything that is logically equivalent, such as combining an XOR gate with a NOT gate, combining an AND and OR gates, and fabricating using a transistor switch.
  • the binarization neural network circuit 100 is a binarization neural network circuit that does not require a bias, and the bias b input unit 32 required in the binarization neural network circuit 40 (see FIG. 6) of the comparative example is eliminated. ing. Therefore, the summing circuit 103 takes only the sum of each XNOR logic value. That is, the summing circuit 103 does not take the sum of each XNOR logic value and the bias b, as in the binarization neural network circuit 40 (see FIG. 6) summing circuit 35 of the comparative example.
  • the batch normalization circuit 41 calculates a difference between the weight-sum signal Y and the average value ( ⁇ B ), a subtractor 42, and outputs of the subtractor 42 and minibatch dispersion values ( ⁇ 2 B ) and constants ( ⁇ ) , And a second multiplication circuit 44 which performs normalization with a scaling ( ⁇ ) value (multi-bit) to the output of the first multiplication circuit 43, and normalization with a scaling factor ( ⁇ ), And an adder 45 which performs two classifications by shifting according to a shift value ( ⁇ ) (multi-bit).
  • the activation circuit 35 is a circuit that simulates an activation function circuit that outputs only the sign bit to the signal Y obtained by summing.
  • the sign bit is a binary signal indicating whether or not to activate the multi-bit signal Y obtained by summing.
  • the summing circuit 103 takes only the sum of each XNOR logic value as shown in the equation (6). For this reason, the binarization neural network circuit 100 is a neural network circuit which does not require a bias.
  • the binarization neural network circuit 100 is used for the neural network circuit 2 of the deep neural network 1 shown in FIG.
  • the input nodes x1 to xn of the binarized neural network circuit 100 are input nodes of the hidden layer 1 of the deep neural network 1 shown in FIG.
  • Input values x1 to xn (binary values) and weights w1 to wn (binary values) of the input node of the hidden layer 1 of the hidden layer 12 are input to the input unit 101.
  • the XNOR gate circuit 102 which is an alternative to multiplication, receives the input values x1 to xn and the weights w1 to wn, and performs binary (-1 / + 1) multiplication by the XNOR logic. After passing through the XNOR gate circuit 102, the summing circuit 103 sums each XNOR logic value. The batch normalization circuit 41 then batch normalizes the summed signal Y. The activation function circuit 35 converts the batch-normalized signal B of the summed signal Y with the activation function fsgn (B).
  • the multiplication circuit 21 (see FIG. 2) of the multi-bit configuration of the comparative example is replaced with an XNOR gate circuit 102 that implements XNOR logic. For this reason, it is possible to reduce the area required when configuring the multiplication circuit 21. Further, since all of the input values x1 to xn and the weights w1 to wn are binary (-1 / + 1), the memory capacity can be significantly reduced as compared with the case of multi-bit (multi-level), and the memory The bandwidth can be improved.
  • FIG. 10A shows the recognition accuracy of the neural network circuit 30 (see FIG. 4) configured with “no batch normalization” (with a bias term)
  • FIG. 10B is binarized with “batch normalization” (with a bias term)
  • the recognition accuracy of the neural network circuit 40 see FIG. 6
  • FIG. 10C shows the recognition accuracy of the binary neural network circuit 100 (see FIG.
  • FIG. 10C shows the present embodiment implemented and confirmed by the VGG 11 benchmark NN.
  • the horizontal axis of FIGS. 10A to 10C is the number of epochs (the number of times of learning), which is a cycle in which updating of the used learning data is completed (the number of learning times), and the vertical axis is a classification error.
  • FIGS. 10A-C use the float32 precision CNN of framework software Chainer® for deep neural networks.
  • the misrecognition rate drops as the learning continues, and the misrecognition rate decreases with an epoch number of 400 or more (approximately 20%) indicates that learning is successful. As described above, learning is not successful without the batch normalization circuit 41. In the binarization neural network circuit 30, it was reconfirmed that the batch normalization circuit 41 is required.
  • FIG. 11 is a table showing the results of mounting the binary neural network circuit 100 of this embodiment on an FPGA (Digilent's NetFPGA-1G-CML) and comparing it with the existing multi-bit mounting method. It is.
  • the table of FIG. 11 shows the neural network of the meeting presenter (year of the paper presentation) of [Zhao et al.] To [FINN] described in the lower part of the table and the neural network of this embodiment on FPGA (Digilent's ZedBoard) When realized, each item is shown in contrast.
  • the terms in the table of FIG. 11 are as follows. Implementation is the name of the method or research group implemented. (Year) is the year in which the relevant literature was published.
  • the FPGA Board is a name of a board on which an FPGA (field-programmable gate array) is mounted.
  • FPGA field-programmable gate array
  • (FPGA) is a model number of the FPGA mounted on the FPGA mounting board, and uses the same FPGA in order to make the comparison condition uniform.
  • Clock [MHz] is the operating frequency of the FPGA. The higher the operating frequency, the faster the operation.
  • #LUTs are LUT (Look-Up Table) consumption amounts of FPGA, and mean area.
  • # 18 Kb BRAMs is the consumption of internal memory blocks of the FPGA, and means area.
  • #DSP Blocks is the consumption of the internal product-sum operation block of the FPGA, which means area.
  • Test Error is an error rate of a test image and means recognition accuracy.
  • Time [msec] is the recognition time (in milliseconds).
  • FPS is an abbreviation of Frames Per Second, which is the number of images that can be recognized per unit time. The larger the value of (FPS), the faster it is.
  • Power [W] is power consumption (unit: watt).
  • FPS / Watt is power consumption efficiency.
  • FPS / LUT is area efficiency.
  • FPS / BRAM is memory efficient.
  • the binarized neural network circuit 100 is characterized in that the power is balanced as compared with the conventional example of the table.
  • the power consumption is as large as 4.7 W and 2.5 W. Because the power consumption is large, the control method to avoid this is complicated.
  • the power consumption can be reduced to about 2.3 W, which is about 1/2, as compared with the conventional example [Zhao et al.].
  • the binarized neural network circuit 100 of the present embodiment is a performance power efficiency obtained by seeing only the power efficiency without looking at the area But it is about 5 times with 35.7 and 182.6. Furthermore, the data transfer rate is also tripled with 168 and 120.
  • FIG. 12 is a view for explaining an implementation example of the binarization neural network circuit according to the embodiment of the present invention.
  • a computer 201 having a GPU (Graphics Processing Unit) using Chainer (registered trademark), a framework software for an existing deep neural network, given data set (in this case, ImageNet, data for image recognition task) I learned above. The learning is performed on the GPU.
  • the computer 201 has a central processing unit (CPU) such as an ARM processor, a memory, a storage unit (storage unit) such as a hard disk, and an I / O port including a network interface.
  • the CPU 201 operates a control unit (control means) configured by processing units described later by executing a program (an execution program of a binarized neural network) read into the memory.
  • a C ++ code 202 was obtained by automatically generating C ++ code equivalent to the binarized neural network circuit 100 of the present embodiment using an automatic generation tool.
  • HDL hardware description language
  • FPGA field-programmable gate array
  • SDinc high-level synthesis tool
  • Verilog HDL / VHDL hardware description language
  • the substrate 205 was completed.
  • the binarization neural network circuit 100 is implemented in hardware.
  • the steps of inputting the input values x1 to xn (xi) and the weights w1 to wn (wi), receiving the input values x1 to xn and the weights w1 to wn, and performing XNOR logic As shown in equation (6), the step of taking only the sum of each XNOR logic value, the step of performing batch normalization, and the activation function fsgn (B of batch normalized signal B obtained by summing the signal Y) And converting.
  • the binarized neural network circuit 100 can reduce power consumption (Power [W]) by half, and the area can be reduced to about one half (FPS / Watt). , The synergy of FPS / LUT and FPS / BRAM.
  • the binarization neural network circuit 100 of this embodiment has no difference in recognition accuracy.
  • FIG. 13 is a diagram comparing the amount of hardware of each FPGA implementation.
  • the amount of hardware required for fixed-point precision, binarization, and this embodiment was calculated using a Xilinx FPGA. Specifically, I implemented the TensorFlow tutorial CNN. Also, it was mounted on Digilent's NetFPGA-1G-CML board.
  • the comparison of each FPGA implementation is the present embodiment (binarization (batch normalization + no bias)), the fixed point (16 bits) of the comparative example, and the binarization (bias only) of the comparative example.
  • the amount of hardware implemented on an FPGA is indicated by the number of flip-flops (FF), the number of LUTs, the number of 18 Kb BRAMs, and the number of digital signal processors (DSPs) 48E.
  • FF flip-flops
  • DSPs digital signal processors
  • this embodiment (binarization (batch normalization + no bias)) and binarization (bias only) are the number of FFs, the number of LUTs, the number of 18 Kb BRAMs, and the fixed-point precision. It has been confirmed that the amount of hardware for both and the number of DSPs 48E is reduced. Further, according to the present embodiment (binarization (batch normalization + no bias)), the amount of hardware (area) is increased by about 1 to 2% with respect to binarization (only bias). I understand.
  • the power consumption can be reduced by half and the area can be reduced by about 30 times (see FIG. 11) as compared to the existing binarized neural network circuit having biases (see FIG. 11).
  • the recognition accuracy can constitute a nearly equivalent CNN.
  • Practical application is expected as an edge embedded device hardware method for ADAS (Advanced Driver Assistance System) camera image recognition using deep learning.
  • ADAS Advanced Driver Assistance System
  • high reliability and low heat generation are required to be mounted in a car.
  • the binarized neural network circuit 100 according to the present embodiment requires no external memory since power consumption (Power [W]) is significantly reduced. Also, cooling fans and cooling fins for cooling the memory are unnecessary. It is suitable to be mounted on an ADAS camera.
  • FIG. 14 is a diagram showing the configuration of a binarization neural network circuit of the deep neural network of the first modification.
  • the same reference numerals as in FIG. 9 denote the same parts as in FIG.
  • the binary neural network circuit 100A of the modification 1 can be applied to the neural network circuit 2 of FIG.
  • the binarization neural network circuit 100A (neural network circuit device) is a binarization neural network circuit which does not require a bias.
  • the binarization neural network circuit 100A is configured to further include a bias memory 110 (storage unit, bias value input unit) for storing a bias value in addition to the binarization neural network circuit 100 of FIG. Be done.
  • a bias memory 110 storage unit, bias value input unit
  • the binarization neural network circuit 100A reads out the bias value stored in the bias memory 110 and outputs it to the summing circuit 103.
  • the binarization neural network circuit 100A has a configuration in which a bias value is input to the summing circuit 103 as in the case of the binarization neural network circuit 40 (see FIG. 6) using a bias.
  • the summing circuit 35 takes the sum of each XNOR logic value of the XNOR gate circuit 34 and the bias value, and the binarization neural network circuit 100A uses a bias to the binarization neural network circuit 40 (see FIG. 6).
  • the binarization neural network circuit 100A writes 0 in the summing circuit 103 to execute the circuit of the equation (6).
  • the neural network processing method of the circuit 100A can be realized.
  • the binarization neural network circuit 100A is a binarized CNN which does not require a bias.
  • the binarization neural network circuit 100A can be replaced with the existing binarization neural network circuit 40 (see FIG. 6) using a bias (generally applied) It is possible.
  • the present invention is applied without changing the design or verification of the memory or read / write control unit connected to the existing binary neural network circuit 40 itself using bias and the existing binary neural network circuit 40 using bias it can.
  • the resources accumulated by the existing binarization neural network circuit 40 can be utilized.
  • FIG. 15 is a diagram showing a configuration of a binarization neural network circuit of the deep neural network of the second modification.
  • the same reference numerals as in FIG. 9 denote the same parts as in FIG.
  • the binarization neural network circuit 100B of the modification 2 can be applied to the neural network circuit 2 of FIG.
  • the binarization neural network circuit 100B (neural network circuit device) is a binarization neural network circuit which does not require a bias.
  • the binarization neural network circuit 100B further includes a bias value input unit 120 for inputting a bias value B to the binarization neural network circuit 100 of FIG. And a switch 121 for turning on and off the input of
  • the binarization neural network circuit 100 B reads out the bias value stored in the bias memory 110 and outputs it to the summing circuit 103.
  • the bias value B is input to the summing circuit 103, as in the binarization neural network circuit 40 (see FIG. 6) using a bias.
  • the summing circuit 35 takes the sum of each XNOR logic value of the XNOR gate circuit 34 and the bias value B, and the binarization neural network circuit 100B uses the bias as a binarization neural network circuit 40 (see FIG. 6). Can be realized.
  • the binarization neural network circuit 100B turns off the switch 121 to turn off the input of the bias value B to the summing circuit 103, and executes the circuit of the equation (6).
  • the binarization neural network circuit 100 B can be replaced (used) with the existing binarization neural network circuit 40 (see FIG. 6) using a bias.
  • the same effect as in the case can be obtained.
  • the second modification is simpler in configuration than the binary neural network circuit 100A of the first modification, and can be applied more generally.
  • a LUT (Look-Up Table) may be used instead of the logic gate as the multiplication circuit.
  • This LUT uses a look-up table, which is a basic component of FPGA, in place of the XNOR gate circuit 102 (see FIG. 9) which performs XNOR logic.
  • the LUT stores a binary (-1 / + 1) XNOR logic result Y for two inputs (x1, w1).
  • the LUT is a basic component of the FPGA, has high affinity in FPGA synthesis, and is easy to implement by the FPGA.
  • each component of each device illustrated is functionally conceptual, and does not necessarily have to be physically configured as illustrated. That is, the specific form of the distribution and integration of each device is not limited to the illustrated one, and all or a part thereof may be functionally or physically dispersed in any unit depending on various loads, usage conditions, etc. It can be integrated and configured.
  • each of the configurations, functions, processing units, processing means, etc. described above may be realized by hardware, for example, by designing part or all of them with an integrated circuit.
  • each configuration, function, etc. described above may be realized by software for a processor to interpret and execute a program that realizes each function.
  • Information such as programs, tables, and files for realizing each function is a memory, a hard disk, a recording device such as a solid state drive (SSD), or an integrated circuit (IC) card, a secure digital (SD) card, an optical disc It can be held on a recording medium.
  • SSD solid state drive
  • IC integrated circuit
  • SD secure digital
  • the device used the name neural network circuit device, but this is for convenience of explanation, and the name may be a deep neural network circuit, a neural network device, a perceptron or the like.
  • the name called a neural network processing method was used for a method and a program, a neural network arithmetic method, a neural network program, etc. may be sufficient.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Neurology (AREA)
  • Image Analysis (AREA)
  • Character Discrimination (AREA)

Abstract

バイアスが不要なニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラムを提供する。2値化ニューラルネットワーク回路(100)は、入力値x1~xn(xi)(2値)を入力する入力ノードおよび重みw1~wn(wi)(2値)を入力する入力部(101)と、入力値x1~xnおよび重みw1~wnを受け取り、XNOR論理を取るXNORゲート回路(102)と、各XNOR論理値の総和を取る総和回路(103)と、2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路(41)と、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路(35)と、を備える。

Description

ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム
 本発明は、ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラムに関する。
 古典的な順伝搬型ニューラルネットワーク(FFNN:Feedforward Neural Network)、RBF(Radial Basis Function)ネットワーク、正規化したRBFネットワーク、自己組織化マップなどがある。RBFNは、誤差逆伝搬法に用いる活性化関数に放射基底関数を用いる。しかし、中間層が多く取れず高精度認識判定が難しかったり、HW規模が大きく処理時間がかかる、などの問題があり手書き文字認識など応用分野が限定されていた。
 近年、ADAS(advanced driver assistance system)用の画像認識や自動翻訳などで注目を集める新方式として畳み込みニューラルネットワーク(CNN:Convolutional Neural Network)(層間が全結合でないNN)や再帰型ニューラルネットワーク(双方向伝搬)が登場している。CNNは、ディープニューラルネットワーク(DNN:Deep Neural Network)に畳込み演算を付加したものである。
 特許文献1には、誤り訂正符号の検査行列に基づいて、階層型ニューラルネットワークにおける疎結合のノード間で学習された重みの値と入力信号とを用いて、問題を解く処理部を備える処理装置が記載されている。
 既存のCNNは、短精度(多ビット)による積和演算回路で構成されており、多数の乗算回路が必要である。このため、面積・消費電力が多大になる欠点があった。そこで、2値化した精度、すなわち+1と-1(または0と1)のみ用いてCNNを構成する回路が提案されている(例えば、非特許文献1~4参照)。
 非特許文献1~4の技術では、精度を2値に落とすことでCNNの認識精度も落としてしまう。これを避けて2値化CNNの精度を維持するためには、バッチ正規化回路が必要である。
特開2016-173843号公報
M. Courbariaux, I. Hubara, D. Soudry, R.E.Yaniv, Y. Bengio, "Binarized neural networks: Training deep neural networks with weights and activations constrained to +1 or -1," Computer Research Repository (CoRR)、「2値化NNのアルゴリズム」、[online]、2016年3月、[平成28年10月5日検索]、<URL:http:// arxiv.org/pdf/1602.02830v3.pdf > Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, Ali Farhadi, "XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks,"Computer Vision and Pattern recognition、「2値化NNのアルゴリズム」、[online]、2016年3月、[平成28年10月5日検索]、<URL: https://arxiv.org/pdf/1603.05279v4 > Hiroki Nakahara, Haruyoshi Yonekawa, Tsutomu Sasao, Hisashi Iwamoto and Masato Motomura, " A Memory-Based Realization of a Binarized Deep Convolutional Neural Network," Proc. of the 2016 International Conference on Field-Programmable Technology (FPT), Xi'an, China, Dec 2016 (To Appear). Eriko Nurvitadhi, David Sheffield, Jaewoong Sim, Asit Mishra, Ganesh Venkatesh, Debbie Marr,"Accelerating Binarized Neural Networks: Comparison of FPGA, CPU, GPU, and ASIC," Proc. of the 2016 International Conference on Field-Programmable Technology (FPT), Xi'an, China, Dec 2016 (To Appear).
 CNNでは、学習を進めると重みが均等に分布する。しかし、学習データには偏りが存在するため、完全には均等に分布せず、その調整のためにバイアスによる補正が必要であった。学習データにもよるが、バイアスの精度は固定小数点精度で30~40ビットになり、浮動小数点精度を使ったとしても、加算器などの回路が必要であった。バイアスがあることで、面積・消費電力が増大するという課題があった。
 本発明は、このような事情に鑑みてなされたものであり、バイアスが不要なニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラムを提供することを課題とする。
 前記した課題を解決するため、本発明に係るニューラルネットワーク回路装置は、入力層、1以上の中間層、および、出力層を少なくとも含むニューラルネットワーク回路装置であって、前記中間層の中で、2値の入力値xiおよび重みwiを受け取り、論理演算を行う論理回路部と、前記論理回路部の出力の総和を取る総和回路部と、2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路部と、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路部と、を備え、前記総和を取った信号Yは、下記式で示される
Figure JPOXMLDOC01-appb-M000009
 ただし、
 γ:スケーリング係数
 β:シフト値
 μ’:バイアスを除く平均値。入力値x0のときのバイアス値w0とし、ミニバッチの平均値μとするとき、w0-μ
 σ :ミニバッチの分散値
 ε:定数
 ことを特徴とする。
 その他の手段については、発明を実施するための形態のなかで説明する。
 本発明によれば、バイアスが不要なニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラムを提供することができる。
ディープニューラルネットワーク(DNN)の構造の一例を説明する図である。 比較例のニューラルネットワークのニューラルネットワーク回路の構成の一例を示す図である。 図2に示すニューラルネットワーク回路における活性化関数fact(Y)を示す図である。 図2に示すニューラルネットワーク回路の乗算回路をXNORゲート回路に置き換えた2値化ニューラルネットワーク回路の構成の一例を示す図である。 図4に示す2値化ニューラルネットワーク回路における活性化関数fsgn(B)を示す図である。 比較例のバッチ正規化回路を備える2値化ニューラルネットワーク回路の構成の一例を示す図である。 ニューラルネットワークの2値化ニューラルネットワーク回路のスケーリング(γ)による正規化を示す図である。 ニューラルネットワークの2値化ニューラルネットワーク回路のシフト(β)による-1~+1の制限を示す図である。 本発明の実施形態に係るディープニューラルネットワークの2値化ニューラルネットワーク回路の構成を示す図である。 本発明の実施形態に係るディープニューラルネットワークの「バッチ正規化なし」の認識精度を説明する図である。 本発明の実施形態に係るディープニューラルネットワークの「バッチ正規化あり」(バイアス項あり)の認識精度を説明する図である。 本発明の実施形態に係るディープニューラルネットワークの「バッチ正規化あり」(バイアス項なし)の認識精度を説明する図である。 本発明の実施形態に係るディープニューラルネットワークの2値化ニューラルネットワーク回路と既存の2値化ニューラルネットワーク回路との比較を行った結果を表にして示す図である。 本発明の実施形態に係るディープニューラルネットワークの2値化ニューラルネットワーク回路の実装例を説明する図である。 各FPGA実装のハードウェアの量を比較して示す図である。 変形例1のディープニューラルネットワークの2値化ニューラルネットワーク回路の構成を示す図である。 変形例2のディープニューラルネットワークの2値化ニューラルネットワーク回路の構成を示す図である。
 以下、図面を参照して本発明を実施するための形態(以下、「本実施形態」という)におけるディープニューラルネットワークについて説明する。
(背景説明)
 図1は、ディープニューラルネットワーク(DNN)の構造の一例を説明する図である。
 図1に示すように、ディープニューラルネットワーク(DNN)1は、入力層(input layer)11、任意の数の中間層である隠れ層(hidden layer)12、出力層(output layer)13を有して構成される。
 入力層(input layer)11は、複数個(ここでは8)の入力ノード(ニューロン)を有する。隠れ層12は、複数(ここでは3層(hidden layer1,hidden layer2,hidden layer3))である。実際には、隠れ層12の層数nは、例えば20~100に達する。出力層13は、識別対象の数(ここでは4)の出力ノード(ニューロン)を有する。なお、層数およびノード数(ニューロン数)は、一例である。
 ディープニューラルネットワーク1は、入力層11と隠れ層12のノード間が全て結合し、隠れ層12と出力層13のノード間が全て結合している。
 入力層11、隠れ層12および出力層13には、任意の数のノード(図1の○印参照)が存在する。このノードは、入力を受け取り、値を出力する関数である。入力層11には、入力ノードとは別に独立した値を入れるバイアス(bias)ノードがある。構成は、複数のノードを持つ層を重ねることで構築される。伝播は、受け取った入力に対して重み(weight)をかけ、受け取った入力を次層に活性化関数(activation function)で変換して出力する。活性化関数は、sigmoid関数やtanh関数などの非線形関数、ReLU(Rectified Linear Unit function:正規化線形関数)がある。ノード数を増やすことで、扱う変数を増やし、多数の要素を加味して値/境界を決定できる。層数を増やすことで、直線境界の組み合わせ、複雑な境界を表現できる。学習は、誤差を計算し、それを基に各層の重みを調整する。学習は、誤差を最小化する最適化問題を解くことであり、最適化問題の解法は誤差逆伝播法(Backpropagation)を使うのが一般的である。誤差は、二乗和誤差を使うのが一般的である。汎化能力を高めるために、誤差に正則化項を加算する。誤差逆伝播法は、誤差を出力層13から伝播させていき、各層の重みを調整する。
 図1のディープニューラルネットワーク1の構成を2次元に展開することで画像処理に適したCNNを構築できる。また、ディープニューラルネットワーク1にフィードバックを入れることで、双方向に信号が伝播するRNN(Recurrent Neural Network:再帰型ニューラルネットワーク)を構成することができる。
 図1の太破線三角部に示すように、ディープニューラルネットワーク1は、多層のニューラルネットワークを実現する回路(以下、ニューラルネットワーク回路という)2から構成されている。
 本技術は、ニューラルネットワーク回路2を対象とする。ニューラルネットワーク回路2の適用箇所および適用数は限定されない。例えば、隠れ層12の層数n:20~30の場合、これらの層のどの位置に適用してもよく、またどのノードを入出力ノードとするものでもよい。さらに、ディープニューラルネットワーク1に限らず、どのようなニューラルネットワークでもよい。ただし、入力層11または出力層13のノード出力には、2値化出力ではなく多ビット出力が求められるので、ニューラルネットワーク回路2は、対象外である。ただし、出力層13のノードを構成する回路に、乗算回路が残ったとしても面積的には問題にはならない。
 なお、入力データに対し学習済のものを評価していくことを前提としている。したがって、学習結果として重みwiは既に得られている。
 <ニューラルネットワーク回路>
 図2は、比較例のニューラルネットワーク回路の構成の一例を示す図である。
 比較例のニューラルネットワーク回路20は、図1のディープニューラルネットワーク1を構成するニューラルネットワーク回路2に適用できる。なお、以下の各図の表記において、値が多ビットである場合は太実線矢印とバンドルで、また値が2値である場合は細太実線矢印で示す。
 ニューラルネットワーク回路20は、入力値(判別データ)X1~Xn(多ビット)を入力する入力ノードおよび重みW1~Wn(多ビット)を入力する入力部21と、バイアスW0(多ビット)を入力するバイアスW0入力部22と、入力値X1~Xnおよび重みW1~Wnを受け取り、入力値X1~Xnに重みW1~Wnをそれぞれ乗算する複数の乗算回路23と、各乗算値とバイアスW0との総和を取る総和回路24と、総和を取った信号Yを活性化関数fact(Y)で変換する活性化関数回路25と、を備えて構成される。
 以上の構成において、ニューラルネットワーク回路20は、入力値X1~Xn(多ビット)を受け取り、重みW1~Wnを乗算した後に、バイアスW0を含めて総和を取った信号Yを活性化関数回路25を通すことで人間のニューロンに模した処理を実現している。
 図3は、前記図2に示すニューラルネットワーク回路20における活性化関数fact(Y)を示す図である。図3は、横軸に総和を取った信号Y、縦軸に活性化関数fact(Y)の値をとる。図3の符号○印は、±1の範囲の値をとる正側の活性化値(状態値)、図3の符号×印は、±1の範囲の値をとる負側の活性化値である。
 ニューラルネットワーク回路20(図2参照)は、多ビットで高い認識精度を実現している。このため、活性化関数回路25(図2参照)において、非線形な活性化関数fact(Y)を用いることができる。すなわち、図4に示すように、非線形な活性化関数fact(Y)は、傾きが非ゼロとなる部分(図4の破線囲み部分参照)に±1の範囲の値をとる活性化値を設定できる。このため、ニューラルネットワーク回路20は、多様な活性を実現でき、認識精度は実用的な値になっていた。しかし、ニューラルネットワーク回路20は、大量の乗算回路23が必要になる。加えて、ニューラルネットワーク回路20は、入出力・重みが多ビットであることにより、大量のメモリが必要であり、読み書きの速度(メモリ容量・帯域)も問題である。
 <単に2値化した2値化ニューラルネットワーク回路>
 図2に示す比較例のニューラルネットワーク回路20は、短精度(多ビット)による積和演算回路で構成されている。このため、多数の乗算回路21が必要であり、面積・消費電力が多大になる欠点があった。また、入出力・重みが多ビットであることで大量のメモリが必要であり、読み書きの速度(メモリ容量・帯域)が問題となっていた。
 そこで、2値化した精度、すなわち+1と-1のみ用いてニューラルネットワーク回路2(図1参照)を構成する回路が提案された(非特許文献1~4)。具体的には、図2に示すニューラルネットワーク回路20の乗算回路21を、論理ゲート(例えばXNORゲート回路)に置き換えることが考えられる。
 図4は、比較例の図2に示すニューラルネットワーク回路20の乗算回路21をXNORゲート回路に置き換えた2値化ニューラルネットワーク回路の構成の一例を示す図である。
 比較例の2値化ニューラルネットワーク回路30は、図1のニューラルネットワーク回路2に適用できる。
 図4に示すように、比較例の2値化ニューラルネットワーク回路30は、入力値x1~xn(2値)を入力する入力ノードおよび重みw1~wn(2値)を入力する入力部31と、バイアスw0(2値)を入力するバイアスw0入力部32と、入力値x1~xnおよび重みw1~wnを受け取り、XNOR(Exclusive NOR:否定排他的論理和)論理を取る複数のXNORゲート回路33と、XNORゲート回路33の各XNOR論理値とバイアスw0との総和を取る総和回路34と、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路35と、を備えて構成される。
 2値化ニューラルネットワーク回路30は、乗算回路23(図2参照)がXNOR論理を実現するXNORゲート回路33に置き換えられている。このため、乗算回路23を構成する際に必要であった面積を削減することができる。また、入力値x1~xn、出力値z、および重みw1~wnは、いずれも2値(-1と+1)であるため、多値である場合と比較してメモリ量を大幅に削減でき、メモリ帯域を向上させることができる。
 図5は、比較例の前記図4に示す2値化ニューラルネットワーク回路30における活性化関数fsgn(B)を示す図である。図5は、横軸に総和を取った信号Y、縦軸に活性化関数fsgn(B)の値をとる。図5の符号○印は、±1の範囲の値をとる正側の活性化値、図5の符号×印は、±1の範囲の値をとる負側の活性化値である。
 2値化ニューラルネットワーク回路30は、入力値x1~xnおよび重みw1~wnを単に2値化している。このため、図5の符号aに示すように、±1のみ扱う活性化関数しか扱えないため、誤差が頻繁に生じてしまう。また、傾きが非ゼロとなる区間(図5の破線囲み部分参照)が不均等となり学習が上手く行われない。すなわち、図6の符号bに示すように、不均等な幅により微分が定義できない。その結果、単に2値化した2値化ニューラルネットワーク回路40は、認識精度が大幅に落ち込んでしまう。
 そこで、非特許文献1~4には、既存の2値化ニューラルネットワークの精度を維持するためにバッチ正規化を行う技術が記載されている。
 <バッチ正規化回路を備える2値化ニューラルネットワーク回路>
 図6は、比較例の2値化した精度を是正して、CNNの認識精度を保つバッチ正規化回路(BN:Batch Normalization)を備える2値化ニューラルネットワーク回路40の構成の一例を示す図である。図4と同一構成部分には同一符号を付している。
 図6に示すように、比較例の2値化ニューラルネットワーク回路40は、入力値x1~xn(2値)を入力する入力ノードx1~xn、重みw1~wn(2値)を入力する入力部31と、バイアスB(多ビット)を入力するバイアスB入力部32と、入力値x1~xnおよび重みw1~wnを受け取り、XNOR(Exclusive NOR:否定排他的論理和)論理を取る複数のXNORゲート回路33と、XNORゲート回路33の各XNOR論理値とバイアスBとの総和を取る総和回路34と、2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路41と、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路35と、を備えて構成される。
 バッチ正規化回路41は、重み総和を取った信号Yと平均値(μ)との差分をとる減算器42と、減算器42出力とミニバッチの分散値(σ )および定数(ε)の和の根の逆数とを乗算する第1乗算回路43と、第1乗算回路43出力に、スケーリング(γ)値(多ビット)による正規化を行う第2算回路44と、スケーリング係数(γ)による正規化後、シフト値(β)(多ビット)によりシフトして2分類を行う加算器45とを有する。スケーリング係数(γ)およびシフト値(β)の各パラメータは、事前に学習時に求めておく。
 学習データ毎に重みを更新していると、計算時間がかかり特定のデータに依存してしまう。そこで、バッチというまとまったデータ数単位で更新を行う手法が採られる。ミニバッチとは、バッチを更に小さくした単位であり、現在はこのミニバッチを用いる。
 2値化ニューラルネットワーク回路40は、バッチ正規化回路41を備えることで、2値化した精度を是正して、CNNの認識精度を保つようにする。
 なお、入力値x1~xnと重みw1~wnとのXNOR論理を取る論理回路であれば、XNORゲートに限らずどのような論理ゲートでもよい。例えば、XOR回路を用いて総和をとり、活性化関数の否定を取ってもよい。
 <バッチ正規化回路が必要となる理由>
 比較例の2値化ニューラルネットワーク回路40のバッチ正規化回路41が必要となる理由について説明する。
 図7および図8は、比較例の2値化ニューラルネットワーク回路40のバッチ正規化による効果を説明する図である。図7は、比較例のスケーリング係数(γ)による正規化を示す図、図8は、比較例のシフト値(β)による-1~+1の制限を示す図である。
 バッチ正規化とは、2値化によるバラツキの偏りを是正する回路であり、重み総和後、スケーリング係数(γ)による正規化を行った後、シフト値(β)による適切な活性化による2分類を行う。これらのパラメータは事前に学習時に求めておく。具体的には、下記の通りである。
 図7の白抜矢印および符号cに示すように、バッチ正規化回路41の乗算回路42(図6参照)は、重み総和後の信号(結果)Yを、スケーリング係数(γ)により、幅「2」(図7の網掛け部参照)に正規化する。これにより、図5の幅(図5の網掛け部参照)と比較して分かるように、単に2値化した2値化ニューラルネットワーク回路30では、不均等な幅により微分が定義できなかった不具合が、スケーリング係数(γ)により幅「2」に正規化することで、不均等な幅が抑制される。
 その上で、図8の白抜矢印および符号dに示すように、バッチ正規化回路41の加算器45(図6参照)は、スケーリング係数(γ)による正規化後の値を、シフト値(β)により-1~+1の範囲になるよう制限する。すなわち、図5の幅(図5の網掛け部参照)と比較して分かるように、図5の幅(図5の網掛け部参照)が、+1側により多くシフトしている場合には、シフト値(β)により、スケーリング係数(γ)による正規化後の値を-1~+1に制限することで、この幅の中心を0とする。図5の例では、負側の活性化値(図5の破線囲み部の符号×印参照)が、本来あるべき負側に戻される。これにより、誤差の発生が減少し、認識精度を高めることができる。
 このように、比較例の2値化ニューラルネットワーク回路40には、バッチ正規化回路41が必要である。
 <バイアス項による補正の必要性>
 上述したように、学習を進めると重みが均等に分布する。しかし、学習データには偏りが存在するため、完全には均等に分布せず、その調整のためにごくわずかなバイアス項による補正が必要であった。学習データにもよるがバイアス項の精度は、固定小数点精度で30~40ビットになり、浮動小数点精度を使ったとしても、加算器などの回路が必要であった。
 すなわち、学習データの偏りが存在するので完全に均等分布は非常に困難であり、それを調整するためにバイアス(もしくはバイアスに相当する操作)が必要となる。このため、バイアスは多ビットである必要がある。また、バイアス値は、学習データや学習期間に応じて、刻々と変化する。
 バイアスがない場合、実用に耐えない。例えば、後記する図10の例では、Classification Errorが90%程度になると想定される。
 バイアスがあることの直接的な課題は、高精度による回路が必要とされることである。このような高精度な回路は、面積・消費電力が大きいものとなる。
(本発明の原理説明)
 本発明の着眼点は、バッチ正規化の操作を導入したNNに対して、これと等価なNNを解析的に求めると、バイアス項が不要なNNを得ることができることを発見したことである。
 すなわち、重み積和後に2値化ニューラルネットワーク回路40のバッチ正規化回路41(図6参照)に入力される信号をYとすると、バッチ正規化回路41から出力される信号(Yと等価となる信号)Y’(中間値)は、次式(1)で示される。
Figure JPOXMLDOC01-appb-M000010
 ただし、
 γ:スケーリング係数
 β:シフト値
 μ:ミニバッチの平均値
 σ :ミニバッチの分散値
 ε:定数(0による除算を避けるための定数)
 ここで、上記スケーリング係数(γ)、シフト値(β)、ミニバッチの平均値(μ)、ミニバッチの分散値(σ )、および定数(ε)は、学習時にバッチ正規化により得られる値である。
 2値化ニューラルネットワーク回路40の活性化関数を通した出力は、+1または-1(信号の割り当てによっては0または1)である。また、上記式(1)の係数γ/√(σ +ε)-1により、2値化ニューラルネットワーク回路40の中間信号を変換しても活性化関数を通した値は変化しないので、無視できる。
 したがって、上記式(1)は、次式(2)となる。
Figure JPOXMLDOC01-appb-M000011
 ここで、2値化活性化関数の値は、中間値Y’が正か負かで+1または-1(信号の割り当てによっては0または1)である。したがって、2値化活性化関数の値f’sgn(Y)は、下記式(3)の条件で決まる。
Figure JPOXMLDOC01-appb-M000012
 よって、これらの解析的な操作から重み積和演算は、下記式(4)のように得られる。
Figure JPOXMLDOC01-appb-M000013
 さて、単に2値化した2値化ニューラルネットワーク回路20(図2参照)より、入力値x0=1である。このとき、w0はバイアス値であったから、上記式(4)は、下記式(5)となる。
Figure JPOXMLDOC01-appb-M000014
 ここで、上記式(5)の第1項の総和演算がi=1で始まることに注意されたい。すなわち、上記式(5)の第1項は、バイアス値が含まれないニューラルネットワークを表している。ちなみに、上記式(4)の第1項の総和演算はi=0で始まっている。
 ここで、上記式(5)にw0-μ=μ’を導入すると、上記式(5)は、下記式(6)となる。μ’は、バイアスを除く平均値である。
Figure JPOXMLDOC01-appb-M000015
 上記式(6)は、次のことを意味する。すなわち、上記式(6)は、バイアスを除いたニューラルネットワークとバッチ正規化を用いて学習することで、正しく2値化ニューラルネットワークが実現できることを表している。このとき、上記式(6)を実現する回路構成は、μ’を学習する、すなわち、従来学習していたミニバッチの平均値とバイアス値を減算した値を学習するものといえる。
 従来のニューラルネットワークでは、中間層、特に後半部になるにつれて学習が収束する。後半部になるにつれて学習が収束することで、重みの分散が一定となる。このため、それを調整するバイアス値が極めて小さくなる問題があった。
 上記式(6)は、バイアス値を個別に学習しなくても等価な2値ニューラルネットワークが学習できることを示している。解析的な洞察がなければ成り立たない。
[実施形態の構成]
 図9は、本発明の実施形態に係るニューラルネットワークの2値化ニューラルネットワーク回路の構成を示す図である。比較例の図6と同一構成部分には、同一符号を付している。
 本実施形態の2値化ニューラルネットワーク回路は、ディープニューラルネットワークへの実装技術を提供する。
 2値化ニューラルネットワーク回路100は、図1のニューラルネットワーク回路2に適用できる。
 2値化ニューラルネットワーク回路100(ニューラルネットワーク回路装置)は、バイアスが不要な2値化ニューラルネットワーク回路である。
 図9に示すように、2値化ニューラルネットワーク回路100は、入力値x1~xn(xi)(2値)を入力する入力ノードおよび重みw1~wn(wi)(2値)を入力する入力部101と、入力値x1~xnおよび重みw1~wnを受け取り、XNOR論理を取るXNORゲート回路102(論理回路部)と、各XNOR論理値の総和を取る総和回路103(総和回路部)と、2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路41と、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路35と、を備えて構成される。
 2値化ニューラルネットワーク回路100は、前記式(6)で示されるバイアス項を不要とする2値化CNNである。
 2値化ニューラルネットワーク回路100は、ディープニューラルネットワーク1の隠れ層12(図1参照)に適用される。ここでは、ディープニューラルネットワーク1において、入力値に対し学習済のものを評価していくことを前提としている。
 なお、NNでは、重みが、クライアントの認識物体毎に全て異なる。また学習により毎回異なることがある。画像処理では係数は、全て同じであり、この点でNNと画像処理では、HWが大きく異なる。
 XNORゲート回路102は、排他的論理和を含むどのような論理回路部でもよい。すなわち、入力値x1~xnと重みw1~wnとの論理を取る論理回路であれば、XNORゲートに限らずどのようなゲート回路でもよい。例えば、XORゲートにNOTゲートを組み合わせる、AND,ORゲートを組み合わせる、さらにはトランジスタスイッチを用いて作製するなど、論理的に等しいものであればどのようなものでもよい。
 2値化ニューラルネットワーク回路100は、バイアスが不要な2値化ニューラルネットワーク回路であり、比較例の2値化ニューラルネットワーク回路40(図6参照)で必要であったバイアスb入力部32が削除されている。
 したがって、総和回路103は、各XNOR論理値の総和のみを取る。すなわち、総和回路103は、比較例の2値化ニューラルネットワーク回路40(図6参照)総和回路35のように、各XNOR論理値とバイアスbとの総和を取ることはない。
 バッチ正規化回路41は、重み総和を取った信号Yと平均値(μ)との差分をとる減算器42と、減算器42出力とミニバッチの分散値(σ )および定数(ε)とを乗算する第1乗算回路43と、第1乗算回路43出力に、スケーリング(γ)値(多ビット)による正規化を行う第2乗算回路44と、スケーリング係数(γ)による正規化後、シフト値(β)(多ビット)によりシフトして2分類を行う加算器45と、からなる。
 活性化回路35は、総和を取った信号Yに対して符号ビットのみを出力する活性化関数回路を模擬する回路となっている。符号ビットは、総和を取った多ビット信号Yを活性化するかしないかで示す2値信号である。
 このように、2値化ニューラルネットワーク回路100は、総和回路103が、式(6)で示されるように各XNOR論理値の総和のみを取る。このため、2値化ニューラルネットワーク回路100は、バイアスが不要なニューラルネットワーク回路となっている。
 以下、上述のように構成された2値化ニューラルネットワーク回路100の動作について説明する。
 2値化ニューラルネットワーク回路100は、図1に示すディープニューラルネットワーク1のニューラルネットワーク回路2に用いられる。この場合、2値化ニューラルネットワーク回路100の入力ノードx1~xnは、図1に示すディープニューラルネットワーク1のhidden layer1の入力ノードである。入力部101には、隠れ層12のhidden layer1の入力ノードの入力値x1~xn(2値)および重みw1~wn(2値)が入力される。
 乗算の代わりとなるXNORゲート回路102では、入力値x1~xnおよび重みw1~wnを受け取り、XNOR論理により2値(-1/+1)の乗算を行う。XNORゲート回路102を通した後、総和回路103は、各XNOR論理値の総和を取る。そして、バッチ正規化回路41は、総和を取った信号Yをバッチ正規化する。活性化関数回路35は、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する。
 2値化ニューラルネットワーク回路100は、比較例の多ビット構成の乗算回路21(図2参照)がXNOR論理を実現するXNORゲート回路102に置き換えられている。このため、乗算回路21を構成する際に必要であった面積を削減することができる。また、入力値x1~xnおよび重みw1~wnは、いずれも2値(-1/+1)であるため、多ビット(多値)である場合と比較してメモリ容量を大幅に削減でき、メモリ帯域を向上させることができる。
[学習の実施例]
 本実施形態の効果を確認するため、VGG11(隠れ層が11層) ベンチマークNNを実装し、学習が成功するか確認した。VGG11は、良く使われているベンチマークで再現性があるものである。
 図10A-Cは、比較例および本実施形態の2値化VGG11モデルを用いて画像認識タスクCIFAR10を学習させた結果の認識精度を説明する図である。図10Aは「バッチ正規化なし」(バイアス項あり)で構成したニューラルネットワーク回路30(図4参照)の認識精度、図10Bは「バッチ正規化あり」(バイアス項あり)で構成した2値化ニューラルネットワーク回路40(図6参照)の認識精度、図10Cは「バッチ正規化あり」(バイアス項なし)で構成した本実施形態の2値化ニューラルネットワーク回路100(図9参照)の認識精度をそれぞれ示す。図10Cは、本実施形態をVGG11 ベンチマークNNで実装し確認したものである。
 図10A-Cの横軸は、利用した学習データに対して更新を終えたサイクルであるエポック(epoch)数(学習回数)、縦軸は誤認識率(Classification error)である。また、図10A-Cは、ディープニューラルネットワーク用のフレームワークソフトウェアChainer(登録商標)のfloat32 精度CNNを用いている。
 <バッチ正規化の効果>
 図10Aの「バッチ正規化なし」に示すように、比較例の単に2値化した2値化ニューラルネットワーク回路30(図4参照)では、誤認識率が大きく(エポック数200以上;誤認識率約70%)認識精度は悪い。また、学習を続けても認識精度の改善は見られない(学習が成功していない)。
 これに対して、比較例の図10Bの「バッチ正規化あり」(バイアス項あり)で構成した2値化ニューラルネットワーク回路40(図6参照)と本実施形態の図10Cの「バッチ正規化あり」(バイアス項なし)で構成した2値化ニューラルネットワーク回路100(図9参照)は、どちらも学習を続けるに従って誤認識率が落ちており、エポック数400以上で誤認識率は小さくなり(約20%)、学習が成功していることを示している。
 このように、バッチ正規化回路41が無ければ学習が成功していない。2値化ニューラルネットワーク回路30では、バッチ正規化回路41が必要であることがあらためて確認された。
 <バイアス項を不要とする2値化CNNバッチ正規化の効果>
 比較例の図10Bの「バッチ正規化あり」(バイアス項あり)と本実施形態の図10Cの「バッチ正規化あり」(バイアス項なし)とを比較して分かるように、バッチ正規化回路41がある場合には、バイアス項の有無については、認識精度にほとんど影響を与えないことが確認された。
 すなわち、図10Cの「バッチ正規化あり」(バイアス項なし)で構成した本実施形態のニューラルネットワーク回路100(図9参照)は、比較例の図10Bの「バッチ正規化あり」(バイアス項あり)で構成したニューラルネットワーク回路40と比較して、バイアス項をなくしても認識精度を落とさないことが確認された。
 図11は、本実施形態の2値化ニューラルネットワーク回路100をFPGA(Digilent 社 NetFPGA-1G-CML)上に実装し、既存の多ビット実装法との比較を行った結果を表にして示す図である。
 図11の表は、表下欄外に表記した[Zhao et al.]~[FINN]の学会発表者(論文発表年)のニューラルネットワークと本実施形態のニューラルネットワークをFPGA (Digilent社 ZedBoard)上に実現した場合に、各項目を対比して示したものである。
 図11の表の用語は下記の通りである。
 Implementationは、実装した手法・研究グループ名である。
 (Year)は、関連文献が発表された年である。
 FPGA Boardは、FPGA(field-programmable gate array)搭載ボードの名称である。
 (FPGA)は、FPGA搭載ボードに搭載されているFPGAの型番であり、比較条件を揃えるため同一のFPGAを使用する。
 Clock [MHz] は、FPGAの動作周波数である。動作周波数が大きいほど高速に動作する。
 #LUTsは、FPGAのLUT(Look-Up Table)消費量であり、面積を意味する。
 #18Kb BRAMsは、FPGAの内部メモリブロックの消費量であり、面積を意味する。
 #DSP Blocksは、FPGAの内部積和演算ブロックの消費量であり、面積を意味する。
 Test Errorは、テスト画像のエラー率であり、認識精度を意味する。
 Time [msec] は、認識時間(単位はミリ秒)である。
 (FPS)は、Frames Per Secondの略で単位時間当たりに認識できる画像数である。(FPS)の数値が大きいほど高速である。
 Power [W]は、消費電力(単位はワット)である。
 FPS/Wattは、消費電力効率である。
 FPS/LUTは、面積効率である。
 FPS/BRAMは、メモリ量効率である。
 図11の表は、「Platform」(プラットフォーム)、「FPGA Board」(使用FPGAボード)、「Clock(MHz)」(同期化のための内部クロック)、「LUT, BRAM,DSP Block」(メモリ・DSP数)、「Test Error」(誤認識率)、「Time(msec)(FPS)」(処理時間(処理速度))、「Power(W)」(消費電力)、「FPS/Watt, FPS/ LUT, FPS/BRAM」(データ転送待ち時間/外部にメモリを付けた場合の転送速度)、の各項目を対比して示した。この表において、特に注目すべき事項は下記の通りである。
 <消費電力>
 本実施形態の2値化ニューラルネットワーク回路100は、表の従来例と比較して、電力のバランスが取れていることが挙げられる。従来例では、「Power(W)」に示すように、4.7W,2.5Wと消費電力が大きい。消費電力が大きいので、これを回避する制御方法が複雑である。「Power(W)」に示すように、本実施形態では、従来例[Zhao et al.]と比較して消費電力を2.3Wと約1/2に低減することができた。
 <チップ面積>
 本実施形態の2値化ニューラルネットワーク回路100は、バイアスが不要であること、乗算回路が2値論理ゲートであること、から、表の「LUTs, BRAM,DSP Block」に示すように、チップ面積が46900から14509と約1/3に減り、外付けメモリが不要となる、メモリコントローラが単純になることなどの効果がある。チップ面積は価格に比例するので、価格も2桁程度安くなることが期待できる。
 <性能等価>
 本実施形態の2値化ニューラルネットワーク回路100は、表の「FPS/Watt, FPS/ LUT, FPS/BRAM」に示すように、性能パワー効率は、面積を見ずにパワー効率だけを見たものでも35.7と182.6と約5倍となっている。さらに、データ転送速度も168と120と約3倍となっている。
[実装例]
 図12は、本発明の実施形態に係る2値化ニューラルネットワーク回路の実装例を説明する図である。
 <STEP1>
 まず、与えられたデータセット(今回はImageNet、画像認識タスク用にデータ)を既存のディープニューラルネットワーク用のフレームワークソフトウェアであるChainer (登録商標)を用いてGPU(Graphics Processing Unit)を有するコンピュータ201上で学習を行った。学習は、GPU上で実行する。このコンピュータ201は、ARMプロセッサなどのCPU(Central Processing Unit)と、メモリと、ハードディスクなどの記憶手段(記憶部)と、ネットワークインタフェースを含むI/Oポートとを有する。このコンピュータは、CPU201が、メモリ上に読み込んだプログラム(2値化したニューラルネットワークの実行プログラム)を実行することにより、後記する各処理部により構成される制御部(制御手段)を動作させる。
 <STEP2>
 次に、自動生成ツールを用いて、本実施形態の2値化ニューラルネットワーク回路100と等価なC++コードを自動生成し、C++コード202を得た。
 <STEP3>
 次に、FPGA ベンダの高位合成ツール(Xilinx 社SDSoC) (登録商標)を用いて、FPGA(field-programmable gate array)合成用にHDL(hardware description language)203を生成した。例えば、高位合成ツール(Xilinx 社SDSoC)では、実現したい論理回路をハードウェア記述言語(Verilog HDL/VHDL)を用いて記述し、提供されたCADツールでビットストリームに合成する。そして、FPGAにこのビットストリームを送信するとFPGAに回路が実現する。
 <STEP4>
 次に、従来のFPGA合成ツールVivado (登録商標)を用いて、FPGA上に実現(FPGA合成204)して画像認識タスクの検証を行った。
 <STEP5>
 検証後、基板205を完成させた。基板205には、2値化ニューラルネットワーク回路100がハードウェア化されて実装されている。
 以上説明したように、本実施形態に係る2値化ニューラルネットワーク回路100(図9参照)は、入力値x1~xn(xi)(2値)を入力する入力ノードおよび重みw1~wn(wi)(2値)を入力する入力部101と、入力値x1~xnおよび重みw1~wnを受け取り、XNOR論理を取るXNORゲート回路102と、各XNOR論理値の総和を取る総和回路103と、2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路41と、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路35と、を備える。総和を取った信号Yは、式(6)で示される。
 また、ニューラルネットワーク処理方法では、入力値x1~xn(xi)および重みw1~wn(wi)を入力するステップと、入力値x1~xnおよび重みw1~wnを受け取り、XNOR論理を取るステップと、式(6)で示されるように、各XNOR論理値の総和のみを取るステップと、バッチ正規化を行うステップと、総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換するステップと、を実行する。
 学習時にバイアス項を不要とする2値化CNNで学習を行い、回路実現時もバイアス項を不要とする。
 これにより、バイアス項を保持するメモリ・加算器回路が不要であり、CNNを2値の入力・重みとバッチ正規化回路41で実現できる。このため、認識精度をほとんど落とすことなく面積・消費電力・速度において優れるCNNを実現できる。
 例えば、図11の表に示すように、本実施形態に係る2値化ニューラルネットワーク回路100は、消費電力(Power [W])を半分に削減でき、面積を約30分の1(FPS/Watt,FPS/LUT,FPS/BRAMの相乗効果)に削減できた。
 本実施形態では、2値化ニューラルネットワーク回路40(図6参照)で必須であったバイアス自体を不要とすることから面積が削減でき、メモリ量も削減できる。また、図10(b)(c)を比較してわかるように、本実施形態の2値化ニューラルネットワーク回路100は、認識精度について差がない。
 図13は、各FPGA実装のハードウェアの量を比較して示す図である。ザイリンクス社のFPGAを用いて固定小数点精度,2値化,本実施形態がそれぞれ要求するハードウェアの量を計算した。具体的には、TensorFlowチュートリアルCNNを実装した。また、Digilent社のNetFPGA-1G-CMLボード上に実装した。
 各FPGA実装の比較は、本実施形態(2値化(バッチ正規化+バイアスなし))、比較例の固定小数点(16ビット)、および比較例の2値化(バイアスのみ)である。FPGA実装のハードウェアの量は、FF(flip-flop)数、LUT数、18Kb BRAM 数、およびDSP(digital signal processor) 48E 数で示される。
 図13に示すように、本実施形態(2値化(バッチ正規化+バイアスなし))および2値化(バイアスのみ)は、固定小数点精度に対して、FF数、LUT数、18Kb BRAM 数、およびDSP48E 数の、いずれのハードウェア量も減少していることが確かめられた。また、本実施形態(2値化(バッチ正規化+バイアスなし))は、2値化(バイアスのみ)に対してもハードウェア量(面積)が1~2%程度の増加で済んでいることが分かる。
 さらに、本実施形態の効果について述べる。
(1)バッチ正規化なしのCNNとの比較
 本実施形態は、バッチ正規化なしのCNNと比較して、バイアス項回路が不要になる、かつ、学習時にバイアスが不要になるので学習が容易になる利点がある。ただし、バッチ正規化項用の回路が必要である。また、図13の本実施形態(2値化(バッチ正規化+バイアスなし))と比較例の2値化(バイアスのみ)との比較から分かるように、ハードウェア量(面積)、電力が数%増加する。
(2)学習時の比較
 前記図10B,Cに示すように、本実施形態の2値化ニューラルネットワーク回路100の認識の精度(図10C参照)と、比較例の「バッチ正規化あり」(バイアス項あり)で構成した2値化ニューラルネットワーク回路40の認識精度(図10B参照)、および学習時間に差はなく、ほぼ同じとみてよいことが分かる。なお、回路実現時の差異は、図13で示されている。
(3)設計容易性
 バイアス値がある場合、その値が極めて小さい値(固定小数点30~40ビット)であるので回路設計に留意すべきである。
 本実施形態によれば、既存のバイアスを有する2値化ニューラルネットワーク回路と比較して、消費電力を半分に削減でき、面積を約30分の1に削減(図11参照)しつつ、図10に示したように認識精度はほぼ等価なCNNを構成できることが判明した。ディープラーニングを用いたADAS(Advanced Driver Assistance System:先進運転支援システム)カメラ画像認識用のエッジ組み込み装置ハードウェア方式として実用化が期待される。特にADASでは、車載する上で高信頼性と低発熱が要求される。本実施形態に係る2値化ニューラルネットワーク回路100は、図11の表に示すように、消費電力(Power [W])が格段に低減していることに加え、外付けメモリが不要であるので、メモリを冷却する冷却ファンや冷却フィンも不要である。ADASカメラに搭載して好適である。
[変形例]
 図14は、変形例1のディープニューラルネットワークの2値化ニューラルネットワーク回路の構成を示す図である。図9と同一構成部分には同一符号を付して重複箇所の説明を省略する。
 変形例1の2値化ニューラルネットワーク回路100Aは、図1のニューラルネットワーク回路2に適用できる。
 2値化ニューラルネットワーク回路100A(ニューラルネットワーク回路装置)は、バイアスが不要な2値化ニューラルネットワーク回路である。
 図14に示すように、2値化ニューラルネットワーク回路100Aは、図9の2値化ニューラルネットワーク回路100にさらに、バイアス値を記憶するバイアスメモリ110(記憶部,バイアス値入力部)を備えて構成される。
 2値化ニューラルネットワーク回路100Aは、バイアスメモリ110に記憶されたバイアス値を読み出して総和回路103に出力する。この場合、2値化ニューラルネットワーク回路100Aは、バイアスを用いる2値化ニューラルネットワーク回路40(図6参照)と同様に、総和回路103にバイアス値が入力される構成となる。総和回路35は、XNORゲート回路34の各XNOR論理値とバイアス値との総和を取ることになり、2値化ニューラルネットワーク回路100Aは、バイアスを用いる2値化ニューラルネットワーク回路40(図6参照)と等価なニューラルネットワーク処理方法を実現できる。
 一方、2値化ニューラルネットワーク回路100Aは、バイアスメモリ110に記憶されたバイアス値の読み出しに代えて、総和回路103に0を書き込むことで、式(6)の回路を実行する2値化ニューラルネットワーク回路100Aのニューラルネットワーク処理方法を実現できる。この場合、2値化ニューラルネットワーク回路100Aは、バイアスを不要とする2値化CNNである。
 変形例1によれば、2値化ニューラルネットワーク回路100Aを、バイアスを用いる既存の2値化ニューラルネットワーク回路40(図6参照)に置き換え(流用して)使用することができ、汎用的に適用可能である。特に、バイアスを用いる既存の2値化ニューラルネットワーク回路40そのもの、またバイアスを用いる既存の2値化ニューラルネットワーク回路40に接続されるメモリや読出し/書込み制御部の設計変更や検証を行うことなく適用できる。また、既存の2値化ニューラルネットワーク回路40で蓄積した資源を活用することができる。
 図15は、変形例2のディープニューラルネットワークの2値化ニューラルネットワーク回路の構成を示す図である。図9と同一構成部分には同一符号を付して重複箇所の説明を省略する。
 変形例2の2値化ニューラルネットワーク回路100Bは、図1のニューラルネットワーク回路2に適用できる。
 2値化ニューラルネットワーク回路100B(ニューラルネットワーク回路装置)は、バイアスが不要な2値化ニューラルネットワーク回路である。
 図15に示すように、2値化ニューラルネットワーク回路100Bは、図9の2値化ニューラルネットワーク回路100にさらに、バイアス値Bを入力するバイアス値入力部120と、バイアス値Bの総和回路103への入力をオンオフするスイッチ121と、を備えて構成される。
 2値化ニューラルネットワーク回路100Bは、バイアスメモリ110に記憶されたバイアス値を読み出して総和回路103に出力する。この場合、2値化ニューラルネットワーク回路100Bは、バイアスを用いる2値化ニューラルネットワーク回路40(図6参照)と同様に、総和回路103にバイアス値Bが入力される構成となる。総和回路35は、XNORゲート回路34の各XNOR論理値とバイアス値Bとの総和を取ることになり、2値化ニューラルネットワーク回路100Bは、バイアスを用いる2値化ニューラルネットワーク回路40(図6参照)と等価なニューラルネットワーク処理方法を実現できる。
 一方、2値化ニューラルネットワーク回路100Bは、スイッチ121をオフにすることで、バイアス値Bの総和回路103への入力をオフし、式(6)の回路を実行する2値化ニューラルネットワーク回路100Aのニューラルネットワーク処理方法を実現できる。
 変形例2によれば、2値化ニューラルネットワーク回路100Bを、バイアスを用いる既存の2値化ニューラルネットワーク回路40(図6参照)に置き換え(流用して)使用することができ、変形例1の場合と同様の効果を得ることができる。変形例2は、変形例1の2値化ニューラルネットワーク回路100Aに比べ構成がより簡素であり、さらに汎用的に適用できる。
 本発明は上記の実施形態例に限定されるものではなく、特許請求の範囲に記載した本発明の要旨を逸脱しない限りにおいて、他の変形例、応用例を含む。
 例えば、乗算回路としての論理ゲートに代えて、LUT(Look-Up Table)を用いてもよい。このLUTは、XNOR論理を行うXNORゲート回路102(図9参照)に代えて、FPGA の基本構成要素であるルックアップテーブルを用いる。LUTは、2入力(x1,w1)に対する2値(-1/+1)のXNOR論理結果Yを格納する。LUTを用いることで、バッチ正規化回路の面積とパラメータを格納するメモリ面積・メモリ帯域を無くすことができ、かつ、性能的には等価な回路構成を実現することができる。LUTは、FPGAの基本構成要素であり、FPGA合成の際の親和性が高く、FPGAによる実装が容易である。
 また、上記した実施形態例は本発明をわかりやすく説明するために詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに限定されるものではない。また、ある実施形態例の構成の一部を他の実施形態例の構成に置き換えることが可能であり、また、ある実施形態例の構成に他の実施形態例の構成を加えることも可能である。また、実施形態例は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更を行うことができる。これら実施形態やその変形例は、発明の範囲や要旨に含まれるとともに、特許請求の範囲に記載された発明とその均等の範囲に含まれる。
 また、上記実施形態において説明した各処理のうち、自動的に行われるものとして説明した処理の全部または一部を手動的に行うこともでき、あるいは、手動的に行われるものとして説明した処理の全部または一部を公知の方法で自動的に行うこともできる。この他、上述文書中や図面中に示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。
 また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。
 また、上記の各構成、機能、処理部、処理手段等は、それらの一部または全部を、例えば集積回路で設計する等によりハードウェアで実現してもよい。また、上記の各構成、機能等は、プロセッサがそれぞれの機能を実現するプログラムを解釈し、実行するためのソフトウェアで実現してもよい。各機能を実現するプログラム、テーブル、ファイル等の情報は、メモリや、ハードディスク、SSD(Solid State Drive)等の記録装置、または、IC(Integrated Circuit)カード、SD(Secure Digital)カード、光ディスク等の記録媒体に保持することができる。
 また、上記実施の形態では、装置は、ニューラルネットワーク回路装置という名称を用いたが、これは説明の便宜上であり、名称はディープニューラルネットワーク回路、ニューラルネットワーク装置、パーセプトロン等であってもよい。また、方法およびプログラムは、ニューラルネットワーク処理方法という名称を用いたが、ニューラルネットワーク演算方法、ニューラルネットプログラム等であってもよい。
 1 ディープニューラルネットワーク
 2 ニューラルネットワーク回路
 11 入力層
 12 隠れ層(中間層)
 13 出力層
 35 活性化回路(活性化回路部,活性化回路手段)
 41 バッチ正規化回路
 42 減算器
 43 第1乗算回路
 44 第2乗算回路
 45 加算器
 100,100A,100B 2値化ニューラルネットワーク回路(ニューラルネットワーク回路装置)
 101 入力部
 102 XNORゲート回路(論理回路部,論理回路手段)
 103 総和回路(総和回路部,総和回路手段)
 110 バイアスメモリ(記憶部,バイアス値入力部)
 120 バイアス値入力部
 121 スイッチ
 x1~xn(xi) 入力値(2値)
 w1~wn(wi) 重み(2値)

Claims (9)

  1.  入力層、1以上の中間層、および、出力層を少なくとも含むニューラルネットワーク回路装置であって、
     前記中間層の中で、2値の入力値xiおよび重みwiを受け取り、論理演算を行う論理回路部と、
     前記論理回路部の出力の総和を取る総和回路部と、
     2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路部と、
     総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路部と、を備え、
     前記総和を取った信号Yは、下記式で示される
    Figure JPOXMLDOC01-appb-M000001
     ただし、
     γ:スケーリング係数
     β:シフト値
     μ’:バイアスを除く平均値。入力値x0のときのバイアス値w0とし、ミニバッチの平均値μとするとき、w0-μ
     σ :ミニバッチの分散値
     ε:定数
     ことを特徴とする記載のニューラルネットワーク回路装置。
  2.  前記総和を取った信号Yが、下記式(4)で示される場合、
    Figure JPOXMLDOC01-appb-M000002
     ただし、
     μ:ミニバッチの平均値
     
     入力値x0=1、このときのバイアス値w0をもとに、前記式(4)を、下記式(5)に変形し、
    Figure JPOXMLDOC01-appb-M000003
     さらに、前記バイアス値w0から前記ミニバッチの平均値μを減じた値を前記μ’に置き換えて、下記式(6)とする
    Figure JPOXMLDOC01-appb-M000004
     ことを特徴とする請求項1に記載のニューラルネットワーク回路装置。
  3.  バイアス値を入力するバイアス値入力部を備え、
     前記総和回路部は、
     前記論理回路部の出力と前記バイアス値との総和を取る
     ことを特徴とする請求項1に記載のニューラルネットワーク回路装置。
  4.  前記バイアス値を記憶する記憶部を備え、
     前記バイアス値入力部は、
     前記記憶部に記憶された前記バイアス値を読み出して前記総和回路部に出力するとともに、前記バイアス値の非使用時には前記総和回路部に0を書き込んで、下記式(6)の回路を実行する
    Figure JPOXMLDOC01-appb-M000005
     ことを特徴とする請求項3に記載のニューラルネットワーク回路装置。
  5.  前記バイアス値の前記総和回路部への入力をオンオフするスイッチを備え、
     前記バイアス値の非使用時には前記スイッチをオフして、下記式(6)の回路を実行する
    Figure JPOXMLDOC01-appb-M000006
     ことを特徴とする請求項3に記載のニューラルネットワーク回路装置。
  6.  前記論理回路部は、否定排他的論理和または排他的論理和を含む
     ことを特徴とする請求項1に記載のニューラルネットワーク回路装置。
  7.  請求項1乃至6のいずれか1項に記載のニューラルネットワーク回路装置を備えるニューラルネットワーク。
  8.  入力層、1以上の中間層、および、出力層を少なくとも含むニューラルネットワーク処理方法であって、
     前記中間層の中で、2値の入力値xiおよび重みwiを受け取り、論理演算を行うステップと、
     論理回路部の出力の総和を取るステップと、
     2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するステップと、
     総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換するステップと、を有し、
     前記総和を取った信号Yは、下記式で示される
    Figure JPOXMLDOC01-appb-M000007
     ただし、
     γ:スケーリング係数
     β:シフト値
     μ’:バイアスを除く平均値。入力値x0のときのバイアス値w0とし、ミニバッチの平均値μとするとき、w0-μ
     σ :ミニバッチの分散値
     ε:定数
     ことを特徴とする記載のニューラルネットワーク処理方法。
  9.  入力層、1以上の中間層、および、出力層を少なくとも含むニューラルネットワーク回路装置としてのコンピュータを、
     前記中間層の中で、2値の入力値xiおよび重みwiを受け取り、論理演算を行う論理回路手段、
     論理回路部の出力の総和を取る総和回路手段、
     2値化によるバラツキの偏りを正規化範囲を広げ中心をシフトさせる処理で是正するバッチ正規化回路手段、
     総和を取った信号Yのバッチ正規化した信号Bを活性化関数fsgn(B)で変換する活性化関数回路手段、
     ただし、前記総和を取った信号Yは、下記式で示される
    Figure JPOXMLDOC01-appb-M000008
     γ:スケーリング係数
     β:シフト値
     μ’:バイアスを除く平均値。入力値x0のときのバイアス値w0とし、ミニバッチの平均値μとするとき、w0-μ
     σ :ミニバッチの分散値
     ε:定数
     として機能させるためのニューラルネットワークの実行プログラム。
PCT/JP2018/034522 2017-09-20 2018-09-18 ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム WO2019059191A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US16/648,319 US11741348B2 (en) 2017-09-20 2018-09-18 Neural network circuit device, neural network, neural network processing method, and neural network execution program
CN201880057412.5A CN111095301A (zh) 2017-09-20 2018-09-18 神经网络电路装置、神经网络、神经网络处理方法和神经网络的执行程序

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2017180457A JP6933367B2 (ja) 2017-09-20 2017-09-20 ニューラルネットワーク回路装置、システム、処理方法および実行プログラム
JP2017-180457 2017-09-20

Publications (1)

Publication Number Publication Date
WO2019059191A1 true WO2019059191A1 (ja) 2019-03-28

Family

ID=65811242

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2018/034522 WO2019059191A1 (ja) 2017-09-20 2018-09-18 ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム

Country Status (4)

Country Link
US (1) US11741348B2 (ja)
JP (1) JP6933367B2 (ja)
CN (1) CN111095301A (ja)
WO (1) WO2019059191A1 (ja)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110110852A (zh) * 2019-05-15 2019-08-09 电科瑞达(成都)科技有限公司 一种深度学习网络移植到fpag平台的方法
CN110263139A (zh) * 2019-06-10 2019-09-20 湖北亿咖通科技有限公司 车辆、车机设备及其基于神经网络的文本意图识别方法

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11436471B2 (en) * 2017-10-13 2022-09-06 Panasonic Intellectual Property Corporation Of America Prediction model sharing method and prediction model sharing system
US20190042934A1 (en) * 2017-12-01 2019-02-07 Meenakshi Arunachalam Methods and apparatus for distributed training of a neural network
CN109800859B (zh) * 2018-12-25 2021-01-12 深圳云天励飞技术有限公司 一种神经网络批归一化的优化方法及装置
KR101991041B1 (ko) * 2018-12-31 2019-06-19 서울대학교산학협력단 아날로그 이진인공신경망 회로에서 활성도 조절을 통한 공정변이 보상방법 및 그 시스템
CN110598852A (zh) * 2019-08-29 2019-12-20 北京小米移动软件有限公司 子网络采样方法、构建超网络拓扑结构的方法及装置
US20210150313A1 (en) * 2019-11-15 2021-05-20 Samsung Electronics Co., Ltd. Electronic device and method for inference binary and ternary neural networks
US11295430B2 (en) * 2020-05-20 2022-04-05 Bank Of America Corporation Image analysis architecture employing logical operations

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018101275A1 (ja) * 2016-12-02 2018-06-07 国立大学法人東京工業大学 ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6227052B2 (ja) 2016-05-11 2017-11-08 三菱電機株式会社 処理装置、判別方法およびプログラム
KR101899101B1 (ko) * 2016-06-01 2018-09-14 서울대학교 산학협력단 인공 신경망 기반 예측 모델 생성 장치 및 방법
KR20180048109A (ko) * 2016-11-02 2018-05-10 삼성전자주식회사 뉴럴 네트워크 변환 방법 및 이를 이용한 인식 장치

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018101275A1 (ja) * 2016-12-02 2018-06-07 国立大学法人東京工業大学 ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
NAKAHARA, HIROKI ET AL.: "GUINNESS : A GUI based Binarized Deep Neural Network Framework for an FPGA", IEICE TECHNICAL REPORT, vol. 117, no. 221, 18 September 2017 (2017-09-18), pages 51 - 56 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110110852A (zh) * 2019-05-15 2019-08-09 电科瑞达(成都)科技有限公司 一种深度学习网络移植到fpag平台的方法
CN110263139A (zh) * 2019-06-10 2019-09-20 湖北亿咖通科技有限公司 车辆、车机设备及其基于神经网络的文本意图识别方法

Also Published As

Publication number Publication date
US11741348B2 (en) 2023-08-29
JP2019057072A (ja) 2019-04-11
CN111095301A (zh) 2020-05-01
US20200218964A1 (en) 2020-07-09
JP6933367B2 (ja) 2021-09-08

Similar Documents

Publication Publication Date Title
JP6183980B1 (ja) ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム
WO2019059191A1 (ja) ニューラルネットワーク回路装置、ニューラルネットワーク、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム
Coelho et al. Automatic heterogeneous quantization of deep neural networks for low-latency inference on the edge for particle detectors
US11915128B2 (en) Neural network circuit device, neural network processing method, and neural network execution program
CN110009099B (zh) 用于确定表示dnn的层的值的定点数格式的方法和系统
CN112418391B (zh) 用于对深度神经网络的权重进行转换的方法和系统
Sarwar et al. Energy efficient neural computing: A study of cross-layer approximations
GB2580171A (en) Methods and systems for selecting quantisation parameters for deep neural networks using back-propagation
EP3480743A1 (en) End-to-end data format selection for hardware implementation of deep neural network
EP3480689B1 (en) Hierarchical mantissa bit length selection for hardware implementation of deep neural network
DiCecco et al. FPGA-based training of convolutional neural networks with a reduced precision floating-point library
WO2020158760A1 (ja) ニューラルネットワーク回路装置、ニューラルネットワーク処理方法およびニューラルネットワークの実行プログラム
Shi et al. SURVEY ON BINARY NEURAL NETWORKS A
Luo et al. Blunet: Arithmetic-free inference with bit-serialised table lookup operation for efficient deep neural networks
GB2603647A (en) End-to-end data format selection for hardware implementation of deep neural network
GB2603582A (en) End-to-end data format selection for hardware implementation of deep neural network
GB2620172A (en) Identifying one or more quantisation parameters for quantising values to be processed by a neural network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18858182

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18858182

Country of ref document: EP

Kind code of ref document: A1