JP7040771B2 - Neural network processing equipment, communication equipment, neural network processing methods, and programs - Google Patents

Neural network processing equipment, communication equipment, neural network processing methods, and programs Download PDF

Info

Publication number
JP7040771B2
JP7040771B2 JP2018192019A JP2018192019A JP7040771B2 JP 7040771 B2 JP7040771 B2 JP 7040771B2 JP 2018192019 A JP2018192019 A JP 2018192019A JP 2018192019 A JP2018192019 A JP 2018192019A JP 7040771 B2 JP7040771 B2 JP 7040771B2
Authority
JP
Japan
Prior art keywords
neural network
quantized
convolution
memory
quantization
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
JP2018192019A
Other languages
Japanese (ja)
Other versions
JP2020060967A (en
JP2020060967A5 (en
Inventor
貴登 山田
トーマス ネバド ビルチェス アントニオ
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Leap Mind Inc
Original Assignee
Leap Mind Inc
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 Leap Mind Inc filed Critical Leap Mind Inc
Priority to JP2018192019A priority Critical patent/JP7040771B2/en
Publication of JP2020060967A publication Critical patent/JP2020060967A/en
Publication of JP2020060967A5 publication Critical patent/JP2020060967A5/en
Application granted granted Critical
Publication of JP7040771B2 publication Critical patent/JP7040771B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、ニューラルネットワーク処理装置、およびニューラルネットワーク処理方法に関する。 The present invention relates to a neural network processing apparatus and a neural network processing method.

近年、画像を複数のカテゴリに分類するためのディープニューラルネットワークとして、畳み込みニューラルネットワーク(Convolutional Neural Network:CNN)が注目されている。CNNは、ディープニューラルネットワークにおいて畳み込み層を有することを特徴とする。畳み込み層では、入力データに対してフィルタを適用する。より詳細には、畳み込み層では、フィルタのウィンドウを一定のストライドでスライドさせて、フィルタの要素と入力データの対応する要素とを乗算し、その和を求める積和演算を行う。 In recent years, a convolutional neural network (CNN) has been attracting attention as a deep neural network for classifying images into a plurality of categories. CNNs are characterized by having a convolutional layer in a deep neural network. The convolution layer applies a filter to the input data. More specifically, in the convolution layer, the window of the filter is slid with a constant stride, the element of the filter is multiplied by the corresponding element of the input data, and the product-sum operation is performed to obtain the sum.

図11は、一般的なCNNの信号処理のフローを示す図である。CNNは、入力層、中間層、および出力層を有する(例えば、非特許文献1参照)。中間層においては、入力信号に重みをかけ合わせる畳み込み演算が行われている。図11に示すように、中間層において、畳み込み演算の結果に対して、必要に応じてReLUなどの活性化関数が適用され、さらに、場合によっては正規化およびプーリング処理が行われる。また、畳み込み演算を介して抽出された入力信号の特徴は、全結合層からなる分類器にかけられ、分類結果が出力層から出力される。このように、CNNなどのニューラルネットワークにおいては、積和演算が繰り返し行われていることがその特徴の1つとして挙げられる。 FIG. 11 is a diagram showing a general CNN signal processing flow. The CNN has an input layer, an intermediate layer, and an output layer (see, for example, Non-Patent Document 1). In the intermediate layer, a convolution operation is performed in which the input signal is weighted. As shown in FIG. 11, in the intermediate layer, an activation function such as ReLU is applied to the result of the convolution operation as needed, and further, normalization and pooling processing are performed in some cases. Further, the characteristics of the input signal extracted through the convolution operation are applied to a classifier composed of a fully connected layer, and the classification result is output from the output layer. As described above, one of the features of a neural network such as CNN is that the product-sum operation is repeatedly performed.

ここで、CNNに用いられる入力データの入力値や重みは、小数点を含む場合があるが、従来のCNNなどのニューラルネットワークの積和演算においては、図11の「入力信号」、「重み」、および「畳み込み演算」の各値に示すように、演算結果の桁数を確保した形での演算処理が行われている。 Here, the input value and weight of the input data used for CNN may include a decimal point, but in the product-sum operation of a conventional neural network such as CNN, the "input signal" and "weight" in FIG. 11 And, as shown in each value of "convolution operation", the operation process is performed in a form that secures the number of digits of the operation result.

麻生 英樹、他、「Deep Learning 深層学習」近代科学社、2015年11月Hideki Asoh, et al., "Deep Learning Deep Learning", Modern Science Co., Ltd., November 2015

しかし、従来のCNNなどのニューラルネットワークをFPGA(Field Programmable Gate Array)やマイコンなどの組み込み用のハードウェアで実装する場合、桁数の多い積和演算による処理速度の低下が課題となっていた。 However, when a conventional neural network such as CNN is implemented by embedded hardware such as FPGA (Field Programmable Gate Array) or a microcomputer, a decrease in processing speed due to a product-sum operation having a large number of digits has been a problem.

本発明は、上述した課題を解決するためになされたものであり、ニューラルネットワークの処理速度の低下を抑制することができるニューラルネットワーク処理装置、通信装置、ニューラルネットワーク処理方法、及びプログラムを提供することを目的とする。 The present invention has been made to solve the above-mentioned problems, and to provide a neural network processing device, a communication device, a neural network processing method , and a program capable of suppressing a decrease in the processing speed of a neural network. The purpose is to provide.

上述した課題を解決するために、本発明に係るニューラルネットワーク処理装置は、多層ニューラルネットワークに与えられる入力信号を記憶する第1メモリと、前記多層ニューラルネットワークの重みを記憶する第2メモリと、前記第1メモリ及び前記第2メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行うプロセッサと、前記畳み込み演算の演算結果であり前記多層ニューラルネットワークでの次の演算に使用される演算結果を記憶するバッファと、を備え、前記畳み込み演算は、データのビット精度を削減する量子化が組み込まれた、量子化されていない演算結果ではなく量子化された演算結果のみが前記バッファに記憶されるよう畳み込みと量子化とを一括して行う量子化畳み込み演算であり、前記積和演算に使用される前記重みは、前記第2メモリに記憶される前に予め1ビットのビット精度まで量子化されているか、前記第2メモリに記憶された後に前記プロセッサにより1ビットのビット精度まで量子化され、前記量子化畳み込み演算を実現する第1関数を記憶する第3メモリをさらに備え、前記プロセッサは、前記第3メモリから前記第1関数を読み出し、読み出した前記第1関数を用いて前記量子化畳み込み演算を行う。 In order to solve the above-mentioned problems, the neural network processing apparatus according to the present invention includes a first memory for storing an input signal given to the multi- layered neural network, a second memory for storing the weights of the multi- layered neural network, and the above -mentioned. A processor that performs a convolution operation of the multi- layer neural network including a product-sum operation of the input signal and the weight stored in the first memory and the second memory, respectively , and the operation result of the convolution operation and the multi-layer. The convolution operation is not an unquantized operation result with built-in quantization that reduces the bit accuracy of the data, with a buffer that stores the operation result used for the next operation in the neural network. It is a convolutional convolution operation in which convolution and quantization are performed collectively so that only the quantized operation result is stored in the buffer, and the weight used in the product-sum operation is stored in the second memory. The first function that realizes the quantization convolution operation by being quantized to 1-bit bit accuracy in advance before being performed, or quantized to 1-bit bit accuracy by the processor after being stored in the second memory. The processor further includes a third memory for storing the data, reads the first function from the third memory, and performs the quantization convolution operation using the read first function.

また、前記プロセッサは、前記量子化された演算結果に対して活性化関数を用いた処理を行ってもよい。前記プロセッサは、前記量子化畳み込み演算に用いるバイアスに対してのビット精度を削減する量子化を行ってもよい。前記多層ニューラルネットワークは、前記プロセッサにより前記量子化畳み込み演算を順次行う複数の畳み込み層を有し、前記プロセッサは、前記複数の畳み込み層のうちの最終層以外の畳み込み層それぞれの出力であってその次の畳み込み層に入力される前記量子化された演算結果を補助記憶装置に記憶させてもよい。Further, the processor may perform processing using the activation function on the quantized calculation result. The processor may perform quantization to reduce bit precision with respect to the bias used in the quantization convolution operation. The multi-layer neural network has a plurality of convolution layers in which the quantization convolution operation is sequentially performed by the processor, and the processor is the output of each of the convolution layers other than the final layer among the plurality of convolution layers. The quantized calculation result input to the next convolution layer may be stored in the auxiliary storage device.

また、前記重みを量子化する第関数を記憶する第メモリをさらに備え、前記プロセッサは、前記第4メモリから前記第関数を読み出し、読み出した前記第2関数を用いて前記重みを量子化してもよい。前記プロセッサは、前記第関数と前記第関数とを交互に読み出して前記複数の畳み込み層それぞれでの前記重みの量子化と前記量子化畳み込み演算とを行ってもよい。 Further, a fourth memory for storing the second function for quantizing the weight is further provided, and the processor reads the second function from the fourth memory and uses the read second function to store the weight. It may be quantized. The processor may alternately read the second function and the first function to perform the quantization of the weight and the quantized convolution operation in each of the plurality of convolution layers.

また、前記ニューラルネットワークは、前処理された画像信号を前記入力信号として記憶するための入力バッファをさらに備え、前記画像信号に施される前処理はモノクロ変換、コントラスト調整、および輝度調整のうち一つを含んでもよい。また、前記重みの量子化はFPGA上で実行されてもよいFurther, the neural network further includes an input buffer for storing the preprocessed image signal as the input signal, and the preprocessing applied to the image signal is one of monochrome conversion, contrast adjustment, and luminance adjustment. May include one. Further, the quantization of the weight may be performed on the FPGA.

上述した課題を解決するために、本発明に係る通信装置は、上記ニューラルネットワーク処理装置を備える通信装置であって、通信ネットワークを介して外部電子機器との通信を行うためのインターフェース回路をさらに備え、前記通信ネットワークを介して、前記外部電子機器から前記量子化畳み込み演算に用いるデータを通信する。また、前記通信ネットワークを介して、前記外部電子機器から予め量子化された前記重みを受信してもよい。また、前記通信ネットワークを介して、前記外部電子機器から前記第1関数を受信してもよい。 In order to solve the above-mentioned problems, the communication device according to the present invention is a communication device including the neural network processing device, and further includes an interface circuit for communicating with an external electronic device via the communication network. , The data used for the quantization convolution operation is communicated from the external electronic device via the communication network. Further, the weights quantized in advance may be received from the external electronic device via the communication network. Further, the first function may be received from the external electronic device via the communication network.

上述した課題を解決するために、本発明に係るニューラルネットワーク処理方法は、多層ニューラルネットワークに与えられる入力信号を第1メモリに記憶する第1ステップと、前記多層ニューラルネットワークの重みを第2メモリに記憶する第2ステップと、プロセッサが、前記第1メモリ及び前記第2メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行う第3ステップと、バッファにより前記畳み込み演算の演算結果であり前記多層ニューラルネットワークでの次の演算に使用される演算結果を記憶する第4ステップと、を備え、前記畳み込み演算は、データのビット精度を削減する量子化が組み込まれた、量子化されていない演算結果ではなく量子化された演算結果のみが前記バッファに記憶されるよう畳み込みと量子化とを一括して行う量子化畳み込み演算であり、前記積和演算に使用される前記重みは、前記第2メモリに記憶される前に予め1ビットのビット精度まで量子化されているか、前記第2メモリに記憶された後に前記プロセッサにより1ビットのビット精度まで量子化され、前記第3ステップでは、前記プロセッサが、前記量子化畳み込み演算を実現する関数を記憶する第3メモリから前記関数を読み出し、読み出した前記関数を用いて前記量子化畳み込み演算を行う、を備えるIn order to solve the above-mentioned problems, the neural network processing method according to the present invention has a first step of storing an input signal given to a multilayer neural network in a first memory and a weight of the multilayer neural network in a second memory. A second step of storage and a third step in which the processor performs a convolution operation of the multilayer neural network including a product-sum operation of the input signal and the weight stored in the first memory and the second memory, respectively. The convolution operation comprises a fourth step of storing the operation result of the convolution operation by the buffer and used for the next operation in the multi-layer neural network, and the convolution operation is a quantum that reduces the bit accuracy of the data. It is a quantized convolution operation that performs convolution and quantization collectively so that only the quantized operation result is stored in the buffer, not the non-quantized operation result with built-in conversion. The weights used in the calculation are either quantized to a bit precision of 1 bit in advance before being stored in the second memory, or stored in the second memory and then stored in the second memory up to a bit precision of 1 bit by the processor. It is quantized, and in the third step, the processor reads the function from a third memory that stores a function that realizes the quantization convolution operation, and performs the quantization convolution operation using the read function. To prepare for .

上述した課題を解決するために、本発明に係るプログラムは、多層ニューラルネットワークに与えられる入力信号を記憶する第1メモリと、前記多層ニューラルネットワークの重みを記憶する第2メモリと、を備えるコンピュータのプロセッサに、前記第1メモリ及び前記第2メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行う演算処理と、前記畳み込み演算の演算結果であり前記多層ニューラルネットワークでの次の演算に使用される演算結果をバッファに記憶させる記憶処理と、を実行させ、前記畳み込み演算は、データのビット精度を削減する量子化が組み込まれた、量子化されていない演算結果ではなく量子化された演算結果のみが前記バッファに記憶されるよう畳み込みと量子化とを一括して行う量子化畳み込み演算であり、前記積和演算に使用される前記重みは、前記第2メモリに記憶される前に予め1ビットのビット精度まで量子化されているか、前記第2メモリに記憶された後に前記プロセッサにより1ビットのビット精度まで量子化され、前記コンピュータは、前記量子化畳み込み演算を実現する関数を記憶する第3メモリをさらに備え、前記演算処理は、前記第3メモリから前記関数を読み出す処理と、読み出した前記関数を用いて前記量子化畳み込み演算を行う処理と、を含む。プログラムは、前記プロセッサに、前記量子化された演算結果に対して活性化関数を用いた処理を実行させてもよい。前記プロセッサに、前記量子化畳み込み演算に用いるバイアスに対してのビット精度を削減する量子化を行う処理を実行させてもよい。前記多層ニューラルネットワークは、前記プロセッサにより前記量子化畳み込み演算を順次行う複数の畳み込み層を有し、前記プロセッサに、前記複数の畳み込み層のうちの最終層以外の畳み込み層それぞれの出力であってその次の畳み込み層に入力される前記量子化された演算結果を補助記憶装置に記憶させる処理を実行させてもよい。 In order to solve the above-mentioned problems, the program according to the present invention is a computer including a first memory for storing an input signal given to a multi-layer neural network and a second memory for storing the weights of the multi-layer neural network. In the arithmetic processing that performs the convolution operation of the multi-layer neural network including the product-sum operation of the input signal and the weight stored in the first memory and the second memory, respectively, in the processor, and the operation result of the convolution operation. Yes The convolution operation incorporates quantization that reduces the bit accuracy of the data, which is to execute a storage process that stores the operation result used for the next operation in the multi-layer neural network in a buffer. It is a quantized convolution operation that performs convolution and quantization collectively so that only the quantized operation result is stored in the buffer, not the operation result that has not been performed, and the weight used in the product-sum operation is The computer is either quantized to a bit precision of 1 bit in advance before being stored in the second memory, or is quantized to a bit precision of 1 bit by the processor after being stored in the second memory. A third memory for storing a function for realizing the quantization convolution operation is further provided, and the calculation process performs a process of reading the function from the third memory and a process of reading the function to perform the quantization convolution operation. Processing and including. The program may cause the processor to execute a process using the activation function on the quantized operation result. The processor may be made to perform a process of performing quantization that reduces bit accuracy with respect to the bias used in the quantization convolution operation. The multi-layer neural network has a plurality of convolution layers in which the quantization convolution operation is sequentially performed by the processor, and the output of each of the convolution layers other than the final layer among the plurality of convolution layers is output to the processor. The process of storing the quantized calculation result input to the next convolution layer in the auxiliary storage device may be executed.

本発明によれば、ニューラルネットワークの処理速度の低下を抑制することができる。 According to the present invention, it is possible to suppress a decrease in the processing speed of the neural network.

図1は、本発明の第1の実施の形態に係るCNN処理装置の機能を説明するブロック図である。FIG. 1 is a block diagram illustrating a function of the CNN processing apparatus according to the first embodiment of the present invention. 図2は、第1の実施の形態に係るCNN処理装置のハードウェア構成を示すブロック図である。FIG. 2 is a block diagram showing a hardware configuration of the CNN processing apparatus according to the first embodiment. 図3は、第1の実施の形態に係るCNN処理方法のフローを説明するための図である。FIG. 3 is a diagram for explaining the flow of the CNN processing method according to the first embodiment. 図4は、第1の実施の形態に係るCNN処理方法を説明するための図である。FIG. 4 is a diagram for explaining the CNN processing method according to the first embodiment. 図5は、第2の実施の形態に係るCNN処理装置の機能を説明するブロック図である。FIG. 5 is a block diagram illustrating the function of the CNN processing apparatus according to the second embodiment. 図6は、第2の実施の形態に係るCNN処理方法のフローを説明するための図である。FIG. 6 is a diagram for explaining the flow of the CNN processing method according to the second embodiment. 図7は、第2の実施の形態に係るCNN処理方法を説明するための図である。FIG. 7 is a diagram for explaining the CNN processing method according to the second embodiment. 図8は、第3の実施の形態に係るCNN処理装置の機能を説明するブロック図である。FIG. 8 is a block diagram illustrating the function of the CNN processing apparatus according to the third embodiment. 図9は、第3の実施の形態に係るCNN処理方法のフローを説明するための図である。FIG. 9 is a diagram for explaining the flow of the CNN processing method according to the third embodiment. 図10は、第3の実施の形態に係るCNN処理方法を説明するための図である。FIG. 10 is a diagram for explaining the CNN processing method according to the third embodiment. 図11は、従来のCNNの演算処理を説明するための図である。FIG. 11 is a diagram for explaining a conventional CNN arithmetic process.

以下、本発明の好適な実施の形態について、図1から図10を参照して詳細に説明する。なお、以下においては、「ニューラルネットワーク」としてCNNを用いる場合を例に挙げて説明する。
[第1の実施の形態]
まず、本発明の第1の実施の形態に係るCNN処理装置(ニューラルネットワーク処理装置)1の構成を説明する。図1は、CNN処理装置1の機能構成を示すブロック図である。
Hereinafter, preferred embodiments of the present invention will be described in detail with reference to FIGS. 1 to 10. In the following, a case where CNN is used as the "neural network" will be described as an example.
[First Embodiment]
First, the configuration of the CNN processing device (neural network processing device) 1 according to the first embodiment of the present invention will be described. FIG. 1 is a block diagram showing a functional configuration of the CNN processing device 1.

本実施の形態に係るCNN処理装置1は、CNNに与えられる入力信号とCNNの重みとの積和演算を行って演算結果を出力する演算処理装置である。この演算処理は、CNNの中間層を構成する畳み込み層の積和演算(以下、「畳み込み演算」ということがある。)を含む。CNN処理装置1が畳み込み演算を行った演算結果は、ReLUなどの活性化関数にかけられて、1層分の畳み込み層の出力が得られる。以下においては、説明の簡単のため、畳み込み層の積和演算の結果、すなわち畳み込み演算の結果が次の畳み込み層の入力信号として用いられるものとする。CNN処理装置1は、入力信号と重みとの積和演算を繰り返し行って、予め設定されているCNNモデルが有する畳み込み層の数に応じた回数の積和演算を実行する。 The CNN processing device 1 according to the present embodiment is a calculation processing device that performs a product-sum calculation of an input signal given to a CNN and a weight of a CNN and outputs a calculation result. This arithmetic processing includes a product-sum operation of convolutional layers constituting the intermediate layer of the CNN (hereinafter, may be referred to as “convolutional arithmetic”). The calculation result obtained by the CNN processing device 1 performing the convolutional operation is applied to an activation function such as ReLU to obtain an output of one convolutional layer. In the following, for the sake of simplicity, it is assumed that the result of the product-sum operation of the convolution layer, that is, the result of the convolution operation is used as the input signal of the next convolution layer. The CNN processing device 1 repeatedly performs a product-sum calculation of the input signal and the weight, and executes a product-sum calculation a number of times according to the number of convolutional layers possessed by the preset CNN model.

[CNN処理装置の機能ブロック]
上述したCNN処理装置1は、入力バッファ(第1メモリ)10、重みバッファ(第2メモリ)11、畳み込み演算部12、演算結果バッファ13、量子化処理部14、出力バッファ15、および記憶部16を備える。
[Functional block of CNN processing device]
The CNN processing device 1 described above includes an input buffer (first memory) 10, a weight buffer (second memory) 11, a convolution calculation unit 12, a calculation result buffer 13, a quantization processing unit 14, an output buffer 15, and a storage unit 16. To prepare for.

入力バッファ10は、CNNに与えられる入力信号を記憶する。より詳細には、入力バッファ10には、例えば、外部から与えられた画像データなどの入力信号が記憶される。また、入力バッファ10は、画像データなどの入力信号を量子化処理部14に出力する。入力バッファ10に供給される入力信号は、予め前処理を行った画像データであってもよい。前処理の例としては、モノクロ変換、コントラスト調整、および輝度調整などが挙げられる。また、入力信号は、CNN処理装置1において予め設定されているCNNモデルに応じて設定されたビット深度となるように縮小されていてもよい。入力バッファ10に供給される入力信号の値としては、例えば、32ビットや16ビット精度の浮動小数点の配列で表現された小数点を含む値などが用いられる。 The input buffer 10 stores an input signal given to the CNN. More specifically, the input buffer 10 stores, for example, an input signal such as image data given from the outside. Further, the input buffer 10 outputs an input signal such as image data to the quantization processing unit 14. The input signal supplied to the input buffer 10 may be image data that has been preprocessed in advance. Examples of preprocessing include monochrome conversion, contrast adjustment, and luminance adjustment. Further, the input signal may be reduced to a bit depth set according to the CNN model preset in the CNN processing device 1. As the value of the input signal supplied to the input buffer 10, for example, a value including a decimal point represented by a 32-bit or 16-bit precision floating-point array is used.

重みバッファ11は、CNNの重みを記憶する。より詳細には、重みバッファ11には、CNN処理装置1の外部に設置されたサーバ(図示しない)や記憶部16などに予め記憶されているCNNの重みパラメータがロードされる。本実施の形態では、重みの値として、32ビットや16ビット精度の浮動小数点の配列で表現された小数点を含む値などが用いられる。重みバッファ11は、バッファリングした重みを、後述の量子化処理部14に出力する。 The weight buffer 11 stores the weight of the CNN. More specifically, the weight buffer 11 is loaded with CNN weight parameters stored in advance in a server (not shown) installed outside the CNN processing device 1, a storage unit 16, or the like. In the present embodiment, as the weight value, a value including a decimal point represented by a 32-bit or 16-bit precision floating-point array is used. The weight buffer 11 outputs the buffered weight to the quantization processing unit 14 described later.

畳み込み演算部12は、入力バッファ10に記憶されている入力信号と、重みバッファ11に記憶されている重みとの積和演算を含むCNNの畳み込み演算を行う(第1処理)。より詳細には、畳み込み演算部12は、CNN処理装置1において予め設定されているCNNモデルを構成する畳み込み層の積和演算を行う。本実施の形態では、畳み込み演算部12は、後述の量子化処理部14によって量子化された入力信号および重みの値に基づいて、畳み込み演算を行う。畳み込み演算部12が出力する演算結果は、演算結果バッファ13に供給される。 The convolution calculation unit 12 performs a CNN convolution operation including a product-sum operation of an input signal stored in the input buffer 10 and a weight stored in the weight buffer 11 (first process). More specifically, the convolutional calculation unit 12 performs a product-sum calculation of the convolutional layers constituting the CNN model preset in the CNN processing device 1. In the present embodiment, the convolution calculation unit 12 performs the convolution calculation based on the input signal and the weight value quantized by the quantization processing unit 14 described later. The calculation result output by the convolution calculation unit 12 is supplied to the calculation result buffer 13.

演算結果バッファ13は、畳み込み演算部12による畳み込み演算の結果をバッファリングし、その演算結果を量子化処理部14に供給する。 The calculation result buffer 13 buffers the result of the convolution operation by the convolution calculation unit 12, and supplies the calculation result to the quantization processing unit 14.

量子化処理部14は、畳み込み演算の処理(第1処理)で用いられるデータの少なくとも一部のビット精度を削減する量子化を行う(第2処理)。より詳細には、量子化処理部14は、入力信号、重み、および畳み込み演算の演算結果の少なくとも一部のデータを量子化する。本実施の形態では、量子化処理部14は、入力信号、重み、および畳み込み演算の演算結果の全てのデータについて量子化処理を行う。 The quantization processing unit 14 performs quantization that reduces the bit precision of at least a part of the data used in the convolution operation processing (first processing) (second processing). More specifically, the quantization processing unit 14 quantizes at least a part of the data of the input signal, the weight, and the operation result of the convolution operation. In the present embodiment, the quantization processing unit 14 performs the quantization processing on all the data of the input signal, the weight, and the calculation result of the convolution operation.

具体的には、量子化処理部14は、入力バッファ10から読み出した入力信号の量子化、重みバッファ11から読み出した重みの量子化、および演算結果バッファ13から読み出した畳み込み演算の結果の量子化を行う。さらに、量子化処理部14は、入力バッファ10、重みバッファ11、および演算結果バッファ13にそれぞれ記憶されている入力信号、重み、および演算結果を、量子化された入力信号、重み、および演算結果の値に更新する。 Specifically, the quantization processing unit 14 quantizes the input signal read from the input buffer 10, quantizes the weight read from the weight buffer 11, and quantizes the result of the convolution operation read from the calculation result buffer 13. I do. Further, the quantization processing unit 14 converts the input signal, the weight, and the calculation result stored in the input buffer 10, the weight buffer 11, and the calculation result buffer 13, respectively, into the quantized input signal, the weight, and the calculation result. Update to the value of.

量子化処理部14が実行する量子化処理は、例えば、四捨五入、切り上げ、切り捨て、最近接丸めなどよく知られた端数処理を含み、入力信号、重み、および畳み込み演算の演算結果のそれぞれの値に対して、小数点を含む値を整数化するなどの制限をかける。量子化処理に伴う処理速度の向上と処理結果の精度とは、互いににトレードオフの関係となる。量子化処理部14が行う各値の量子化は、例えば、8ビットや16ビットなどCNN処理装置1が備えるプロセッサ102が一度に扱えるビット数に応じたビット数へ削減することによって処理速度と精度の両立を図ることができる。例えば、FPGAであれば、各値を1ビットに削減すればよい。なお、量子化処理部14は、CNN処理装置1が扱うCNNを構成する、多段に接続された複数の畳み込み層のうち、一部の畳み込み層のみに用いてもよい。 The quantization process performed by the quantization processing unit 14 includes well-known rounding processes such as rounding, rounding up, rounding down, and nearest rounding, and is used for each value of the input signal, weight, and convolution operation result. On the other hand, restrictions such as converting values including decimal points into integers are applied. The improvement in processing speed associated with the quantization process and the accuracy of the processing result are in a trade-off relationship with each other. The quantization of each value performed by the quantization processing unit 14 is processing speed and accuracy by reducing the number of bits according to the number of bits that can be handled by the processor 102 included in the CNN processing device 1 such as 8 bits and 16 bits at one time. Can be achieved at the same time. For example, in the case of FPGA, each value may be reduced to 1 bit. The quantization processing unit 14 may be used only for a part of the plurality of convolutional layers connected in multiple stages constituting the CNN handled by the CNN processing apparatus 1.

出力バッファ15は、量子化処理部14によって量子化された畳み込み演算の結果を一時的に記憶する。 The output buffer 15 temporarily stores the result of the convolution operation quantized by the quantization processing unit 14.

記憶部16は、出力バッファ15に一時的に記憶されている量子化された畳み込み演算の結果を格納する。記憶部16に記憶される畳み込み演算の結果が、本実施の形態におけるCNNの畳み込み層の出力値、かつ、次の畳み込み層の入力値として記憶される。また、記憶部16は、量子化処理部14が入力信号、重み、および畳み込み演算の結果の値をそれぞれ量子化する際に用いる端数処理の方法を示す情報を予め記憶している。 The storage unit 16 stores the result of the quantized convolution operation temporarily stored in the output buffer 15. The result of the convolution operation stored in the storage unit 16 is stored as the output value of the convolution layer of the CNN in the present embodiment and the input value of the next convolution layer. Further, the storage unit 16 stores in advance information indicating a rounding method used by the quantization processing unit 14 to quantize the input signal, the weight, and the value as a result of the convolution operation.

[CNN処理装置のハードウェア構成]
次に、上述した機能を有するCNN処理装置1のハードウェア構成の例について図2のブロック図を用いて説明する。
[Hardware configuration of CNN processing device]
Next, an example of the hardware configuration of the CNN processing device 1 having the above-mentioned functions will be described with reference to the block diagram of FIG.

図2に示すように、CNN処理装置1は、例えば、バス101を介して接続されるプロセッサ102、主記憶装置103、通信インターフェース104、補助記憶装置105、入出力装置106を備えるコンピュータと、これらのハードウェア資源を制御するプログラムによって実現することができる。 As shown in FIG. 2, the CNN processing device 1 includes, for example, a computer including a processor 102, a main storage device 103, a communication interface 104, an auxiliary storage device 105, and an input / output device 106 connected via a bus 101, and these. It can be realized by a program that controls the hardware resources of.

主記憶装置103には、プロセッサ102が各種制御や演算を行うためのプログラムが予め格納されている。プロセッサ102と主記憶装置103とによって、図1に示した畳み込み演算部12および量子化処理部14を含むCNN処理装置1の各機能が実現される。 The main storage device 103 stores in advance a program for the processor 102 to perform various controls and operations. The processor 102 and the main storage device 103 realize each function of the CNN processing device 1 including the convolution calculation unit 12 and the quantization processing unit 14 shown in FIG.

主記憶装置103によって、図1で説明した入力バッファ10、重みバッファ11、演算結果バッファ13、および出力バッファ15が実現される。 The main storage device 103 realizes the input buffer 10, the weight buffer 11, the calculation result buffer 13, and the output buffer 15 described with reference to FIG.

通信インターフェース104は、通信ネットワークNWを介して各種外部電子機器との通信を行うためのインターフェース回路である。通信インターフェース104を介して、CNN処理装置1が用いる画像データなどの入力信号や、重みを、外部のサーバなどから受信してもよい。 The communication interface 104 is an interface circuit for communicating with various external electronic devices via the communication network NW. Input signals such as image data used by the CNN processing device 1 and weights may be received from an external server or the like via the communication interface 104.

補助記憶装置105は、読み書き可能な記憶媒体と、その記憶媒体に対してプログラムやデータなどの各種情報を読み書きするための駆動装置とで構成されている。補助記憶装置105には、記憶媒体としてハードディスクやフラッシュメモリなどの半導体メモリを使用することができる。 The auxiliary storage device 105 is composed of a readable / writable storage medium and a drive device for reading / writing various information such as programs and data to the storage medium. A semiconductor memory such as a hard disk or a flash memory can be used as the storage medium in the auxiliary storage device 105.

補助記憶装置105は、外部から取得された入力データや重みを記憶する記憶領域や、CNN処理装置1が畳み込み演算などのCNNの演算処理を行うためのプログラムを格納するプログラム格納領域を有する。補助記憶装置105によって、図1で説明した記憶部16が実現される。さらには、例えば、上述したデータやプログラムやなどをバックアップするためのバックアップ領域などを有していてもよい。 The auxiliary storage device 105 has a storage area for storing input data and weights acquired from the outside, and a program storage area for storing a program for the CNN processing device 1 to perform CNN arithmetic processing such as a convolution operation. The auxiliary storage device 105 realizes the storage unit 16 described with reference to FIG. Further, for example, it may have a backup area for backing up the above-mentioned data, programs, and the like.

入出力装置106は、外部機器からの信号を入力したり、外部機器へ信号を出力したりするI/O端子により構成される。入出力装置106を介して、図示しない表示装置などを備えて、CNN処理装置1によって出力される演算結果を表示してもよい。 The input / output device 106 is composed of an I / O terminal that inputs a signal from an external device and outputs a signal to the external device. A display device (not shown) may be provided via the input / output device 106 to display the calculation result output by the CNN processing device 1.

ここで、補助記憶装置105のプログラム格納領域に格納されているプログラムは、本明細書で説明するCNN処理方法の順序に沿って時系列に処理が行われるプログラムであってもよく、並列に、あるいは呼び出しが行われたときなどの必要なタイミングで処理が行われるプログラムであってもよい。また、プログラムは、1つのコンピュータにより処理されるものでもよく、複数のコンピュータによって分散処理されるものであってもよい。 Here, the program stored in the program storage area of the auxiliary storage device 105 may be a program in which processing is performed in chronological order according to the order of the CNN processing method described in the present specification, and in parallel, Alternatively, it may be a program in which processing is performed at a required timing such as when a call is made. Further, the program may be processed by one computer or may be distributed processed by a plurality of computers.

[CNN処理方法]
次に、上述した構成を有するCNN処理装置1の動作について図3および図4を参照して説明する。まず、入力バッファ10および重みバッファ11は、CNN処理装置1の外部に設置されたサーバなどから与えられた入力信号Aおよび重みUをそれぞれ一時的に記憶する(ステップS1、ステップS3)。
[CNN processing method]
Next, the operation of the CNN processing apparatus 1 having the above-described configuration will be described with reference to FIGS. 3 and 4. First, the input buffer 10 and the weight buffer 11 temporarily store the input signal A and the weight U given from the server installed outside the CNN processing device 1, respectively (steps S1 and S3).

図4に示すように、入力バッファ10には、入力信号Aが記憶されている。入力信号Aは、ベクトル化された入力画像データであり、縦方向と横方向の次元を持つ。入力信号Aの値は、小数点を含む値で表現される。図4の太線で示す四角形はフィルタを表している。また、重みバッファ11には、重みUが記憶されている。重みUは、行列で表されるカーネルの要素であり、CNNの学習によって調整および更新されて最終的に決定されるパラメータである。重みUの値についても、縦方向と横方向の次元を持ち、各要素は小数点を含む値で表現される。 As shown in FIG. 4, the input signal A is stored in the input buffer 10. The input signal A is vectorized input image data and has vertical and horizontal dimensions. The value of the input signal A is represented by a value including a decimal point. The rectangle shown by the thick line in FIG. 4 represents the filter. Further, the weight U is stored in the weight buffer 11. The weight U is an element of the kernel represented by a matrix and is a parameter that is adjusted and updated by the learning of CNN and finally determined. The value of the weight U also has vertical and horizontal dimensions, and each element is represented by a value including a decimal point.

次に、量子化処理部14は、入力バッファ10から入力信号Aを読み出して各要素の値を量子化する(ステップS2)。また、量子化処理部14は、重みバッファ11から重みUを読み出して各要素の値を量子化する(ステップS4)。 Next, the quantization processing unit 14 reads the input signal A from the input buffer 10 and quantizes the value of each element (step S2). Further, the quantization processing unit 14 reads the weight U from the weight buffer 11 and quantizes the value of each element (step S4).

より具体的には、図4に示すように、小数点を含む入力信号Aの値は、量子化処理部14によって、例えば、四捨五入される。量子化処理部14は、入力バッファ10の入力信号Aの値を、量子化された入力信号A’の値で更新する。 More specifically, as shown in FIG. 4, the value of the input signal A including the decimal point is rounded off, for example, by the quantization processing unit 14. The quantization processing unit 14 updates the value of the input signal A of the input buffer 10 with the value of the quantized input signal A'.

また、図4に示すように、小数点を含む重みUの値は、量子化処理部14によって、例えば、四捨五入される。量子化処理部14は、重みバッファ11の重みUの値を、量子化された重みU’の値で更新する。 Further, as shown in FIG. 4, the value of the weight U including the decimal point is rounded off, for example, by the quantization processing unit 14. The quantization processing unit 14 updates the value of the weight U of the weight buffer 11 with the value of the quantized weight U'.

図3に戻り、畳み込み演算部12は、入力バッファ10および重みバッファ11からそれぞれ量子化された入力信号A’および量子化された重みU’を読み出して、畳み込み演算を行う(ステップS5)。より詳細には、畳み込み演算部12は、量子化された入力信号A’のベクトルと量子化された重みU’の行列を乗算する。 Returning to FIG. 3, the convolution calculation unit 12 reads the quantized input signal A'and the quantized weight U'from the input buffer 10 and the weight buffer 11, respectively, and performs the convolution calculation (step S5). More specifically, the convolution unit 12 multiplies the vector of the quantized input signal A'and the matrix of the quantized weight U'.

具体的には、図4に示すように、CNNのフィルタのウィンドウ(図4の例では、2×2で示す太線の四角)を所定のストライドでスライドさせる。畳み込み演算部12は、フィルタのそれぞれの場所で、量子化された重みU’の要素と、量子化された入力信号A’の対応する要素とを乗算し、その和を求める。 Specifically, as shown in FIG. 4, the CNN filter window (in the example of FIG. 4, the thick line square shown by 2 × 2) is slid with a predetermined stride. The convolution unit 12 multiplies the element of the quantized weight U'and the corresponding element of the quantized input signal A'at each location of the filter and obtains the sum.

畳み込み演算部12は、この積和演算による畳み込み演算の演算結果Bを演算結果バッファ13の対応する場所に格納する(ステップS6)。具体的には、図4に示すように、演算結果バッファ13には、小数点を含まない積和の結果「37」が格納されている。 The convolution calculation unit 12 stores the calculation result B of the convolution calculation by the product-sum calculation in the corresponding location of the calculation result buffer 13 (step S6). Specifically, as shown in FIG. 4, the operation result buffer 13 stores the product-sum result “37” not including the decimal point.

その後、量子化処理部14は、演算結果バッファ13からステップS5で得られた畳み込み演算の演算結果を読み出して、量子化処理を行う(ステップS7)。具体的には、図4に示すように、量子化処理部14は、畳み込み演算の演算結果「37」を、例えば、四捨五入して、「40」に量子化する。量子化処理部14は、演算結果バッファ13のデータを、量子化した演算結果B’で更新する。 After that, the quantization processing unit 14 reads the calculation result of the convolution operation obtained in step S5 from the calculation result buffer 13 and performs the quantization process (step S7). Specifically, as shown in FIG. 4, the quantization processing unit 14 rounds off the operation result “37” of the convolution operation, for example, and quantizes it into “40”. The quantization processing unit 14 updates the data in the calculation result buffer 13 with the quantized calculation result B'.

次に、CNN処理装置1のプロセッサ102は、演算結果バッファ13から量子化された畳み込み演算の演算結果B’を読み出し、ReLUなどの活性化関数を適用する(ステップS8)。具体的には、プロセッサ102は、演算結果B’が負の値である場合には、ReLU関数を通して0を出力し、正の演算結果B’はそのままの値を出力する。 Next, the processor 102 of the CNN processing device 1 reads the operation result B'of the convolution operation quantized from the operation result buffer 13 and applies an activation function such as ReLU (step S8). Specifically, when the calculation result B'is a negative value, the processor 102 outputs 0 through the ReLU function, and the positive calculation result B'outputs the value as it is.

次に、プロセッサ102は、ステップS8で出力された値に対してよく知られたプーリング処理を行い、畳み込み演算の結果を圧縮する(ステップS9)。なお、ステップS9のプーリング処理は必要に応じて行えばよい。また、プロセッサ102は、ステップS8で得られた活性化関数(ReLU)の出力に対して、正規化を行ってもよい(非特許文献1参照)。 Next, the processor 102 performs a well-known pooling process on the value output in step S8, and compresses the result of the convolution operation (step S9). The pooling process in step S9 may be performed as needed. Further, the processor 102 may perform normalization on the output of the activation function (ReLU) obtained in step S8 (see Non-Patent Document 1).

プーリング処理された量子化された演算結果B’は、出力バッファ15に蓄えられて、プロセッサ102により読み出されて出力される(ステップS10)。なお、出力された値は、CNNの特徴抽出部の出力として、後続の図示しない分類器を構成する全結合層に入力され、入力信号Aの画像データを判別する。 The pooled quantized calculation result B'is stored in the output buffer 15, read out by the processor 102, and output (step S10). The output value is input to the fully coupled layer constituting the subsequent classifier (not shown) as the output of the feature extraction unit of the CNN, and the image data of the input signal A is discriminated.

以上説明したように、第1の実施の形態に係るCNN処理装置1によれば、CNNの入力信号、重み、および畳み込み演算の演算結果を量子化するので、組み込み用のハードウェアを使用した場合であってもCNNの処理速度の低下を抑制することができる。 As described above, according to the CNN processing device 1 according to the first embodiment, the input signal of the CNN, the weight, and the calculation result of the convolution operation are quantized. Therefore, when the embedded hardware is used. Even so, it is possible to suppress a decrease in the processing speed of CNN.

また、CNN処理装置1によれば、特に、畳み込み演算の演算結果についても量子化するので、多数の層からなるCNN全体の計算負荷を低減することができ、信号処理の高速化が可能となる。 Further, according to the CNN processing device 1, in particular, since the calculation result of the convolution operation is also quantized, the calculation load of the entire CNN composed of a large number of layers can be reduced, and the signal processing can be speeded up. ..

なお、説明した実施の形態では、積和演算の説明において、説明の簡単のため、バイアスの加算を省略した。しかし、入力信号のベクトルと、重み行列とを乗算し、その後加算されるバイアスの値についても同様に量子化してもよい。 In the embodiment described, the addition of the bias is omitted in the description of the multiply-accumulate operation for the sake of simplicity. However, the vector of the input signal may be multiplied by the weight matrix, and the bias value added thereafter may be quantized in the same manner.

また、説明した実施の形態では、量子化処理部14が、入力信号、重み、および畳み込み演算の演算結果の全てのデータを量子化する場合について説明した。しかし、量子化処理部14は、入力信号、重み、および畳み込み演算の演算結果のいずれか1つまたは2つに含まれるデータの量子化を行う構成としてもよい。 Further, in the described embodiment, the case where the quantization processing unit 14 quantizes all the data of the input signal, the weight, and the operation result of the convolution operation has been described. However, the quantization processing unit 14 may be configured to quantize the data contained in any one or two of the input signal, the weight, and the calculation result of the convolution operation.

[第2の実施の形態]
次に、本発明の第2の実施の形態について説明する。なお、以下の説明では、上述した第1の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
[Second Embodiment]
Next, a second embodiment of the present invention will be described. In the following description, the same reference numerals will be given to the same configurations as those of the first embodiment described above, and the description thereof will be omitted.

第1の実施の形態では、量子化処理部14がCNNにおける入力信号A、重みU、および畳み込み演算の演算結果Bについてそれぞれ量子化処理を行う場合について説明した。これに対し、第2の実施の形態に係るCNN処理装置1Aでは、予め量子化された重みU’を用いる。また、CNN処理装置1Aは、量子化処理が組み込まれた畳み込み演算を行う量子化畳み込み演算部12Aを備える。 In the first embodiment, the case where the quantization processing unit 14 performs the quantization processing on the input signal A, the weight U, and the operation result B of the convolution operation in the CNN has been described. On the other hand, in the CNN processing apparatus 1A according to the second embodiment, the weight U'quantized in advance is used. Further, the CNN processing apparatus 1A includes a quantized convolution calculation unit 12A that performs a convolution calculation incorporating a quantization process.

[CNN処理装置の機能ブロック]
図5は、第2の実施の形態に係るCNN処理装置1Aの機能構成を示すブロック図である。CNN処理装置1Aは、入力バッファ10、量子化重みバッファ(第2メモリ)11A、量子化畳み込み演算部12A、演算結果バッファ13、出力バッファ15、および記憶部16を備える。以下、第1の実施の形態と異なる構成を中心に説明する。
[Functional block of CNN processing device]
FIG. 5 is a block diagram showing a functional configuration of the CNN processing device 1A according to the second embodiment. The CNN processing device 1A includes an input buffer 10, a quantization weight buffer (second memory) 11A, a quantization convolution calculation unit 12A, a calculation result buffer 13, an output buffer 15, and a storage unit 16. Hereinafter, a configuration different from that of the first embodiment will be mainly described.

量子化重みバッファ11Aは、予め重みが量子化された重み(量子化重み)を記憶する。量子化重みバッファ11Aは、例えば、CNN処理装置1Aの外部に設置されているサーバ(図示しない)などから取得された、予め量子化された重みを一時的に記憶する。例えば、CNN処理装置1Aは、学習済みのCNNの重みを予め外部に設置されたサーバなどから通信ネットワークNWを介して取得し、記憶部16に予め格納しておいてもよい。この場合、量子化重みバッファ11Aは、記憶部16から量子化された重みを読み出して一時的に蓄える。ここで、量子化された重みは、第1の実施の形態と同様に、CNN処理装置1Aの処理能力に応じたビット精度に削減された重みであり、例えば、小数点を含む重みが整数化されたものが含まれる。 The quantization weight buffer 11A stores the weight (quantization weight) in which the weight is quantized in advance. The quantized weight buffer 11A temporarily stores pre-quantized weights acquired from, for example, a server (not shown) installed outside the CNN processing device 1A. For example, the CNN processing device 1A may acquire the learned weight of the CNN from a server or the like installed outside in advance via the communication network NW and store it in the storage unit 16 in advance. In this case, the quantized weight buffer 11A reads the quantized weight from the storage unit 16 and temporarily stores it. Here, the quantized weight is a weight reduced to a bit accuracy according to the processing capacity of the CNN processing device 1A, as in the first embodiment, and for example, the weight including the decimal point is converted into an integer. Is included.

量子化畳み込み演算部12Aは、入力信号および量子化された重みを、入力バッファ10および量子化重みバッファ11Aからそれぞれ読み出し、畳み込み演算を行う。より詳には、量子化畳み込み演算部12Aは、畳み込み演算を行う際に、信号の量子化処理も行う。例えば、量子化畳み込み演算部12Aは、畳み込み演算の演算結果の桁数を予め整数に制限しておく処理や、演算結果の桁数に制限がある場合には、計算前にビットシフトを行う演算を畳み込み演算を実行する際に実施する。量子化畳み込み演算部12Aによる演算結果は、演算結果バッファ13に一時的に記憶される。 The quantized convolution calculation unit 12A reads the input signal and the quantized weight from the input buffer 10 and the quantized weight buffer 11A, respectively, and performs the convolution calculation. More specifically, the quantized convolution calculation unit 12A also performs signal quantization processing when performing the convolution calculation. For example, the quantization convolution calculation unit 12A performs a process of limiting the number of digits of the calculation result of the convolution operation to an integer in advance, or a calculation of performing a bit shift before the calculation when the number of digits of the calculation result is limited. Is executed when executing the convolution operation. The calculation result by the quantized convolution calculation unit 12A is temporarily stored in the calculation result buffer 13.

[CNN処理方法]
次に、上述した構成を有するCNN処理装置1Aの動作について、図6および図7を参照して説明する。まず、外部のサーバなどで量子化された重みU’がCNN処理装置1において通信ネットワークNWを介して取得され、量子化された重みU’が記憶部16に記憶されているものとする。
[CNN processing method]
Next, the operation of the CNN processing apparatus 1A having the above-described configuration will be described with reference to FIGS. 6 and 7. First, it is assumed that the weight U'quantized by an external server or the like is acquired in the CNN processing device 1 via the communication network NW, and the quantized weight U'is stored in the storage unit 16.

まず、入力バッファ10は、CNN処理装置1の外部に設置されたサーバなどから取得された入力信号Aを一時的に記憶する(ステップS20)。また、量子化重みバッファ11Aは、記憶部16から予め量子化された重みU’を読み出して一時的に記憶する(ステップS21)。 First, the input buffer 10 temporarily stores the input signal A acquired from a server or the like installed outside the CNN processing device 1 (step S20). Further, the quantized weight buffer 11A reads the pre-quantized weight U'from the storage unit 16 and temporarily stores it (step S21).

図7に示すように、入力バッファ10には、入力信号Aが記憶されている。入力信号Aは、ベクトル化された入力画像データであり、縦方向と横方向の次元を持つ。入力信号Aの値は、小数点を含む値で表現される。図7の太線で示す四角形はフィルタを表している。また、量子化重みバッファ11Aには、量子化された重みU’が記憶されている。重みUは、行列で表されるカーネルの要素であり、CNNの学習によって調整および更新されて最終的に決定されるパラメータである。量子化された重みU’は、小数点の値を含む各要素からなる重みUを、例えば、整数化してビット数を削減して表した重みである。量子化された重みU’についても、重みUと同様に縦方向と横方向の次元を持つ。 As shown in FIG. 7, the input signal A is stored in the input buffer 10. The input signal A is vectorized input image data and has vertical and horizontal dimensions. The value of the input signal A is represented by a value including a decimal point. The rectangle shown by the thick line in FIG. 7 represents the filter. Further, the quantized weight U'is stored in the quantized weight buffer 11A. The weight U is an element of the kernel represented by a matrix and is a parameter that is adjusted and updated by the learning of CNN and finally determined. The quantized weight U'is a weight expressed by converting the weight U composed of each element including the value of the decimal point into an integer, for example, and reducing the number of bits. The quantized weight U'has vertical and horizontal dimensions as well as the weight U.

次に、量子化畳み込み演算部12Aは、入力バッファ10から入力信号Aを、量子化重みバッファ11Aから量子化された重みU’を読み出して量子化処理が組み込まれた畳み込み演算を行う(ステップS22)。例えば、量子化畳み込み演算部12Aは、畳み込み演算の演算結果の桁数を整数に制限しておく処理を行う。また、例えば、量子化畳み込み演算部12Aは、畳み込み演算を行う前に、入力信号Aや量子化された重みU’に対して予めビットシフトを行いデータの桁数に対する処理を行う。 Next, the quantized convolution calculation unit 12A reads the input signal A from the input buffer 10 and the quantized weight U'from the quantization weight buffer 11A, and performs a convolution operation incorporating the quantization process (step S22). ). For example, the quantized convolution calculation unit 12A performs a process of limiting the number of digits of the calculation result of the convolution calculation to an integer. Further, for example, the quantized convolution calculation unit 12A performs a bit shift on the input signal A and the quantized weight U'in advance to perform processing on the number of digits of the data before performing the convolution calculation.

より具体的には、図7の例に示すように、量子化畳み込み演算部12Aは、畳み込み演算の際に、小数点以下を切り捨てる処理を行う(C=floor(conv(A,U’))。また、量子化畳み込み演算部12Aは、フィルタのそれぞれの場所で、量子化された重みU’の要素と、入力信号Aの対応する要素とを乗算し、その和を求める。量子化畳み込み演算部12Aによる量子化された畳み込み演算の演算結果Cは、演算結果バッファ13に蓄えられる(ステップS23)。 More specifically, as shown in the example of FIG. 7, the quantized convolution calculation unit 12A performs a process of truncating the decimal point at the time of the convolution calculation (C = floor (conv (A, U')). Further, the quantized convolution unit 12A multiplies the element of the quantized weight U'and the corresponding element of the input signal A at each location of the filter, and obtains the sum thereof. The operation result C of the quantized convolution operation by 12A is stored in the operation result buffer 13 (step S23).

その後、CNN処理装置1Aのプロセッサ102は、演算結果バッファ13から量子化された畳み込み演算の演算結果Cを読み出し、ReLUなどの活性化関数を適用する(ステップS24)。具体的には、プロセッサ102は、演算結果Cが負の値である場合には、ReLU関数を通して0を出力し、正の演算結果Cはそのままの値を出力する。 After that, the processor 102 of the CNN processing device 1A reads the operation result C of the convolution operation quantized from the operation result buffer 13 and applies an activation function such as ReLU (step S24). Specifically, when the calculation result C is a negative value, the processor 102 outputs 0 through the ReLU function, and the positive calculation result C outputs the value as it is.

次に、プロセッサ102は、ステップS24で出力された値に対してよく知られたプーリング処理を行い、畳み込み演算の結果を圧縮する(ステップS25)。なお、ステップS25のプーリング処理は必要に応じて行えばよい。また、プロセッサ102は、ステップS24で得られた活性化関数(ReLU)の出力に対して、正規化を行ってもよい(非特許文献1参照)。 Next, the processor 102 performs a well-known pooling process on the value output in step S24, and compresses the result of the convolution operation (step S25). The pooling process in step S25 may be performed as needed. Further, the processor 102 may perform normalization on the output of the activation function (ReLU) obtained in step S24 (see Non-Patent Document 1).

プーリングされた量子化畳み込み演算の演算結果Cは、出力バッファ15に蓄えられて、さらに、プロセッサ102により読み出されて外部に出力される(ステップS26)。なお、出力された値は、CNNの特徴抽出部の出力として、後続の図示しない分類器を構成する全結合層に入力されて入力信号Aの画像データを判別する。 The operation result C of the pooled quantized convolution operation is stored in the output buffer 15, further read by the processor 102, and output to the outside (step S26). The output value is input to the fully coupled layer constituting the subsequent classifier (not shown) as the output of the feature extraction unit of the CNN, and the image data of the input signal A is discriminated.

以上説明したように、第2の実施の形態に係るCNN処理装置1Aによれば、予め量子化された重みを用いることで、CNNの畳み込み演算における演算処理を削減することができる。また、CNN処理装置1Aでは、畳み込み演算を行う際に、量子化処理を組み込むので、入力信号や重みの量子化に伴う計算処理を削減することができる。 As described above, according to the CNN processing apparatus 1A according to the second embodiment, it is possible to reduce the arithmetic processing in the CNN convolution operation by using the weight quantized in advance. Further, since the CNN processing apparatus 1A incorporates the quantization processing when performing the convolution calculation, it is possible to reduce the calculation processing associated with the quantization of the input signal and the weight.

[第3の実施の形態]
次に、本発明の第3の実施の形態について説明する。なお、以下の説明では、上述した第1および第2の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
[Third Embodiment]
Next, a third embodiment of the present invention will be described. In the following description, the same components as those of the first and second embodiments described above are designated by the same reference numerals, and the description thereof will be omitted.

第2の実施の形態では、量子化畳み込み演算部12Aは、予め量子化された重みを用いて、量子化処理を組み込んだ畳み込み演算を行う場合について説明した。これに対し、第3の実施の形態では、重みの量子化、および量子化畳み込み演算を行う際に、記憶部16Bに予め記憶されている関数を読み出して演算を行う。 In the second embodiment, the case where the quantized convolution calculation unit 12A performs the convolution calculation incorporating the quantization process by using the weight quantized in advance has been described. On the other hand, in the third embodiment, when the weight is quantized and the quantized convolution operation is performed, the function stored in advance in the storage unit 16B is read out and the operation is performed.

[CNN処理装置の機能ブロック]
図8は、第3の実施の形態に係るCNN処理装置1Bの機能構成を示すブロック図である。CNN処理装置1Bは、入力バッファ10、量子化重みバッファ11A、畳み込み演算部12、演算結果バッファ13、量子化処理部14、出力バッファ15、および記憶部(第3メモリ、第4メモリ)16Bを備える。
[Functional block of CNN processing device]
FIG. 8 is a block diagram showing a functional configuration of the CNN processing device 1B according to the third embodiment. The CNN processing device 1B includes an input buffer 10, a quantization weight buffer 11A, a convolution calculation unit 12, a calculation result buffer 13, a quantization processing unit 14, an output buffer 15, and a storage unit (third memory, fourth memory) 16B. Be prepared.

記憶部16Bは、予め定義された重み量子化関数(第関数)160、および畳み込み演算量子化関数(第関数)161を記憶している。
重み量子化関数160は、重みの量子化を実現する関数である。より詳細には、重み量子化関数160は、量子化処理部14が、重みUに対して予め設定された端数処理、例えば、小数点を含む重みUの整数化などを行い、データ数を削減する量子化処理を実現する関数である。
The storage unit 16B stores a predefined weight quantization function ( second function) 160 and a convolution operation quantization function ( first function) 161.
The weight quantization function 160 is a function that realizes the quantization of weights. More specifically, in the weight quantization function 160, the quantization processing unit 14 performs rounding processing preset for the weight U, for example, integerization of the weight U including a decimal point, and reduces the number of data. It is a function that realizes the quantization process.

畳み込み演算量子化関数161は、量子化処理が組み込まれた畳み込み演算を実現する関数である。より詳細には、畳み込み演算量子化関数161は、畳み込み演算部12が畳み込み演算を行う際に、演算結果の桁数の制限を設けたり、予め入力信号などの値のビットシフトを行う量子化処理を畳み込み演算とともに実現する関数である。 The convolution operation quantization function 161 is a function that realizes a convolution operation in which a quantization process is incorporated. More specifically, the convolution operation quantization function 161 sets a limit on the number of digits of the operation result when the convolution operation unit 12 performs the convolution operation, or performs a bit shift of a value such as an input signal in advance. Is a function that realizes with a convolution operation.

量子化処理部14は、記憶部16Bから重み量子化関数160を呼び出して、重みUの量子化を実行する。なお、量子化の対象となる重みUの値は、予め記憶部16Bに記憶されている。量子化処理部14が重み量子化関数160を用いて量子化した重みU’は量子化重みバッファ11Aに一時的に記憶される。 The quantization processing unit 14 calls the weight quantization function 160 from the storage unit 16B to execute the quantization of the weight U. The value of the weight U to be quantized is stored in the storage unit 16B in advance. The weight U'quantized by the quantization processing unit 14 using the weight quantization function 160 is temporarily stored in the quantization weight buffer 11A.

畳み込み演算部12は、記憶部16Bに記憶されている畳み込み演算量子化関数161を呼び出して、量子化畳み込み演算を実行する。より詳細には、畳み込み演算部12は、量子化重みバッファ11Aから量子化された重みU’を読み出す。また、畳み込み演算部12は、入力バッファ10から入力信号Aを読み出す。そして、畳み込み演算部12は、入力信号Aと量子化された重みU’とに基づいて、呼び出した畳み込み演算量子化関数161を用いて量子化処理が組み込まれた畳み込み演算を行う。畳み込み演算部12が関数を用いた演算結果は演算結果バッファ13に格納される。 The convolution unit 12 calls the convolution operation quantization function 161 stored in the storage unit 16B to execute the quantization convolution operation. More specifically, the convolution calculation unit 12 reads the quantized weight U'from the quantized weight buffer 11A. Further, the convolution calculation unit 12 reads the input signal A from the input buffer 10. Then, the convolution calculation unit 12 performs a convolution operation in which the quantization process is incorporated by using the called convolution operation quantization function 161 based on the input signal A and the quantized weight U'. The calculation result using the function by the convolution calculation unit 12 is stored in the calculation result buffer 13.

[CNN処理方法]
次に上述した構成を有するCNN処理装置1Bの動作について図9および図10を参照して説明する。
[CNN processing method]
Next, the operation of the CNN processing apparatus 1B having the above-described configuration will be described with reference to FIGS. 9 and 10.

まず、量子化処理部14は、記憶部16Bに予め記憶されている重み量子化関数160を呼び出して、重みUの量子化を行う(ステップS30)。量子化された重みU’は、量子化重みバッファ11Aに一時的に記憶される(ステップS31)。例えば、図10に示すように、量子化された重みU’に対応する重み量子化関数160が量子化処理部14によって記憶部16Bから呼び出される。図10の例では、重み量子化関数160として「重み量子化関数1」で示される関数が各要素に割り当てられている。 First, the quantization processing unit 14 calls the weight quantization function 160 stored in advance in the storage unit 16B to quantize the weight U (step S30). The quantized weight U'is temporarily stored in the quantized weight buffer 11A (step S31). For example, as shown in FIG. 10, the weight quantization function 160 corresponding to the quantized weight U'is called from the storage unit 16B by the quantization processing unit 14. In the example of FIG. 10, the function represented by "weight quantization function 1" is assigned to each element as the weight quantization function 160.

次に入力バッファ10は、CNN処理装置1の外部に設置されたサーバなどから取得された入力信号Aを一時的に記憶する(ステップS32)。 Next, the input buffer 10 temporarily stores the input signal A acquired from a server or the like installed outside the CNN processing device 1 (step S32).

次に、畳み込み演算部12は、記憶部16Bから畳み込み演算量子化関数161を呼び出して量子化処理が組み込まれた畳み込み演算を行う(ステップS33)。より詳細には、畳み込み演算部12は、入力バッファ10から入力信号Aを、量子化重みバッファ11Aから量子化された重みU’を読み出す。畳み込み演算部12は、入力信号Aと量子化された重みU’とに基づいて、畳み込み演算量子化関数161を用いて量子化処理が組み込まれた畳み込み演算を行う。例えば、畳み込み演算部12は、呼び出した関数に従って畳み込み演算の演算結果の桁数を整数に制限しておく処理を行う。また、例えば、量子化畳み込み演算部12Aは、畳み込み演算を行う前に、入力信号Aや量子化された重みU’に対して予めビットシフトを行いデータの桁数に対する処理を行う。 Next, the convolution calculation unit 12 calls the convolution operation quantization function 161 from the storage unit 16B to perform a convolution operation in which the quantization process is incorporated (step S33). More specifically, the convolution calculation unit 12 reads the input signal A from the input buffer 10 and the quantized weight U'from the quantized weight buffer 11A. The convolution calculation unit 12 performs a convolution operation in which the quantization process is incorporated by using the convolution operation quantization function 161 based on the input signal A and the quantized weight U'. For example, the convolution calculation unit 12 performs a process of limiting the number of digits of the calculation result of the convolution calculation to an integer according to the called function. Further, for example, the quantized convolution calculation unit 12A performs a bit shift on the input signal A and the quantized weight U'in advance to perform processing on the number of digits of the data before performing the convolution calculation.

より具体的には、図9の例に示すように、畳み込み演算部12は、畳み込み演算量子化関数161の関数1に従って、畳み込み演算の際に、小数点以下を切り捨てる量子化処理を行う(floor(conv))。また、畳み込み演算部12は、畳み込み演算量子化関数161に従って、フィルタのそれぞれの場所で、量子化された重みU’の要素と、入力信号Aの対応する要素とを乗算し、その和を求める。量子化畳み込み演算部12Aによる量子化された畳み込み演算の演算結果Xは、演算結果バッファ13に一時的に記憶される(ステップS34)。 More specifically, as shown in the example of FIG. 9, the convolution calculation unit 12 performs a quantization process of truncating after the decimal point at the time of the convolution operation according to the function 1 of the convolution operation quantization function 161 (floor (floor). conv)). Further, the convolution calculation unit 12 multiplies the element of the quantized weight U'and the corresponding element of the input signal A at each location of the filter according to the convolution calculation quantization function 161 and obtains the sum thereof. .. The calculation result X of the quantized convolution operation by the quantized convolution calculation unit 12A is temporarily stored in the calculation result buffer 13 (step S34).

その後、CNN処理装置1Bのプロセッサ102は、演算結果バッファ13から量子化された畳み込み演算の演算結果Xを読み出し、ReLUなどの活性化関数を適用する(ステップS35)。具体的には、プロセッサ102は、演算結果Xが負の値である場合には、ReLU関数を通して0を出力し、正の演算結果Xはそのままの値を出力する。 After that, the processor 102 of the CNN processing device 1B reads the operation result X of the convolution operation quantized from the operation result buffer 13 and applies an activation function such as ReLU (step S35). Specifically, when the calculation result X is a negative value, the processor 102 outputs 0 through the ReLU function, and the positive calculation result X outputs the value as it is.

次に、プロセッサ102は、ステップS35で出力された値に対してよく知られたプーリング処理を行い、畳み込み演算の結果を圧縮する(ステップS36)。なお、ステップS35のプーリング処理は必要に応じて行えばよい。また、プロセッサ102は、ステップS35で得られた活性化関数(ReLU)の出力に対して、正規化を行ってもよい(非特許文献1参照)。 Next, the processor 102 performs a well-known pooling process on the value output in step S35, and compresses the result of the convolution operation (step S36). The pooling process in step S35 may be performed as needed. Further, the processor 102 may perform normalization on the output of the activation function (ReLU) obtained in step S35 (see Non-Patent Document 1).

プーリングされた量子化畳み込み演算の演算結果Xは、出力バッファ15に一時的に記憶され、さらに、プロセッサ102により読み出されて外部に出力される(ステップS37)。なお、出力された値は、CNNの特徴抽出部の出力として、後続の図示しない分類器を構成する全結合層に入力されて入力信号Aの画像データを判別する。 The operation result X of the pooled quantized convolution operation is temporarily stored in the output buffer 15, further read by the processor 102, and output to the outside (step S37). The output value is input to the fully coupled layer constituting the subsequent classifier (not shown) as the output of the feature extraction unit of the CNN, and the image data of the input signal A is discriminated.

以上説明したように、第3の実施の形態に係るCNN処理装置1Bによれば、予め定義された重みの量子化関数160および畳み込み演算の量子化関数161を用いて重みの量子化や、量子化畳み込み演算を行う。そのため、多段に接続される畳み込み層の演算において、関数を入れ替えることで、畳み込み演算の全てを定義することができ、プログラムの量を抑えてCNNの処理速度の低下を抑制することができる。 As described above, according to the CNN processing apparatus 1B according to the third embodiment, the weight quantization and the quantum using the predefined weight quantization function 160 and the convolution operation quantization function 161. Performs a deconvolution operation. Therefore, in the operation of the convolution layer connected in multiple stages, all the convolution operations can be defined by exchanging the functions, the amount of the program can be suppressed, and the decrease in the processing speed of the CNN can be suppressed.

なお、説明した実施の形態に係る重み量子化関数160および畳み込み演算量子化関数161は、ハードウェアに組み込みが可能なプログラムであってもよい。例えば、FPGAのソースコードやマイコンのファームウェアなどがそれに該当し、この場合、ハードウェアIPなどといあった形態で別途備えることが可能となる。 The weight quantization function 160 and the convolution operation quantization function 161 according to the embodiment described may be programs that can be incorporated into hardware. For example, FPGA source code, microcomputer firmware, etc. fall under this category, and in this case, it can be separately provided in the form of hardware IP or the like.

また、ハードウェアに組み込み可能なプログラムとして構成される重み量子化関数160および畳み込み演算量子化関数161は、同一ハードウェア内のメモリにあってもよく、また、他のネットワーク設備などに格納されていてもよい。上記プログラムは、ニューラルネットワークの形態に応じて入れ替えることにより、所望の処理機能を有したニューラルネットワークを柔軟に実現するハードウェアが実現できる。 Further, the weight quantization function 160 and the convolution operation quantization function 161 configured as programs that can be incorporated into hardware may be stored in the memory in the same hardware, or may be stored in other network equipment or the like. You may. By exchanging the above programs according to the form of the neural network, it is possible to realize hardware that flexibly realizes a neural network having a desired processing function.

以上、本発明のニューラルネットワーク処理装置、およびニューラルネットワーク処理方法における実施の形態について説明したが、本発明は説明した実施の形態に限定されるものではなく、請求項に記載した発明の範囲において当業者が想定し得る各種の変形を行うことが可能である。 Although the embodiments of the neural network processing apparatus and the neural network processing method of the present invention have been described above, the present invention is not limited to the described embodiments and is within the scope of the invention described in the claims. It is possible to make various modifications that can be imagined by a person skilled in the art.

例えば、説明した実施の形態では、ニューラルネットワークの一例としてCNNを挙げて説明したが、ニューラルネットワーク処理装置が採用するニューラルネットワークはCNNに限らない。 For example, in the described embodiment, CNN has been described as an example of the neural network, but the neural network adopted by the neural network processing device is not limited to CNN.

なお、ここで開示された実施の形態に関連して記述された様々の機能ブロック、モジュール、および回路は、汎用プロセッサ、GPU、デジタル信号プロセッサ(DSP)、特定用途向け集積回路(ASIC)、FPGAあるいはその他のプログラマブル論理デバイス、ディスクリートゲートあるいはトランジスタロジック、ディスクリートハードウェア部品、または上述した機能を実現するために設計された上記いずれかの組み合わせを用いて実行されうる。 The various functional blocks, modules, and circuits described in connection with the embodiments disclosed herein include general-purpose processors, GPUs, digital signal processors (DSPs), application-specific integrated circuits (ASICs), and FPGAs. Alternatively, it may be performed using other programmable logic devices, discrete gates or transistor logic, discrete hardware components, or any combination of the above designed to achieve the functions described above.

汎用プロセッサとしてマイクロプロセッサを用いることが可能であるが、代わりに、従来技術によるプロセッサ、コントローラ、マイクロコントローラ、あるいは状態機器を用いることも可能である。プロセッサは、例えば、DSPとマイクロプロセッサとの組み合わせ、複数のマイクロプロセッサ、DSPコアに接続された1つ以上のマイクロプロセッサ、またはこのような任意の構成である計算デバイスの組み合わせとして実現することも可能である。 Although it is possible to use a microprocessor as a general-purpose processor, it is also possible to use a conventional processor, controller, microcontroller, or state device instead. The processor can also be realized, for example, as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors connected to a DSP core, or a combination of computing devices having such an arbitrary configuration. Is.

1…CNN処理装置、10…入力バッファ、11…重みバッファ、12…畳み込み演算部、13…演算結果バッファ、14…量子化処理部、15…出力バッファ、16…記憶部、101…バス、102…プロセッサ、103…主記憶装置、104…通信インターフェース、105…補助記憶装置、106…入出力装置、NW…通信ネットワーク、U…重み、U’…量子化された重み、A…入力信号、A’…量子化された入力信号。 1 ... CNN processing device, 10 ... input buffer, 11 ... weight buffer, 12 ... convolution calculation unit, 13 ... calculation result buffer, 14 ... quantization processing unit, 15 ... output buffer, 16 ... storage unit, 101 ... bus, 102 ... Processor, 103 ... Main storage, 104 ... Communication interface, 105 ... Auxiliary storage, 106 ... Input / output device, NW ... Communication network, U ... Weight, U'... Quantified weight, A ... Input signal, A '… Quantized input signal.

Claims (16)

多層ニューラルネットワークに与えられる入力信号を記憶する第1メモリと、
前記多層ニューラルネットワークの重みを記憶する第2メモリと、
前記第1メモリ及び前記第2メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行うプロセッサと、
前記畳み込み演算の演算結果であり前記多層ニューラルネットワークでの次の演算に使用される演算結果を記憶するバッファと、を備え、
前記畳み込み演算は、データのビット精度を削減する量子化が組み込まれた、量子化されていない演算結果ではなく量子化された演算結果のみが前記バッファに記憶されるよう畳み込みと量子化とを一括して行う量子化畳み込み演算であり、
前記積和演算に使用される前記重みは、前記第2メモリに記憶される前に予め1ビットのビット精度まで量子化されているか、前記第2メモリに記憶された後に前記プロセッサにより1ビットのビット精度まで量子化され、
前記量子化畳み込み演算を実現する第1関数を記憶する第3メモリをさらに備え、
前記プロセッサは、前記第3メモリから前記第1関数を読み出し、読み出した前記第1関数を用いて前記量子化畳み込み演算を行う、
ことを特徴とするニューラルネットワーク処理装置。
The first memory that stores the input signal given to the multi-layer neural network,
A second memory that stores the weights of the multi-layer neural network,
A processor that performs a convolution operation of the multi-layer neural network including a product-sum operation of the input signal and the weight stored in the first memory and the second memory, respectively.
A buffer for storing the operation result of the convolution operation and used for the next operation in the multi-layer neural network is provided.
The convolution operation integrates convolution and quantization so that only the quantized operation result is stored in the buffer, not the non-quantized operation result, which incorporates the quantization that reduces the bit accuracy of the data. It is a quantized convolution operation performed by
The weights used in the product-sum operation are either quantized to a bit precision of 1 bit in advance before being stored in the second memory, or are stored in the second memory and then stored in the second memory for 1 bit by the processor. Quantized to bit precision ,
Further, a third memory for storing the first function for realizing the quantized convolution operation is provided.
The processor reads the first function from the third memory, and uses the read first function to perform the quantization convolution operation.
A neural network processing device characterized by this.
請求項1に記載のニューラルネットワーク処理装置において、
前記プロセッサは、前記量子化された演算結果に対して活性化関数を用いた処理を行う
ことを特徴とするニューラルネットワーク処理装置。
In the neural network processing apparatus according to claim 1,
The processor is a neural network processing apparatus characterized in that processing using an activation function is performed on the quantized calculation result.
請求項1又は2に記載のニューラルネットワーク処理装置において、
前記プロセッサは、前記量子化畳み込み演算に用いるバイアスに対してのビット精度を削減する量子化を行う
ことを特徴とするニューラルネットワーク処理装置。
In the neural network processing apparatus according to claim 1 or 2.
The processor is a neural network processing device characterized by performing quantization that reduces bit accuracy with respect to a bias used in the quantization convolution operation.
請求項1から3のいずれか1項に記載のニューラルネットワーク処理装置において、
前記多層ニューラルネットワークは、前記プロセッサにより前記量子化畳み込み演算を順次行う複数の畳み込み層を有し、
前記プロセッサは、前記複数の畳み込み層のうちの最終層以外の畳み込み層それぞれの出力であってその次の畳み込み層に入力される前記量子化された演算結果を補助記憶装置に記憶させる、
ことを特徴とするニューラルネットワーク処理装置。
The neural network processing apparatus according to any one of claims 1 to 3.
The multi-layer neural network has a plurality of convolution layers in which the quantized convolution operation is sequentially performed by the processor.
The processor stores the quantized calculation result, which is the output of each of the convolution layers other than the final layer among the plurality of convolution layers and is input to the next convolution layer, in the auxiliary storage device.
A neural network processing device characterized by this .
請求項4に記載のニューラルネットワーク処理装置において、
前記重みを量子化する第関数を記憶する第メモリをさらに備え、
前記プロセッサは、前記第4メモリから前記第関数を読み出し、読み出した前記第2関数を用いて前記重みを量子化する、
ことを特徴とするニューラルネットワーク処理装置。
In the neural network processing apparatus according to claim 4,
Further, a fourth memory for storing the second function for quantizing the weight is provided.
The processor reads the second function from the fourth memory and quantizes the weight using the read second function .
A neural network processing device characterized by this.
請求項5に記載のニューラルネットワーク処理装置において、
前記プロセッサは、前記第関数と前記第関数とを交互に読み出して前記複数の畳み込み層それぞれでの前記重みの量子化と前記量子化畳み込み演算とを行う
ことを特徴とするニューラルネットワーク処理装置。
In the neural network processing apparatus according to claim 5,
The processor is a neural network processing apparatus characterized in that the second function and the first function are alternately read out to perform the quantization of the weight and the quantized convolution operation in each of the plurality of convolution layers. ..
請求項1から6のいずれか1項に記載のニューラルネットワーク処理装置において、
前記多層ニューラルネットワークは、前処理された画像信号を前記入力信号として記憶するための入力バッファをさらに備え、
前記画像信号に施される前処理はモノクロ変換、コントラスト調整、および輝度調整のうち一つを含む
ことを特徴とするニューラルネットワーク処理装置。
The neural network processing apparatus according to any one of claims 1 to 6.
The multi-layer neural network further includes an input buffer for storing the preprocessed image signal as the input signal.
The preprocessing applied to the image signal includes one of monochrome conversion, contrast adjustment, and luminance adjustment .
A neural network processing device characterized by this.
請求項1から7のいずれか1項に記載のニューラルネットワーク処理装置において、
前記重みの量子化はFPGA上で実行される
ことを特徴とするニューラルネットワーク処理装置。
The neural network processing apparatus according to any one of claims 1 to 7.
A neural network processing device characterized in that the quantization of the weight is performed on the FPGA.
請求項1から8のいずれか1項に記載のニューラルネットワーク処理装置を備える通信装置であって、
通信ネットワークを介して外部電子機器との通信を行うためのインターフェース回路をさらに備え、
前記通信ネットワークを介して、前記外部電子機器から前記量子化畳み込み演算に用いるデータを通信する
ことを特徴とする通信装置。
A communication device including the neural network processing device according to any one of claims 1 to 8.
Further equipped with an interface circuit for communicating with external electronic devices via a communication network,
Data used for the quantized convolution operation is communicated from the external electronic device via the communication network.
A communication device characterized by that.
請求項9に記載の通信装置であって、
前記通信ネットワークを介して、前記外部電子機器から予め量子化された前記重みを受信する
ことを特徴とする通信装置。
The communication device according to claim 9.
A communication device characterized by receiving prequantized weights from the external electronic device via the communication network.
請求項9または10に記載の通信装置であって、
前記通信ネットワークを介して、前記外部電子機器から前記第1関数を受信する
ことを特徴とする通信装置。
The communication device according to claim 9 or 10.
A communication device characterized by receiving the first function from the external electronic device via the communication network.
多層ニューラルネットワークに与えられる入力信号を第1メモリに記憶する第1ステップと、
前記多層ニューラルネットワークの重みを第2メモリに記憶する第2ステップと、
プロセッサが、前記第1メモリ及び前記第2メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行う第3ステップと、
バッファにより前記畳み込み演算の演算結果であり前記多層ニューラルネットワークでの次の演算に使用される演算結果を記憶する第4ステップと、を備え、
前記畳み込み演算は、データのビット精度を削減する量子化が組み込まれた、量子化されていない演算結果ではなく量子化された演算結果のみが前記バッファに記憶されるよう畳み込みと量子化とを一括して行う量子化畳み込み演算であり、
前記積和演算に使用される前記重みは、前記第2メモリに記憶される前に予め1ビットのビット精度まで量子化されているか、前記第2メモリに記憶された後前記プロセッサにより1ビットのビット精度まで量子化され、
前記第3ステップでは、前記プロセッサが、前記量子化畳み込み演算を実現する関数を記憶する第3メモリから前記関数を読み出し、読み出した前記関数を用いて前記量子化畳み込み演算を行う、
ことを特徴とするニューラルネットワーク処理方法。
The first step of storing the input signal given to the multi-layer neural network in the first memory,
The second step of storing the weight of the multi-layer neural network in the second memory,
A third step in which the processor performs a convolution operation of the multi-layer neural network including a product-sum operation of the input signal and the weight stored in the first memory and the second memory, respectively.
The buffer comprises a fourth step of storing the operation result of the convolution operation and the operation result used for the next operation in the multi-layer neural network.
The convolution operation integrates convolution and quantization so that only the quantized operation result is stored in the buffer, not the non-quantized operation result, which incorporates the quantization that reduces the bit accuracy of the data. It is a quantized convolution operation performed by
The weight used in the product-sum operation is either quantized to a bit precision of 1 bit in advance before being stored in the second memory, or 1 bit by the processor after being stored in the second memory. Quantified to the bit precision of
In the third step, the processor reads the function from a third memory that stores a function that realizes the quantized convolution operation, and performs the quantized convolution operation using the read function.
A neural network processing method characterized by this.
多層ニューラルネットワークに与えられる入力信号を記憶する第1メモリと、前記多層ニューラルネットワークの重みを記憶する第2メモリと、を備えるコンピュータのプロセッサに、A computer processor including a first memory for storing an input signal given to a multi-layer neural network and a second memory for storing the weights of the multi-layer neural network.
前記第1メモリ及び前記第2メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行う演算処理と、An arithmetic process for performing a convolution operation of the multi-layer neural network including a product-sum operation of the input signal and the weight stored in the first memory and the second memory, respectively.
前記畳み込み演算の演算結果であり前記多層ニューラルネットワークでの次の演算に使用される演算結果をバッファに記憶させる記憶処理と、を実行させ、The storage process of storing the operation result of the convolution operation and the operation result used for the next operation in the multi-layer neural network in the buffer is executed.
前記畳み込み演算は、データのビット精度を削減する量子化が組み込まれた、量子化されていない演算結果ではなく量子化された演算結果のみが前記バッファに記憶されるよう畳み込みと量子化とを一括して行う量子化畳み込み演算であり、The convolution operation integrates convolution and quantization so that only the quantized operation result is stored in the buffer, not the non-quantized operation result, which incorporates the quantization that reduces the bit accuracy of the data. It is a quantized convolution operation performed by
前記積和演算に使用される前記重みは、前記第2メモリに記憶される前に予め1ビットのビット精度まで量子化されているか、前記第2メモリに記憶された後に前記プロセッサにより1ビットのビット精度まで量子化され、The weights used in the product-sum operation are either quantized to a bit precision of 1 bit in advance before being stored in the second memory, or are stored in the second memory and then stored in the second memory for 1 bit by the processor. Quantized to bit precision,
前記コンピュータは、前記量子化畳み込み演算を実現する関数を記憶する第3メモリをさらに備え、The computer further comprises a third memory for storing a function that realizes the quantized convolution operation.
前記演算処理は、前記第3メモリから前記関数を読み出す処理と、読み出した前記関数を用いて前記量子化畳み込み演算を行う処理と、を含む、The arithmetic process includes a process of reading the function from the third memory and a process of performing the quantized convolution operation using the read function.
プログラム。program.
請求項13に記載のプログラムであって、The program according to claim 13.
前記プロセッサに、前記量子化された演算結果に対して活性化関数を用いた処理を実行させるHave the processor execute a process using the activation function on the quantized operation result.
プログラム。program.
請求項13又は14に記載のプログラムであって、The program according to claim 13 or 14.
前記プロセッサに、前記量子化畳み込み演算に用いるバイアスに対してのビット精度を削減する量子化を行う処理を実行させるHave the processor execute a process of performing quantization that reduces bit accuracy with respect to the bias used in the quantization convolution operation.
プログラム。program.
請求項13から15のいずれか1項に記載のプログラムであって、The program according to any one of claims 13 to 15.
前記多層ニューラルネットワークは、前記プロセッサにより前記量子化畳み込み演算を順次行う複数の畳み込み層を有し、The multi-layer neural network has a plurality of convolution layers in which the quantized convolution operation is sequentially performed by the processor.
前記プロセッサに、前記複数の畳み込み層のうちの最終層以外の畳み込み層それぞれの出力であってその次の畳み込み層に入力される前記量子化された演算結果を補助記憶装置に記憶させる処理を実行させる、The processor executes a process of storing the quantized calculation result, which is the output of each of the convolution layers other than the final layer among the plurality of convolution layers and is input to the next convolution layer, in the auxiliary storage device. Let,
プログラム。program.
JP2018192019A 2018-10-10 2018-10-10 Neural network processing equipment, communication equipment, neural network processing methods, and programs Active JP7040771B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018192019A JP7040771B2 (en) 2018-10-10 2018-10-10 Neural network processing equipment, communication equipment, neural network processing methods, and programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018192019A JP7040771B2 (en) 2018-10-10 2018-10-10 Neural network processing equipment, communication equipment, neural network processing methods, and programs

Publications (3)

Publication Number Publication Date
JP2020060967A JP2020060967A (en) 2020-04-16
JP2020060967A5 JP2020060967A5 (en) 2020-10-08
JP7040771B2 true JP7040771B2 (en) 2022-03-23

Family

ID=70219026

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018192019A Active JP7040771B2 (en) 2018-10-10 2018-10-10 Neural network processing equipment, communication equipment, neural network processing methods, and programs

Country Status (1)

Country Link
JP (1) JP7040771B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113361664B (en) * 2021-08-10 2021-11-05 北京航空航天大学 Image recognition system and method based on quantum convolution neural network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160328647A1 (en) 2015-05-08 2016-11-10 Qualcomm Incorporated Bit width selection for fixed point neural networks
JP2018132830A (en) 2017-02-13 2018-08-23 LeapMind株式会社 Neural network construction method, neural network device and neural network device update method
JP2018142049A (en) 2017-02-27 2018-09-13 株式会社日立製作所 Information processing apparatus, image recognition apparatus and method of setting parameter for convolution neural network
JP2018147182A (en) 2017-03-03 2018-09-20 キヤノン株式会社 Arithmetic processing unit and method for controlling the same

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10303632A (en) * 1997-04-24 1998-11-13 Kokusai Denshin Denwa Co Ltd <Kdd> Method for suppressing undesired signal received by array antenna by means of neural network
GB201607713D0 (en) * 2016-05-03 2016-06-15 Imagination Tech Ltd Convolutional neural network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160328647A1 (en) 2015-05-08 2016-11-10 Qualcomm Incorporated Bit width selection for fixed point neural networks
JP2018132830A (en) 2017-02-13 2018-08-23 LeapMind株式会社 Neural network construction method, neural network device and neural network device update method
JP2018142049A (en) 2017-02-27 2018-09-13 株式会社日立製作所 Information processing apparatus, image recognition apparatus and method of setting parameter for convolution neural network
JP2018147182A (en) 2017-03-03 2018-09-20 キヤノン株式会社 Arithmetic processing unit and method for controlling the same

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
米川晴義ほか,電力性能効率に優れた二値化ディープニューラルネットワークのFPGA実装,情報処理学会研究報告 システム・アーキテクチャ(ARC) 2017-ARC-224 [online] ,日本,情報処理学会,2017年01月16日,2017-ARC-224巻 22号,1~6ページ

Also Published As

Publication number Publication date
JP2020060967A (en) 2020-04-16

Similar Documents

Publication Publication Date Title
US11475298B2 (en) Using quantization in training an artificial intelligence model in a semiconductor solution
CN111652368B (en) Data processing method and related product
US20240104378A1 (en) Dynamic quantization of neural networks
CN110363279B (en) Image processing method and device based on convolutional neural network model
US20210150248A1 (en) Dynamic quantization for deep neural network inference system and method
US20200364552A1 (en) Quantization method of improving the model inference accuracy
JP6886747B2 (en) Neural network processing device, neural network processing method, and neural network processing program
US10491239B1 (en) Large-scale computations using an adaptive numerical format
CN111401550A (en) Neural network model quantification method and device and electronic equipment
WO2019238029A1 (en) Convolutional neural network system, and method for quantifying convolutional neural network
KR102233174B1 (en) Neural network accelerator and operating method thereof
CN110647974A (en) Network layer operation method and device in deep neural network
WO2021012148A1 (en) Data processing method and apparatus based on deep neural network, and mobile device
JP7040771B2 (en) Neural network processing equipment, communication equipment, neural network processing methods, and programs
US20200320385A1 (en) Using quantization in training an artificial intelligence model in a semiconductor solution
US20230024977A1 (en) Method of processing data, data processing device, data processing program, and method of generating neural network model
JP6885645B2 (en) Neural network processing device, neural network processing method, and neural network processing program
US20230058500A1 (en) Method and machine learning system to perform quantization of neural network
US20200143282A1 (en) Quantizing machine learning models with balanced resolution via damped encoding
US11861452B1 (en) Quantized softmax layer for neural networks
KR102368590B1 (en) Electronic apparatus and control method thereof
CN114841325A (en) Data processing method and medium of neural network model and electronic device
CN113902928A (en) Image feature extraction method and device and electronic equipment
JP2020060967A5 (en) Neural network processing equipment, communication equipment, neural network processing methods, and programs
JP2021076900A (en) Data processing apparatus and operation method thereof, and program

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200831

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200831

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210616

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210727

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210927

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220111

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220131

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20220222

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220303

R150 Certificate of patent or registration of utility model

Ref document number: 7040771

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150