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 PDFInfo
- 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
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.
しかし、従来の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.
また、前記重みを量子化する第2関数を記憶する第4メモリをさらに備え、前記プロセッサは、前記第4メモリから前記第2関数を読み出し、読み出した前記第2関数を用いて前記重みを量子化してもよい。前記プロセッサは、前記第2関数と前記第1関数とを交互に読み出して前記複数の畳み込み層それぞれでの前記重みの量子化と前記量子化畳み込み演算とを行ってもよい。 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から図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処理装置1は、CNNに与えられる入力信号とCNNの重みとの積和演算を行って演算結果を出力する演算処理装置である。この演算処理は、CNNの中間層を構成する畳み込み層の積和演算(以下、「畳み込み演算」ということがある。)を含む。CNN処理装置1が畳み込み演算を行った演算結果は、ReLUなどの活性化関数にかけられて、1層分の畳み込み層の出力が得られる。以下においては、説明の簡単のため、畳み込み層の積和演算の結果、すなわち畳み込み演算の結果が次の畳み込み層の入力信号として用いられるものとする。CNN処理装置1は、入力信号と重みとの積和演算を繰り返し行って、予め設定されているCNNモデルが有する畳み込み層の数に応じた回数の積和演算を実行する。
The
[CNN処理装置の機能ブロック]
上述したCNN処理装置1は、入力バッファ(第1メモリ)10、重みバッファ(第2メモリ)11、畳み込み演算部12、演算結果バッファ13、量子化処理部14、出力バッファ15、および記憶部16を備える。
[Functional block of CNN processing device]
The
入力バッファ10は、CNNに与えられる入力信号を記憶する。より詳細には、入力バッファ10には、例えば、外部から与えられた画像データなどの入力信号が記憶される。また、入力バッファ10は、画像データなどの入力信号を量子化処理部14に出力する。入力バッファ10に供給される入力信号は、予め前処理を行った画像データであってもよい。前処理の例としては、モノクロ変換、コントラスト調整、および輝度調整などが挙げられる。また、入力信号は、CNN処理装置1において予め設定されているCNNモデルに応じて設定されたビット深度となるように縮小されていてもよい。入力バッファ10に供給される入力信号の値としては、例えば、32ビットや16ビット精度の浮動小数点の配列で表現された小数点を含む値などが用いられる。
The
重みバッファ11は、CNNの重みを記憶する。より詳細には、重みバッファ11には、CNN処理装置1の外部に設置されたサーバ(図示しない)や記憶部16などに予め記憶されているCNNの重みパラメータがロードされる。本実施の形態では、重みの値として、32ビットや16ビット精度の浮動小数点の配列で表現された小数点を含む値などが用いられる。重みバッファ11は、バッファリングした重みを、後述の量子化処理部14に出力する。
The
畳み込み演算部12は、入力バッファ10に記憶されている入力信号と、重みバッファ11に記憶されている重みとの積和演算を含むCNNの畳み込み演算を行う(第1処理)。より詳細には、畳み込み演算部12は、CNN処理装置1において予め設定されているCNNモデルを構成する畳み込み層の積和演算を行う。本実施の形態では、畳み込み演算部12は、後述の量子化処理部14によって量子化された入力信号および重みの値に基づいて、畳み込み演算を行う。畳み込み演算部12が出力する演算結果は、演算結果バッファ13に供給される。
The
演算結果バッファ13は、畳み込み演算部12による畳み込み演算の結果をバッファリングし、その演算結果を量子化処理部14に供給する。
The calculation result
量子化処理部14は、畳み込み演算の処理(第1処理)で用いられるデータの少なくとも一部のビット精度を削減する量子化を行う(第2処理)。より詳細には、量子化処理部14は、入力信号、重み、および畳み込み演算の演算結果の少なくとも一部のデータを量子化する。本実施の形態では、量子化処理部14は、入力信号、重み、および畳み込み演算の演算結果の全てのデータについて量子化処理を行う。
The
具体的には、量子化処理部14は、入力バッファ10から読み出した入力信号の量子化、重みバッファ11から読み出した重みの量子化、および演算結果バッファ13から読み出した畳み込み演算の結果の量子化を行う。さらに、量子化処理部14は、入力バッファ10、重みバッファ11、および演算結果バッファ13にそれぞれ記憶されている入力信号、重み、および演算結果を、量子化された入力信号、重み、および演算結果の値に更新する。
Specifically, the
量子化処理部14が実行する量子化処理は、例えば、四捨五入、切り上げ、切り捨て、最近接丸めなどよく知られた端数処理を含み、入力信号、重み、および畳み込み演算の演算結果のそれぞれの値に対して、小数点を含む値を整数化するなどの制限をかける。量子化処理に伴う処理速度の向上と処理結果の精度とは、互いににトレードオフの関係となる。量子化処理部14が行う各値の量子化は、例えば、8ビットや16ビットなどCNN処理装置1が備えるプロセッサ102が一度に扱えるビット数に応じたビット数へ削減することによって処理速度と精度の両立を図ることができる。例えば、FPGAであれば、各値を1ビットに削減すればよい。なお、量子化処理部14は、CNN処理装置1が扱うCNNを構成する、多段に接続された複数の畳み込み層のうち、一部の畳み込み層のみに用いてもよい。
The quantization process performed by the
出力バッファ15は、量子化処理部14によって量子化された畳み込み演算の結果を一時的に記憶する。
The
記憶部16は、出力バッファ15に一時的に記憶されている量子化された畳み込み演算の結果を格納する。記憶部16に記憶される畳み込み演算の結果が、本実施の形態におけるCNNの畳み込み層の出力値、かつ、次の畳み込み層の入力値として記憶される。また、記憶部16は、量子化処理部14が入力信号、重み、および畳み込み演算の結果の値をそれぞれ量子化する際に用いる端数処理の方法を示す情報を予め記憶している。
The
[CNN処理装置のハードウェア構成]
次に、上述した機能を有するCNN処理装置1のハードウェア構成の例について図2のブロック図を用いて説明する。
[Hardware configuration of CNN processing device]
Next, an example of the hardware configuration of the
図2に示すように、CNN処理装置1は、例えば、バス101を介して接続されるプロセッサ102、主記憶装置103、通信インターフェース104、補助記憶装置105、入出力装置106を備えるコンピュータと、これらのハードウェア資源を制御するプログラムによって実現することができる。
As shown in FIG. 2, the
主記憶装置103には、プロセッサ102が各種制御や演算を行うためのプログラムが予め格納されている。プロセッサ102と主記憶装置103とによって、図1に示した畳み込み演算部12および量子化処理部14を含むCNN処理装置1の各機能が実現される。
The
主記憶装置103によって、図1で説明した入力バッファ10、重みバッファ11、演算結果バッファ13、および出力バッファ15が実現される。
The
通信インターフェース104は、通信ネットワークNWを介して各種外部電子機器との通信を行うためのインターフェース回路である。通信インターフェース104を介して、CNN処理装置1が用いる画像データなどの入力信号や、重みを、外部のサーバなどから受信してもよい。
The
補助記憶装置105は、読み書き可能な記憶媒体と、その記憶媒体に対してプログラムやデータなどの各種情報を読み書きするための駆動装置とで構成されている。補助記憶装置105には、記憶媒体としてハードディスクやフラッシュメモリなどの半導体メモリを使用することができる。
The
補助記憶装置105は、外部から取得された入力データや重みを記憶する記憶領域や、CNN処理装置1が畳み込み演算などのCNNの演算処理を行うためのプログラムを格納するプログラム格納領域を有する。補助記憶装置105によって、図1で説明した記憶部16が実現される。さらには、例えば、上述したデータやプログラムやなどをバックアップするためのバックアップ領域などを有していてもよい。
The
入出力装置106は、外部機器からの信号を入力したり、外部機器へ信号を出力したりするI/O端子により構成される。入出力装置106を介して、図示しない表示装置などを備えて、CNN処理装置1によって出力される演算結果を表示してもよい。
The input /
ここで、補助記憶装置105のプログラム格納領域に格納されているプログラムは、本明細書で説明するCNN処理方法の順序に沿って時系列に処理が行われるプログラムであってもよく、並列に、あるいは呼び出しが行われたときなどの必要なタイミングで処理が行われるプログラムであってもよい。また、プログラムは、1つのコンピュータにより処理されるものでもよく、複数のコンピュータによって分散処理されるものであってもよい。
Here, the program stored in the program storage area of the
[CNN処理方法]
次に、上述した構成を有するCNN処理装置1の動作について図3および図4を参照して説明する。まず、入力バッファ10および重みバッファ11は、CNN処理装置1の外部に設置されたサーバなどから与えられた入力信号Aおよび重みUをそれぞれ一時的に記憶する(ステップS1、ステップS3)。
[CNN processing method]
Next, the operation of the
図4に示すように、入力バッファ10には、入力信号Aが記憶されている。入力信号Aは、ベクトル化された入力画像データであり、縦方向と横方向の次元を持つ。入力信号Aの値は、小数点を含む値で表現される。図4の太線で示す四角形はフィルタを表している。また、重みバッファ11には、重みUが記憶されている。重みUは、行列で表されるカーネルの要素であり、CNNの学習によって調整および更新されて最終的に決定されるパラメータである。重みUの値についても、縦方向と横方向の次元を持ち、各要素は小数点を含む値で表現される。
As shown in FIG. 4, the input signal A is stored in the
次に、量子化処理部14は、入力バッファ10から入力信号Aを読み出して各要素の値を量子化する(ステップS2)。また、量子化処理部14は、重みバッファ11から重みUを読み出して各要素の値を量子化する(ステップS4)。
Next, the
より具体的には、図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
また、図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
図3に戻り、畳み込み演算部12は、入力バッファ10および重みバッファ11からそれぞれ量子化された入力信号A’および量子化された重みU’を読み出して、畳み込み演算を行う(ステップS5)。より詳細には、畳み込み演算部12は、量子化された入力信号A’のベクトルと量子化された重みU’の行列を乗算する。
Returning to FIG. 3, the
具体的には、図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
畳み込み演算部12は、この積和演算による畳み込み演算の演算結果Bを演算結果バッファ13の対応する場所に格納する(ステップS6)。具体的には、図4に示すように、演算結果バッファ13には、小数点を含まない積和の結果「37」が格納されている。
The
その後、量子化処理部14は、演算結果バッファ13からステップS5で得られた畳み込み演算の演算結果を読み出して、量子化処理を行う(ステップS7)。具体的には、図4に示すように、量子化処理部14は、畳み込み演算の演算結果「37」を、例えば、四捨五入して、「40」に量子化する。量子化処理部14は、演算結果バッファ13のデータを、量子化した演算結果B’で更新する。
After that, the
次に、CNN処理装置1のプロセッサ102は、演算結果バッファ13から量子化された畳み込み演算の演算結果B’を読み出し、ReLUなどの活性化関数を適用する(ステップS8)。具体的には、プロセッサ102は、演算結果B’が負の値である場合には、ReLU関数を通して0を出力し、正の演算結果B’はそのままの値を出力する。
Next, the
次に、プロセッサ102は、ステップS8で出力された値に対してよく知られたプーリング処理を行い、畳み込み演算の結果を圧縮する(ステップS9)。なお、ステップS9のプーリング処理は必要に応じて行えばよい。また、プロセッサ102は、ステップS8で得られた活性化関数(ReLU)の出力に対して、正規化を行ってもよい(非特許文献1参照)。
Next, the
プーリング処理された量子化された演算結果B’は、出力バッファ15に蓄えられて、プロセッサ102により読み出されて出力される(ステップS10)。なお、出力された値は、CNNの特徴抽出部の出力として、後続の図示しない分類器を構成する全結合層に入力され、入力信号Aの画像データを判別する。
The pooled quantized calculation result B'is stored in the
以上説明したように、第1の実施の形態に係るCNN処理装置1によれば、CNNの入力信号、重み、および畳み込み演算の演算結果を量子化するので、組み込み用のハードウェアを使用した場合であってもCNNの処理速度の低下を抑制することができる。
As described above, according to the
また、CNN処理装置1によれば、特に、畳み込み演算の演算結果についても量子化するので、多数の層からなるCNN全体の計算負荷を低減することができ、信号処理の高速化が可能となる。
Further, according to the
なお、説明した実施の形態では、積和演算の説明において、説明の簡単のため、バイアスの加算を省略した。しかし、入力信号のベクトルと、重み行列とを乗算し、その後加算されるバイアスの値についても同様に量子化してもよい。 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
[第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
[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
量子化重みバッファ11Aは、予め重みが量子化された重み(量子化重み)を記憶する。量子化重みバッファ11Aは、例えば、CNN処理装置1Aの外部に設置されているサーバ(図示しない)などから取得された、予め量子化された重みを一時的に記憶する。例えば、CNN処理装置1Aは、学習済みのCNNの重みを予め外部に設置されたサーバなどから通信ネットワークNWを介して取得し、記憶部16に予め格納しておいてもよい。この場合、量子化重みバッファ11Aは、記憶部16から量子化された重みを読み出して一時的に蓄える。ここで、量子化された重みは、第1の実施の形態と同様に、CNN処理装置1Aの処理能力に応じたビット精度に削減された重みであり、例えば、小数点を含む重みが整数化されたものが含まれる。
The
量子化畳み込み演算部12Aは、入力信号および量子化された重みを、入力バッファ10および量子化重みバッファ11Aからそれぞれ読み出し、畳み込み演算を行う。より詳には、量子化畳み込み演算部12Aは、畳み込み演算を行う際に、信号の量子化処理も行う。例えば、量子化畳み込み演算部12Aは、畳み込み演算の演算結果の桁数を予め整数に制限しておく処理や、演算結果の桁数に制限がある場合には、計算前にビットシフトを行う演算を畳み込み演算を実行する際に実施する。量子化畳み込み演算部12Aによる演算結果は、演算結果バッファ13に一時的に記憶される。
The quantized
[CNN処理方法]
次に、上述した構成を有するCNN処理装置1Aの動作について、図6および図7を参照して説明する。まず、外部のサーバなどで量子化された重みU’がCNN処理装置1において通信ネットワークNWを介して取得され、量子化された重みU’が記憶部16に記憶されているものとする。
[CNN processing method]
Next, the operation of the
まず、入力バッファ10は、CNN処理装置1の外部に設置されたサーバなどから取得された入力信号Aを一時的に記憶する(ステップS20)。また、量子化重みバッファ11Aは、記憶部16から予め量子化された重みU’を読み出して一時的に記憶する(ステップS21)。
First, the
図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
次に、量子化畳み込み演算部12Aは、入力バッファ10から入力信号Aを、量子化重みバッファ11Aから量子化された重みU’を読み出して量子化処理が組み込まれた畳み込み演算を行う(ステップS22)。例えば、量子化畳み込み演算部12Aは、畳み込み演算の演算結果の桁数を整数に制限しておく処理を行う。また、例えば、量子化畳み込み演算部12Aは、畳み込み演算を行う前に、入力信号Aや量子化された重みU’に対して予めビットシフトを行いデータの桁数に対する処理を行う。
Next, the quantized
より具体的には、図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
その後、CNN処理装置1Aのプロセッサ102は、演算結果バッファ13から量子化された畳み込み演算の演算結果Cを読み出し、ReLUなどの活性化関数を適用する(ステップS24)。具体的には、プロセッサ102は、演算結果Cが負の値である場合には、ReLU関数を通して0を出力し、正の演算結果Cはそのままの値を出力する。
After that, the
次に、プロセッサ102は、ステップS24で出力された値に対してよく知られたプーリング処理を行い、畳み込み演算の結果を圧縮する(ステップS25)。なお、ステップS25のプーリング処理は必要に応じて行えばよい。また、プロセッサ102は、ステップS24で得られた活性化関数(ReLU)の出力に対して、正規化を行ってもよい(非特許文献1参照)。
Next, the
プーリングされた量子化畳み込み演算の演算結果Cは、出力バッファ15に蓄えられて、さらに、プロセッサ102により読み出されて外部に出力される(ステップS26)。なお、出力された値は、CNNの特徴抽出部の出力として、後続の図示しない分類器を構成する全結合層に入力されて入力信号Aの画像データを判別する。
The operation result C of the pooled quantized convolution operation is stored in the
以上説明したように、第2の実施の形態に係るCNN処理装置1Aによれば、予め量子化された重みを用いることで、CNNの畳み込み演算における演算処理を削減することができる。また、CNN処理装置1Aでは、畳み込み演算を行う際に、量子化処理を組み込むので、入力信号や重みの量子化に伴う計算処理を削減することができる。
As described above, according to the
[第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
[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
記憶部16Bは、予め定義された重み量子化関数(第2関数)160、および畳み込み演算量子化関数(第1関数)161を記憶している。
重み量子化関数160は、重みの量子化を実現する関数である。より詳細には、重み量子化関数160は、量子化処理部14が、重みUに対して予め設定された端数処理、例えば、小数点を含む重みUの整数化などを行い、データ数を削減する量子化処理を実現する関数である。
The
The
畳み込み演算量子化関数161は、量子化処理が組み込まれた畳み込み演算を実現する関数である。より詳細には、畳み込み演算量子化関数161は、畳み込み演算部12が畳み込み演算を行う際に、演算結果の桁数の制限を設けたり、予め入力信号などの値のビットシフトを行う量子化処理を畳み込み演算とともに実現する関数である。
The convolution
量子化処理部14は、記憶部16Bから重み量子化関数160を呼び出して、重みUの量子化を実行する。なお、量子化の対象となる重みUの値は、予め記憶部16Bに記憶されている。量子化処理部14が重み量子化関数160を用いて量子化した重みU’は量子化重みバッファ11Aに一時的に記憶される。
The
畳み込み演算部12は、記憶部16Bに記憶されている畳み込み演算量子化関数161を呼び出して、量子化畳み込み演算を実行する。より詳細には、畳み込み演算部12は、量子化重みバッファ11Aから量子化された重みU’を読み出す。また、畳み込み演算部12は、入力バッファ10から入力信号Aを読み出す。そして、畳み込み演算部12は、入力信号Aと量子化された重みU’とに基づいて、呼び出した畳み込み演算量子化関数161を用いて量子化処理が組み込まれた畳み込み演算を行う。畳み込み演算部12が関数を用いた演算結果は演算結果バッファ13に格納される。
The
[CNN処理方法]
次に上述した構成を有するCNN処理装置1Bの動作について図9および図10を参照して説明する。
[CNN processing method]
Next, the operation of the
まず、量子化処理部14は、記憶部16Bに予め記憶されている重み量子化関数160を呼び出して、重みUの量子化を行う(ステップS30)。量子化された重みU’は、量子化重みバッファ11Aに一時的に記憶される(ステップS31)。例えば、図10に示すように、量子化された重みU’に対応する重み量子化関数160が量子化処理部14によって記憶部16Bから呼び出される。図10の例では、重み量子化関数160として「重み量子化関数1」で示される関数が各要素に割り当てられている。
First, the
次に入力バッファ10は、CNN処理装置1の外部に設置されたサーバなどから取得された入力信号Aを一時的に記憶する(ステップS32)。
Next, the
次に、畳み込み演算部12は、記憶部16Bから畳み込み演算量子化関数161を呼び出して量子化処理が組み込まれた畳み込み演算を行う(ステップS33)。より詳細には、畳み込み演算部12は、入力バッファ10から入力信号Aを、量子化重みバッファ11Aから量子化された重みU’を読み出す。畳み込み演算部12は、入力信号Aと量子化された重みU’とに基づいて、畳み込み演算量子化関数161を用いて量子化処理が組み込まれた畳み込み演算を行う。例えば、畳み込み演算部12は、呼び出した関数に従って畳み込み演算の演算結果の桁数を整数に制限しておく処理を行う。また、例えば、量子化畳み込み演算部12Aは、畳み込み演算を行う前に、入力信号Aや量子化された重みU’に対して予めビットシフトを行いデータの桁数に対する処理を行う。
Next, the
より具体的には、図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
その後、CNN処理装置1Bのプロセッサ102は、演算結果バッファ13から量子化された畳み込み演算の演算結果Xを読み出し、ReLUなどの活性化関数を適用する(ステップS35)。具体的には、プロセッサ102は、演算結果Xが負の値である場合には、ReLU関数を通して0を出力し、正の演算結果Xはそのままの値を出力する。
After that, the
次に、プロセッサ102は、ステップS35で出力された値に対してよく知られたプーリング処理を行い、畳み込み演算の結果を圧縮する(ステップS36)。なお、ステップS35のプーリング処理は必要に応じて行えばよい。また、プロセッサ102は、ステップS35で得られた活性化関数(ReLU)の出力に対して、正規化を行ってもよい(非特許文献1参照)。
Next, the
プーリングされた量子化畳み込み演算の演算結果Xは、出力バッファ15に一時的に記憶され、さらに、プロセッサ102により読み出されて外部に出力される(ステップS37)。なお、出力された値は、CNNの特徴抽出部の出力として、後続の図示しない分類器を構成する全結合層に入力されて入力信号Aの画像データを判別する。
The operation result X of the pooled quantized convolution operation is temporarily stored in the
以上説明したように、第3の実施の形態に係るCNN処理装置1Bによれば、予め定義された重みの量子化関数160および畳み込み演算の量子化関数161を用いて重みの量子化や、量子化畳み込み演算を行う。そのため、多段に接続される畳み込み層の演算において、関数を入れ替えることで、畳み込み演算の全てを定義することができ、プログラムの量を抑えてCNNの処理速度の低下を抑制することができる。
As described above, according to the
なお、説明した実施の形態に係る重み量子化関数160および畳み込み演算量子化関数161は、ハードウェアに組み込みが可能なプログラムであってもよい。例えば、FPGAのソースコードやマイコンのファームウェアなどがそれに該当し、この場合、ハードウェアIPなどといあった形態で別途備えることが可能となる。
The
また、ハードウェアに組み込み可能なプログラムとして構成される重み量子化関数160および畳み込み演算量子化関数161は、同一ハードウェア内のメモリにあってもよく、また、他のネットワーク設備などに格納されていてもよい。上記プログラムは、ニューラルネットワークの形態に応じて入れ替えることにより、所望の処理機能を有したニューラルネットワークを柔軟に実現するハードウェアが実現できる。
Further, the
以上、本発明のニューラルネットワーク処理装置、およびニューラルネットワーク処理方法における実施の形態について説明したが、本発明は説明した実施の形態に限定されるものではなく、請求項に記載した発明の範囲において当業者が想定し得る各種の変形を行うことが可能である。 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)
前記多層ニューラルネットワークの重みを記憶する第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.
前記プロセッサは、前記量子化された演算結果に対して活性化関数を用いた処理を行う
ことを特徴とするニューラルネットワーク処理装置。 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.
前記プロセッサは、前記量子化畳み込み演算に用いるバイアスに対してのビット精度を削減する量子化を行う
ことを特徴とするニューラルネットワーク処理装置。 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.
前記多層ニューラルネットワークは、前記プロセッサにより前記量子化畳み込み演算を順次行う複数の畳み込み層を有し、
前記プロセッサは、前記複数の畳み込み層のうちの最終層以外の畳み込み層それぞれの出力であってその次の畳み込み層に入力される前記量子化された演算結果を補助記憶装置に記憶させる、
ことを特徴とするニューラルネットワーク処理装置。 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 .
前記重みを量子化する第2関数を記憶する第4メモリをさらに備え、
前記プロセッサは、前記第4メモリから前記第2関数を読み出し、読み出した前記第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.
前記プロセッサは、前記第2関数と前記第1関数とを交互に読み出して前記複数の畳み込み層それぞれでの前記重みの量子化と前記量子化畳み込み演算とを行う
ことを特徴とするニューラルネットワーク処理装置。 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. ..
前記多層ニューラルネットワークは、前処理された画像信号を前記入力信号として記憶するための入力バッファをさらに備え、
前記画像信号に施される前処理はモノクロ変換、コントラスト調整、および輝度調整のうち一つを含む、
ことを特徴とするニューラルネットワーク処理装置。 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.
前記重みの量子化は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.
通信ネットワークを介して外部電子機器との通信を行うためのインターフェース回路をさらに備え、
前記通信ネットワークを介して、前記外部電子機器から前記量子化畳み込み演算に用いるデータを通信する、
ことを特徴とする通信装置。 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.
前記通信ネットワークを介して、前記外部電子機器から予め量子化された前記重みを受信する
ことを特徴とする通信装置。 The communication device according to claim 9.
A communication device characterized by receiving prequantized weights from the external electronic device via the communication network.
前記通信ネットワークを介して、前記外部電子機器から前記第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.
前記多層ニューラルネットワークの重みを第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メモリにそれぞれ記憶された前記入力信号と前記重みとの積和演算を含む前記多層ニューラルネットワークの畳み込み演算を行う演算処理と、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.
前記プロセッサに、前記量子化された演算結果に対して活性化関数を用いた処理を実行させるHave the processor execute a process using the activation function on the quantized operation result.
プログラム。program.
前記プロセッサに、前記量子化畳み込み演算に用いるバイアスに対してのビット精度を削減する量子化を行う処理を実行させる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.
前記多層ニューラルネットワークは、前記プロセッサにより前記量子化畳み込み演算を順次行う複数の畳み込み層を有し、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.
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)
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)
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)
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 |
-
2018
- 2018-10-10 JP JP2018192019A patent/JP7040771B2/en active Active
Patent Citations (4)
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)
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 |