JP6794593B2 - Methods and devices for optimizing and applying multi-layer neural network models, and storage media - Google Patents
Methods and devices for optimizing and applying multi-layer neural network models, and storage media Download PDFInfo
- Publication number
- JP6794593B2 JP6794593B2 JP2019044175A JP2019044175A JP6794593B2 JP 6794593 B2 JP6794593 B2 JP 6794593B2 JP 2019044175 A JP2019044175 A JP 2019044175A JP 2019044175 A JP2019044175 A JP 2019044175A JP 6794593 B2 JP6794593 B2 JP 6794593B2
- Authority
- JP
- Japan
- Prior art keywords
- layer
- quantization
- network model
- neural network
- substructure
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Image Analysis (AREA)
Description
本発明は、多階層ニューラルネットワークのモデリング分野に関し、特に、プロセッサ資源を節約するために多階層ニューラルネットワークモデルを最適化して適用する方法及び装置、および記憶媒体に関する。 The present invention relates to the field of modeling multi-layer neural networks, and more particularly to methods and devices for optimizing and applying multi-layer neural network models to save processor resources, and storage media.
人工知能(Artificial Intelligence (AI))の分野において、深層学習(Deep Learning)に基づくネットワークアーキテクチャは、今のところ最も広く用いられているアーキテクチャのうちの1つである。深層学習に基づくネットワークアーキテクチャは、実際には、画像と対応する記述データのセットもしくは音声と対応する記述データのセット等、規定の学習セットを用いて多階層ニューラルネットワークモデルを生成する多階層ニューラルネットワーク構造である。多階層ニューラルネットワークモデルにおける階層のそれぞれは、2つの近接した階層において上層のニューロン演算の結果が下層のニューロン演算の入力として用いられるニューロン演算を含み、これにより最上層から最下層まで学習し、それ故に多階層ニューラルネットワークモデルをモデリングする。モデリングの手順において、1つの階層が学習されるたびに、パラメータは、よりよい性能を有する多階層ニューラルネットワークモデルを得るために、誤差逆伝搬(back propergaton)の方法を用いることで細かく調整される。 In the field of artificial intelligence (AI), network architectures based on deep learning are one of the most widely used architectures so far. A network architecture based on deep learning is actually a multi-layer neural network that generates a multi-layer neural network model using a prescribed learning set, such as a set of descriptive data corresponding to images or a set of descriptive data corresponding to voice. It is a structure. Each of the hierarchies in a multi-layer neural network model contains a neuron operation in which the result of the upper neuron operation is used as an input for the lower neuron operation in two adjacent layers, thereby learning from the top layer to the bottom layer. Therefore, we model a multi-layer neural network model. In the modeling procedure, each time one hierarchy is trained, the parameters are fine-tuned by using the method of back proper gaton to obtain a multi-layer neural network model with better performance. ..
畳み込みニューラルネットワーク(convolutional neural netork (CNN))モデルは、今のところ最も一般的に使用されている多階層ニューラルネットワークモデルである。コンピュータビジョン、コンピュータ聴覚(computer audiory)、および自然言語処理の技術分野では、畳み込みニューラルネットワークモデルは広く使用されてきた。しかし、近年モデリングされている多階層ニューラルネットワークモデルでは、その演算は大量のメモリのオーバーヘッドを引き起こし、多数のプロセッサ資源を占める。多階層ニューラルネットワークモデルがGPUベースのワークステーションやサーバ上で演算される場合にはよりよいデータ処理効果が得られるのであるが、ネットワークモデルが演算されるときに占めるプロセッサ資源を削減することは未だ、ネットワークモデルの性能を改善するという目的の1つである。一方、スマートフォンおよびタブレット等現在の組み込み機器のプロセッサ資源は限られているため、より効率的な演算を行うために固定小数点数(整数)を使用しがちである。この場合、ネットワークにおける各階層における浮動小数点のパラメータを固定小数点パラメータに変換して組み込み機器の動作要求に適応するために固定小数点演算を使用する必要がある。しかし、固定小数点演算は劣化を伴う演算であるから、ニューラルネットワークにおける固定小数点演算を階層ごとに実行することにより全体システムに累積誤差をもたらし、結果的にシステム性能における大幅な悪化をもたらす。従って、多階層ニューラルネットワークモデルは、組み込み機器上ではほとんど演算されていない。 The convolutional neural netork (CNN) model is currently the most commonly used multi-layer neural network model. Convolutional neural network models have been widely used in the technical fields of computer vision, computer audiory, and natural language processing. However, in the multi-layer neural network model modeled in recent years, the operation causes a large amount of memory overhead and occupies a large amount of processor resources. Better data processing results can be obtained when a multi-layer neural network model is calculated on a GPU-based workstation or server, but it still occupies less processor resources when the network model is calculated. , One of the purposes of improving the performance of the network model. On the other hand, since the processor resources of current embedded devices such as smartphones and tablets are limited, fixed-point numbers (integers) tend to be used in order to perform more efficient calculations. In this case, it is necessary to use fixed-point arithmetic to convert floating-point parameters in each layer of the network into fixed-point parameters and adapt them to the operation requirements of embedded devices. However, since fixed-point arithmetic is an operation accompanied by deterioration, executing fixed-point arithmetic in a neural network for each layer causes a cumulative error in the entire system, resulting in a significant deterioration in system performance. Therefore, the multi-layer neural network model is hardly calculated on the embedded device.
上記の従来の多階層ニューラルネットワークモデルにおいて存在する技術的な問題を考慮し、本発明は、従来の多階層ニューラルネットワークモデルを最適化して多階層ニューラルネットワークモデルを演算するために必要なプロセッサ資源を削減するための方法を提供することを目的とする。 Considering the technical problems existing in the above-mentioned conventional multi-layer neural network model, the present invention provides the processor resources required for optimizing the conventional multi-layer neural network model and computing the multi-layer neural network model. The purpose is to provide a way to reduce.
本発明の一様態によれば、多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割するサブ構造分割モジュールであって、分割されたサブ構造の末尾の階層は量子化層であり、量子化層以外の階層における演算パラメータを、分割されたサブ構造のそれぞれについて量子化層に転送し、転送された演算パラメータに基づいて量子化層における量子化閾値パラメータを更新するデータ転送モジュールと、を有することを特徴とする、多階層ニューラルネットワークモデルを最適化する装置が提供される。 According to the uniformity of the present invention, it is a substructure division module that divides at least one substructure from a multi-layer neural network model, and the last layer of the divided substructure is a quantization layer, which is a quantization layer. Having a data transfer module that transfers arithmetic parameters in layers other than the above to the quantization layer for each of the divided substructures and updates the quantization threshold parameters in the quantization layer based on the transferred arithmetic parameters. A device for optimizing a multi-layer neural network model is provided.
本発明の他の様態によれば、多階層ニューラルネットワークモデルを保存する保存モジュールと、保存された多階層ニューラルネットワークモデルに対して、多階層ニューラルネットワークモデルにより実行可能なタスク要求に対応するデータセットを入力する入力モジュールと、多階層ニューラルネットワークモデルにおける最上層から最下層までの階層のそれぞれにおいてデータセットを演算して結果を出力する演算モジュールと、を有し、多階層ニューラルネットワークモデルは量子化層を含み、保存モジュールは当該量子化層における量子化閾値パラメータの情報を保存しており、演算モジュールは、量子化閾値パラメータの情報が示す基本係数、シフト係数、および前記基本係数に対する前記量子化閾値パラメータ間の相関関係に基づいて決定される量子化閾値パラメータに基づいて、データセットに対して量子化層において量子化処理を行うことを特徴とする多階層ニューラルネットワークモデルを適用する装置が提供される。 According to another aspect of the present invention, a storage module for storing a multi-layer neural network model and a data set corresponding to a task request that can be executed by the multi-layer neural network model for the stored multi-layer neural network model. The multi-layer neural network model has an input module for inputting data and an arithmetic module for calculating a data set in each of the layers from the top layer to the bottom layer in the multi-layer neural network model and outputting the result. The storage module stores the information of the quantization threshold parameter in the quantization layer, and the arithmetic module stores the basic coefficient, the shift coefficient, and the quantization with respect to the basic coefficient indicated by the information of the quantization threshold parameter . A device for applying a multi-layer neural network model characterized by performing quantization processing on a data set in a quantization layer based on a quantization threshold parameter determined based on a correlation between threshold parameters. Will be done.
本発明の他の様態によれば、多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割することと、ここで、分割されたサブ構造の末尾の階層は量子化層であり、量子化層以外の階層における演算パラメータを、分割されたサブ構造のそれぞれについて量子化層に転送し、転送された演算パラメータに基づいて量子化層における量子化閾値パラメータを更新することと、を備えることを特徴とする、多階層ニューラルネットワークモデルを最適化する方法が提供される。 According to another aspect of the present invention, at least one substructure is divided from the multi-layered neural network model, and here, the last layer of the divided substructure is the quantization layer, other than the quantization layer. The feature is that the arithmetic parameters in the hierarchy are transferred to the quantization layer for each of the divided substructures, and the quantization threshold parameters in the quantization layer are updated based on the transferred arithmetic parameters. A method of optimizing a multi-layered neural network model is provided.
本発明の他の様態によれば、多階層ニューラルネットワークモデルを保存することと、保存された多階層ニューラルネットワークモデルに対して、多階層ニューラルネットワークモデルにより実行可能なタスク要求に対応するデータセットを入力することと、多階層ニューラルネットワークモデルにおける最上層から最下層までの階層のそれぞれにおいてデータセットを演算して結果を出力することと、を有し、多階層ニューラルネットワークモデルは量子化層を含み、当該量子化層における量子化閾値パラメータの情報を保存しており、更に、演算において、量子化閾値パラメータの情報が示す基本係数、シフト係数、および前記基本係数に対する前記量子化閾値パラメータ間の相関関係に基づいて決定される量子化閾値パラメータに基づいて、データセットに対して量子化層において量子化処理を行うことを特徴とする多階層ニューラルネットワークモデルを適用する方法が提供される。 According to another aspect of the present invention, a multi-layer neural network model is stored, and a data set corresponding to a task request that can be executed by the multi-layer neural network model is provided to the stored multi-layer neural network model. The multi-layer neural network model includes a quantization layer, which has input and output of a result by computing a data set in each of the layers from the top layer to the bottom layer in the multi-layer neural network model. , Information on the quantization threshold parameter in the quantization layer is stored, and further, in the calculation, the basic coefficient, the shift coefficient indicated by the information on the quantization threshold parameter , and the correlation between the quantization threshold parameter with respect to the basic coefficient. A method of applying a multi-layer neural network model characterized by performing quantization processing in a quantization layer for a data set based on a quantization threshold parameter determined based on a relationship is provided.
本発明の他の様態によれば、コンピュータにより実行された場合に、多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割することと、ここで、分割されたサブ構造の末尾の階層は量子化層であり、量子化層以外の階層における演算パラメータを、分割されたサブ構造のそれぞれについて量子化層に転送し、転送された演算パラメータに基づいて量子化層における量子化閾値パラメータを更新することと、を備えることを特徴とする、多階層ニューラルネットワークモデルを最適化する方法を、コンピュータに実行させるための命令を格納した、非一時的なコンピュータ読み取り可能な記憶媒体が提供される。 According to another aspect of the invention, when executed by a computer, it divides at least one substructure from a multi-layer neural network model, where the last layer of the divided substructures is quantized. It is a layer, and the arithmetic parameters in the layers other than the quantization layer are transferred to the quantization layer for each of the divided substructures, and the quantization threshold parameters in the quantization layer are updated based on the transferred arithmetic parameters. A non-temporary computer-readable storage medium is provided that stores instructions for causing a computer to execute a method of optimizing a multi-layer neural network model, which comprises.
本発明の更なる特徴は、添付の図面を参照し、以下の例示的な実施形態の説明より明らかとなるだろう。 Further features of the present invention will become apparent from the description of the exemplary embodiments below, with reference to the accompanying drawings.
添付図面は明細書に含まれ、その一部を構成し、本発明の実施形態を示し、その記述と共に本発明の原理を説明するために用いられる。
以下では図面を参照して、本発明の様々な実施形態を詳細に説明する。本発明は、以下に説明する様々な実施形態に限定されないことが理解されるべきである。さらに、本発明の課題を解決するための方法として、様々な実施形態の全てにおいて説明される特徴の組み合わせを含む必要はない。 Various embodiments of the present invention will be described in detail below with reference to the drawings. It should be understood that the invention is not limited to the various embodiments described below. Furthermore, it is not necessary to include a combination of features described in all of the various embodiments as a method for solving the problems of the present invention.
従来の多階層ニューラルネットワークモデルの構造はたいてい複雑である。その構造を簡略化するために、ネットワークモデルに対して二値化処理が行われる。図1は、二値化処理が行われた畳み込みニューラルネットワークモデルを示す。 The structure of traditional multi-layer neural network models is usually complex. In order to simplify the structure, a binarization process is performed on the network model. FIG. 1 shows a convolutional neural network model that has been binarized.
図1を参照すると、周知の技術を用いて学習及び生成されたバイナリ畳み込みニューラルネットワークモデルが示されている。図1に示されているバイナリ畳み込みニューラルネットワークモデルが学習及び生成される場合、先ず学習セットがタスク要求に従って入力される。ここで、タスク要求は、バイナリ畳み込みニューラルネットワークモデルをモデリングするために参照され、すなわち、ネットワークモデルは、どのような種類のデータ処理を実行するために使用される。例えば、タスク要求が画像分類処理である場合、バイナリ畳み込みニューラルネットワークモデルは画像を分類するためのデータ処理を実行するために使用され、他に例えばタスク要求が音声認識処理である場合、バイナリ畳み込みニューラルネットワークモデルは音声を認識するためのデータ処理を実行するために使用される。タスク要求が決定された後は、タスク要求にマッチした学習セットが入力される。例えば、タスク要求が画像分類処理である場合、画像及び該画像に対応する記述データ(例えば注釈付きの真値など)のセットが、学習セットとして入力される。他に例えば、タスク要求が音声認識処理である場合、音声及び該音声に対応する記述データのセットが学習セットとして入力される。その後、図1に示されるバイナリ畳み込みニューラルネットワークモデルは、入力された学習セットを用いて規定の学習方法で学習および生成される。生成されたバイナリ畳み込みニューラルネットワークモデルは、以下の2つの特徴の側面を有する。
特徴1:重みパラメータ(重み)が二値化される
演算を簡略化するために、バイナリ畳み込みニューラルネットワークモデルの畳み込み層における重みに対して二値化処理が行われる。すなわち、重みは、重みの符号(正若しくは負)に従って1ビットを用いて表される。ここで、正の値を有する重みは、二値化された後は+1によって表され、負の値を有する重みは、二値化された後は−1によって表される。さらに、演算精度を考慮すると、フル精度の重み(すなわち、二値化処理を行っていない重み)に基づく演算結果に近い、二値化処理後の重みに基づく演算結果を出すために、言い換えれば、フル精度の重みと畳み込み層に入力される入力特徴マップとの畳み込み演算結果に近い、二値化された重みと畳み込み層に入力される入力特徴マップとの畳み込み演算結果を出すために、1つのスケーリング係数αは畳み込みフィルタの各々に含まれている。このスケーリング係数αは、二値化された重みを用いた演算結果の精度を改善するために使用される。すなわち、二値化された重みとαとの積が、フル精度の重みを近似するために使用される。スケーリング係数αは、以下の式(1)に従って計算される。
With reference to FIG. 1, a binary convolutional neural network model trained and generated using well-known techniques is shown. When the binary convolutional neural network model shown in FIG. 1 is trained and generated, the training set is first input according to the task request. Here, the task request is referenced to model a binary convolutional neural network model, i.e., the network model is used to perform any kind of data processing. For example, if the task request is an image classification process, the binary convolutional neural network model is used to perform data processing to classify the image, and if the task request is a speech recognition process, for example, the binary convolutional neural network. The network model is used to perform data processing to recognize speech. After the task request is determined, the learning set that matches the task request is input. For example, when the task request is an image classification process, an image and a set of descriptive data (such as annotated true values) corresponding to the image are input as a learning set. Alternatively, for example, when the task request is a voice recognition process, the voice and a set of descriptive data corresponding to the voice are input as a learning set. Then, the binary convolutional neural network model shown in FIG. 1 is trained and generated by a prescribed learning method using the input learning set. The generated binary convolutional neural network model has the following two characteristic aspects.
Feature 1: The weight parameter (weight) is binarized In order to simplify the operation, the weight in the convolutional layer of the binary convolutional neural network model is binarized. That is, the weight is represented using one bit according to the sign (positive or negative) of the weight. Here, the weight having a positive value is represented by +1 after being binarized, and the weight having a negative value is represented by -1 after being binarized. Further, in consideration of the calculation accuracy, in other words, in order to obtain a calculation result based on the weight after the binarization process, which is close to the calculation result based on the full-precision weight (that is, the weight not subjected to the binarization process). In order to obtain the convolution operation result of the binarized weight and the input feature map input to the convolution layer, which is close to the convolution operation result of the full-precision weight and the input feature map input to the convolution layer, 1 Two scaling coefficients α are included in each of the convolution filters. This scaling factor α is used to improve the accuracy of the calculation result using the binarized weight. That is, the product of the binarized weight and α is used to approximate the full-precision weight. The scaling coefficient α is calculated according to the following equation (1).
ここで|W|l1はフル精度の重みの場合におけるフィルタに対応するノルムL1を示し、nはフィルタの重みの数を示す。 Here, | W | l1 indicates the norm L1 corresponding to the filter in the case of full-precision weights, and n indicates the number of weights of the filter.
上記の式(1)に基づき、後の二値化された重みに基づく畳み込み演算は、以下の式(2)により表される。 Based on the above equation (1), the later convolution operation based on the binarized weight is expressed by the following equation (2).
ここでWbは、二値の重みが使用される場合における畳み込みフィルタを示し、αは、二値の重みが使用される場合における畳み込みフィルタのスケーリング係数を示し、 Where W b indicates the convolution filter when binary weights are used, and α indicates the scaling factor of the convolution filter when binary weights are used.
は畳み込み演算を示し、bは畳み込み演算のオフセットパラメータを示し、X1は、畳み込み層に入力される入力特徴マップ(換言すれば、畳み込み層の上層の出力)を示し、Y1は、畳み込み層の出力を示す。 Indicates the convolution operation, b indicates the offset parameter of the convolution operation, X 1 indicates the input feature map input to the convolution layer (in other words, the output of the upper layer of the convolution layer), and Y 1 indicates the convolution layer. Shows the output of.
特徴2:入力特徴マップ(特徴マップ)が複数ビットを用いて量子化される
量子化層では、ある量子化閾値法に従って(例えば、特定の量子化閾値パラメータを用いて)、量子化層の上層から入力特徴マップにおける要素のそれぞれが、kビットで表される計算空間に量子化(マップ)される。ここでkは正の整数であり、kの選択は、モデリングされる多階層ニューラルネットワークモデルに対する演算精度要求に依存する。ネットワークモデルに対する演算精度要求がより高い場合は、k値が4であるなど、より大きいk値が選択され、ネットワークモデルに対する演算精度要求がより低い場合は、k値が2であるなど、より小さいk値が選択される。
Feature 2: The input feature map (feature map) is quantized using multiple bits. In the quantization layer, the upper layer of the quantization layer is according to a certain quantization threshold method (for example, using a specific quantization threshold parameter). Each element in the input feature map is quantized (mapped) into a computational space represented by k bits. Where k is a positive integer and the choice of k depends on the computational accuracy requirements for the multi-layered neural network model to be modeled. If the computational accuracy requirement for the network model is higher, a larger k value is selected, such as a k value of 4, and if the computational accuracy requirement for the network model is lower, the k value is smaller, such as 2. The k value is selected.
2であるk値を例にとると、量子化層の上層からの入力特徴マップにおける要素のそれぞれから、幾つかの中心点要素が選択され、例えば、0,0.538、1.076、及び1.614が中心点要素として選択され、これらの中心点要素に基づいて、量子化処理中に使用される量子化閾値パラメータが決定される。その後、入力特徴マップにおける要素のそれぞれが、量子化閾値パラメータと比較され、比較の結果に従って、2ビットで表される計算空間に、要素のそれぞれが量子化される。特に、量子化処理は、以下の式(3)に示される量子化閾値法を用いて実行される。 Taking the k value of 2 as an example, some center point elements are selected from each of the elements in the input feature map from the upper layer of the quantized layer, for example, 0, 0.538, 1.076, and 1.614 is selected as the center point element, and based on these center point elements, the quantization threshold parameters used during the quantization process are determined. After that, each of the elements in the input feature map is compared with the quantization threshold parameter, and each of the elements is quantized into the calculation space represented by 2 bits according to the result of the comparison. In particular, the quantization process is executed by using the quantization threshold method shown in the following equation (3).
ここで、Xiは、量子化層の上層からの入力特徴マップにおけるi番目の要素を示し、iは正の整数であり、Yiは入力特徴マップにおけるi番目の要素に対する量子化層の出力を示す。式(3)を見ても分かるように、量子化層において用いられる量子化閾値法は、入力特徴マップにおけるi番目の要素が量子化される数値を、0,0.807,1.345,及び∞の量子化閾値パラメータに基づいて決定するものである。Xiが0未満である場合、i番目の要素は0に量子化される、すなわち、量子化層の出力は0であり、Xiが量子化閾値パラメータ0と0.807との間である場合、i番目の要素は0.538に量子化される、すなわち、量子化層の出力は0.538であり、Xiが量子化閾値パラメータ0.807と1.345の間である場合、i番目の要素は1.076に量子化される、すなわち、量子化層の出力は1.076であり、Xiが量子化閾値パラメータ1.345よりも大きい場合、i番目の要素は1.614に量子化される、すなわち、量子化層の出力は1.614である。上記の式(3)に示される量子化演算により、入力特徴マップにおける全ての要素は、量子化層から出力される結果が選択された中心点要素の値となるように、量子化層において選択された中心点要素に量子化(マップ)される。 Here, X i indicates the i-th element in the input feature map from the upper layer of the quantization layer, i is a positive integer, and Y i is the output of the quantization layer for the i-th element in the input feature map. Is shown. As can be seen from the equation (3), the quantization threshold method used in the quantization layer sets the numerical value at which the i-th element in the input feature map is quantized as 0,0.807,1.345. It is determined based on the quantization threshold parameters of and ∞. If X i is less than 0, the i-th element is quantized to 0, i.e. the output of the quantization layer is 0 and X i is between the quantization threshold parameters 0 and 0.807. If the i-th element is quantized to 0.538, i.e. the output of the quantization layer is 0.538 and X i is between the quantization threshold parameters 0.807 and 1.345. If the i-th element is quantized to 1.076, i.e. the output of the quantization layer is 1.076 and X i is greater than the quantization threshold parameter 1.345, then the i-th element is 1. Quantized to 614, i.e. the output of the quantization layer is 1.614. By the quantization operation shown in the above equation (3), all the elements in the input feature map are selected in the quantization layer so that the result output from the quantization layer becomes the value of the selected center point element. It is quantized (mapped) to the center point element.
上記式(3)において、量子化閾値パラメータは、選択された中心点要素を平均化するような方法で計算される。 In the above equation (3), the quantization threshold parameter is calculated by a method such as averaging the selected center point elements.
0.807=(0.538+1.076)/2、 1.345=(1.076+1.614)/2
もちろん、量子化閾値パラメータを決定する計算方法は、選択された中心点要素を平均化する上記の方法に限らず、他の既知の計算方法を使用しても良い。
0.807 = (0.538 + 1.076) / 2, 1.345 = (1.076 + 1.614) / 2
Of course, the calculation method for determining the quantization threshold parameter is not limited to the above method for averaging the selected center point elements, and other known calculation methods may be used.
上記の式(3)において非零の最小項をβ’として示すと、式(3)はさらに式(4)に展開させることができる。 If the minimum non-zero term is shown as β'in the above equation (3), the equation (3) can be further expanded into the equation (4).
ここで、β’=0.538。 Here, β'= 0.538.
YiがさらにYi=β’Yqとして表され、ここでYqはYiの対応する整数部の表現であり、その要素の値は0,1,2,または3の整数をとることが、上記の式(4)から分かる。 Y i is further expressed as Y i = β'Y q , where Y q is a representation of the corresponding integer part of Y i , and the value of that element takes an integer of 0, 1, 2, or 3. However, it can be seen from the above equation (4).
図1に示されるバイナリ畳み込みニューラルネットワークモデルを用いてデータ処理タスクが実行される場合に、量子化層から出力されて量子化を介してマップされる値が浮動小数点数となることが、上記の式(4)から分かる。従って、量子化層の下層について、入力特徴マップにおける要素のそれぞれが32ビット浮動小数点数であり、浮動小数点数に対する演算が大量のメモリのオーバーヘッドを引き起こし、多数のプロセッサ資源を占める。一般に、ハードウェアデバイスは、より効率的な演算を達成するために、より整数を使用して演算を実行する傾向があった。これに基づき、本発明は、従来の多階層ニューラルネットワークモデルを最適化する方法を提案する。図4(a)を参照すると、先ず、浮動小数点量子化多階層ニューラルネットワークに関して、サブ構造が分割される。分割されたサブ構造の末尾の階層が量子化層の場合(換言すると、本発明の実施形態の方法を用いて処理されることが可能なサブ構造)、その後、本発明の実施形態の方法を用いて固定小数点処理が行われて、これにより固定小数点多階層ニューラルネットワークを得、分割されたサブ構造の末尾の階層が量子化層ではなく活性化層などの他の階層の場合(換言すると、本発明の実施形態の方法を用いて処理されることが不可能なサブ構造)、その後、他の既知のアルゴリズムを用いて処理される。本発明の実施形態における固定小数点処理では、階層のそれぞれにおける演算手順と演算パラメータとが量子化層に転送されて結合量子化形態(joint quantization form)で再構成サブ構造を形成するまで、ネットワークフォワード計算ルール等のアルゴリズムに基づいて、量子化層の前の階層のそれぞれにおけるニューロンの演算中の演算手順と演算パラメータとが同等に、下方に転送され、これにより、量子化層から整数の形態で特徴マップを出力する。これは、多階層ニューラルネットワークモデルの演算中に使用されるサーバ資源を効果的に削減し、メモリのオーバーヘッドを節約する。 When a data processing task is executed using the binary convolutional neural network model shown in FIG. 1, the value output from the quantization layer and mapped via quantization becomes a floating point number. It can be seen from equation (4). Therefore, for the lower layer of the quantization layer, each element in the input feature map is a 32-bit floating point number, and the operation on the floating point number causes a large amount of memory overhead and occupies a large amount of processor resources. In general, hardware devices have tended to use more integers to perform operations in order to achieve more efficient operations. Based on this, the present invention proposes a method of optimizing a conventional multi-layer neural network model. Referring to FIG. 4A, first, the substructure is divided with respect to the floating point quantized multi-layer neural network. If the last layer of the divided substructure is a quantized layer (in other words, a substructure that can be processed using the method of the embodiment of the invention), then the method of the embodiment of the invention Fixed-point processing is performed using this to obtain a fixed-point multi-layer neural network, when the last layer of the divided substructure is not a quantization layer but another layer such as an activation layer (in other words, Substructures that cannot be processed using the methods of the embodiments of the invention), followed by processing using other known algorithms. In the fixed-point processing according to the embodiment of the present invention, the calculation procedure and the calculation parameter in each of the layers are transferred to the quantization layer to form a reconstruction substructure in the joint quantization form, and the network forward is performed. Based on algorithms such as calculation rules, the calculation procedure and calculation parameters during the calculation of neurons in each layer before the quantization layer are equally transferred downward, thereby in the form of integers from the quantization layer. Output the feature map. This effectively reduces the server resources used during the computation of the multi-layer neural network model and saves memory overhead.
本発明の実施形態における多階層ニューラルネットワークモデルを最適化する装置のハードウェア構成について、図3を参照して以下、説明する。 The hardware configuration of the device for optimizing the multi-layer neural network model according to the embodiment of the present invention will be described below with reference to FIG.
<多階層ニューラルネットワークモデルを最適化する装置のハードウェア構成>
図3は、多階層ニューラルネットワークモデルを最適化する装置のハードウェア構成の概略図を示し、装置は、プロセッサユニット101、内部メモリユニット102、ネットワークインターフェースユニット103、入力ユニット104、外部メモリユニット105、およびバスユニット106を含む。
<Hardware configuration of the device that optimizes the multi-layer neural network model>
FIG. 3 shows a schematic diagram of the hardware configuration of a device that optimizes a multi-layer neural network model, and the devices include a
プロセッサユニット101は、CPUもしくはGPUである。メモリユニット102は、ランダムアクセスメモリ(RAM)およびリードオンリーメモリ(ROM)を含む。RAMは、プロセッサユニット101のメインメモリ、ワークエリア等として使用される。ROMは、プロセッサユニット101の制御プログラムを格納するために使用され、加えて、制御プログラムが実行される場合に用いられるファイル若しくは他のデータを格納するためにも用いられる。ネットワークインターフェースユニット103は、ネットワークに接続されており、ネットワーク通信を実施する。入力ユニット104は、キーボード及びマウスなどのデバイスからの入力を制御する。外部メモリユニット105は、起動プログラムおよび各種のアプリケーションなどを格納する。バスユニット106は、多階層ニューラルネットワークモデルの最適化を行う装置におけるユニットのそれぞれを接続するために使用される。
The
本発明の実施形態について、添付の図面を参照して以下に詳細に説明する。 Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
<第1の実施形態>
図4(b)に示すように、それは、本発明の第1の実施形態における多階層ニューラルネットワークモデルの最適化の概略フローチャートである。本実施形態では、図4(b)に示される多階層ニューラルネットワークモデルを最適化する処理フローは、ROM及び/又は外部メモリユニット105に格納されているプログラム(ニューラルネットワーク前方予測アルゴリズムなど)を、ワークメモリとしてRAMを用いてCPU101に実行させることで、実行される。
<First Embodiment>
As shown in FIG. 4B, it is a schematic flowchart of the optimization of the multi-layer neural network model in the first embodiment of the present invention. In the present embodiment, the processing flow for optimizing the multi-layer neural network model shown in FIG. 4B is a program (neural network forward prediction algorithm, etc.) stored in the ROM and / or the
ステップS201:前処理ステップ
ステップS201は多階層ニューラルネットワークモデルの最適化の実行前の前処理であり、その詳細は:最適化される多階層ニューラルネットワークモデルを取得することである。
Step S201: Preprocessing Step S201 is the preprocessing before the execution of the optimization of the multi-layer neural network model, and the details thereof are: Obtaining the optimized multi-layer neural network model.
ステップS201は、本発明の目的を達成するために必要なステップではないことに注意すべきである。ステップS201において最適化される必要がある多階層ニューラルネットワークモデルは、既知の方法によりモデル化された多階層ニューラルネットワークモデルである。図1に示されるバイナリ畳み込みニューラルネットワークモデルは、最適化される必要がある多階層ニューラルネットワークモデルの一例である。ステップS201で取得される多階層ニューラルネットワークモデルは、既知の技術によりモデル化されたネットワークモデルであり、本発明の実施形態はそれに限定されない。 It should be noted that step S201 is not a necessary step to achieve the object of the present invention. The multi-layer neural network model that needs to be optimized in step S201 is a multi-layer neural network model modeled by a known method. The binary convolutional neural network model shown in FIG. 1 is an example of a multi-layer neural network model that needs to be optimized. The multi-layer neural network model acquired in step S201 is a network model modeled by a known technique, and the embodiment of the present invention is not limited thereto.
ステップS202:サブ構造分割ステップ
ステップS202では、多階層ニューラルネットワークモデルを最適化する処理が開始される。その詳細は:多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割することであり、ここで、分割されたサブ構造のそれぞれの末尾の階層は、量子化層である。
Step S202: Substructure division step In step S202, the process of optimizing the multi-layer neural network model is started. The details are: Dividing at least one substructure from a multi-layered neural network model, where each trailing layer of the divided substructures is a quantization layer.
好ましくは、ステップS201で取得された多階層ニューラルネットワークモデルが、畳み込みニューラルネットワークモデルである場合、畳み込み層は更に、サブ構造において実施される畳み込み処理を行うために、分割されたサブ構造のそれぞれに含まれる。より好ましくは、畳み込み演算をよりよくするために、それぞれのサブ構造の先頭層は畳み込み層であり、最下層は量子化層である。畳み込み層と量子化層との間には、バッチ正規化層、プーリング層、およびスケーリング層などの、他の階層がある。もちろん、畳み込み層と量子化層との間に他の階層が無くてもよく、すなわち、畳み込み層および量子化層のみがサブ構造が順次含められている。図5A〜5Dは、4種類のサブ構造の概略図を示す。しかし、本発明の実施形態の方法では、サブ構造の形態は図5A〜5Dに示されている構造に限らず、上記の条件を満たすサブ構造が、多階層ニューラルネットワークモデルの実際の構造に従って、多階層ニューラルネットワークモデルから分割される。ステップS202におけるサブ構造の分割の詳細な例は、後で与えられる。 Preferably, when the multi-layer neural network model acquired in step S201 is a convolutional neural network model, the convolutional layer is further divided into each of the substructures in order to perform the convolutional processing performed in the substructure. included. More preferably, in order to improve the convolution operation, the head layer of each substructure is a convolution layer, and the bottom layer is a quantization layer. Between the convolutional layer and the quantization layer are other layers such as batch regularization layer, pooling layer, and scaling layer. Of course, there may be no other layers between the convolution layer and the quantization layer, that is, only the convolution layer and the quantization layer sequentially include substructures. 5A-5D show schematic views of four types of substructures. However, in the method of the embodiment of the present invention, the form of the substructure is not limited to the structure shown in FIGS. 5A to 5D, and the substructure satisfying the above conditions is according to the actual structure of the multi-layer neural network model. Divided from a multi-layer neural network model. A detailed example of substructure division in step S202 will be given later.
ステップS203:データ転送ステップ
ステップS203では、多階層ニューラルネットワークモデルを最適化する処理が続けられる。その詳細は:分割されたサブ構造のそれぞれについて、末尾の階層(量子化層)以外の階層における演算パラメータを用いて、量子化層における量子化閾値パラメータを更新することである。すなわち、末尾の階層以外の階層における演算パラメータおよび演算手順を量子化層に同等に転送して量子化層における量子化閾値パラメータを更新することである。なお、本発明の実施形態において記載された「転送」とは、本質的には結合操作(a merge operation)である。例えば、N層を含むサブ構造については、それぞれの階層の出力は、量子化層に転送されるまで、先頭層から開始される次の階層の入力として使用され、これにより、先頭層と末尾の階層との間に数式により表される関係を決定する。
Step S203: Data transfer In step S203, the process of optimizing the multi-layer neural network model is continued. The details are: For each of the divided substructures, the quantization threshold parameters in the quantization layer are updated using the arithmetic parameters in the hierarchy other than the last hierarchy (quantization layer). That is, the calculation parameters and the calculation procedure in the layers other than the last layer are equally transferred to the quantization layer to update the quantization threshold parameters in the quantization layer. The "transfer" described in the embodiment of the present invention is essentially a merge operation. For example, for substructures containing N layers, the output of each layer is used as the input of the next layer starting from the first layer until transferred to the quantization layer, thereby leading and ending. Determine the mathematical relationship with the hierarchy.
本発明の実施形態のステップS203では、サブ構造の末尾の階層を除く階層のそれぞれについて、それぞれの階層における演算パラメータおよび演算手順が同等に末尾の階層(すなわち量子化層)に転送されるまで、上層における演算パラメータおよび演算手順が同様に最上層から最下層に下層に向けて転送される。これにより、量子化層における量子化閾値パラメータを更新する。更新された量子化閾値パラメータについて、データ転送手順中になされたそれぞれの階層における演算手順および演算パラメータ(すなわちそれぞれの階層の演算特性)を反映し、更新された量子化閾値パラメータを用いて量子化(マッピング)処理が実行される場合、式(3)のように、量子化結果として、上層からの入力特徴マップにおける浮動小数点形式の選択された中心点要素を用いず、量子化(マッピング)処理の量子化結果として整数が用いられる。これにより、演算中に必要なプロセッサ資源を削減する。 In step S203 of the embodiment of the present invention, for each of the layers excluding the last layer of the substructure, until the operation parameters and operation procedures in each layer are equally transferred to the last layer (that is, the quantization layer). The calculation parameters and calculation procedures in the upper layer are similarly transferred from the top layer to the bottom layer toward the lower layer. This updates the quantization threshold parameters in the quantization layer. The updated quantization threshold parameter is quantized using the updated quantization threshold parameter, reflecting the calculation procedure and calculation parameters (that is, the calculation characteristics of each layer) in each layer performed during the data transfer procedure. When the (mapping) process is executed, as the quantization result, the quantization (mapping) process is performed without using the selected center point element in the floating point format in the input feature map from the upper layer as in the equation (3). An integer is used as the result of the quantization of. This reduces the processor resources required during the operation.
ステップS203におけるデータ転送手順の詳細な例については後に与えられる。 A detailed example of the data transfer procedure in step S203 will be given later.
ステップS201〜S203を経て最適化された多階層ニューラルネットワークモデルについて、最適化されたネットワークモデルにおける何れかのサブ構造に対する多階層演算が、サブ構造における量子化層の量子化演算に展開され、量子化層からの出力はもはや浮動小数点形式の演算パラメータではなく、このサブ構造の後の階層(他のサブ構造における階層であっても良いし、サブ構造には属していないネットワークモデルにおける階層であっても良い)の演算がシンプルになるように、整数形式における演算パラメータであり、最適化された多階層ニューラルネットワークモデルは、より少なく占有されるプロセッサ資源により動作可能である。 For the multi-layer neural network model optimized through steps S201 to S203, the multi-layer operation for any substructure in the optimized network model is expanded to the quantization operation of the quantization layer in the substructure, and the quantum. The output from the optimization layer is no longer a floating-point arithmetic parameter, but a hierarchy after this substructure (which may be a hierarchy in another substructure or a hierarchy in a network model that does not belong to a substructure. The optimized multi-layer neural network model, which is an arithmetic parameter in integer format, can operate with less occupied processor resources so that the arithmetic (which may be) is simple.
ステップS202およびS203における最適化処理の手順に加えて、サブ構造簡単化処理および固定小数点処理などの最適化処理が、本発明の実施形態においてステップS202〜S203を経て最適化された多階層ニューラルネットワークモデルに対してさらに実行されても良く、その詳細は以下の説明において示される。 In addition to the optimization processing procedure in steps S202 and S203, optimization processing such as substructure simplification processing and fixed-point processing is optimized through steps S202 to S203 in the embodiment of the present invention. Further execution may be performed on the model, the details of which are given in the description below.
ステップS204:サブ構造簡単化ステップ
図4(b)の参照を続けると、ステップS204におけるサブ構造を簡単化する処理の詳細は:それぞれのサブ構造における末尾の階層以外の階層について、演算パラメータおよび演算手順が同等に量子化層に対して転送された階層を、サブ構造から削除することである。
Step S204: Substructure Simplification Continuing with reference to step 4 (b), the details of the process for simplifying the substructure in step S204 are as follows: Arithmetic parameters and arithmetic for hierarchies other than the last hierarchy in each substructure. The procedure is to remove the hierarchy equally transferred to the quantization layer from the substructure.
本発明の実施形態では、演算パラメータおよび演算手順が同等に、末尾の階層以外の階層で完全に量子化層に対して転送された階層があり、且つ多階層ニューラルネットワークモデルが演算される場合にそのような階層においてもはやデータは演算されていないので、そのような階層が削除されても、演算精度に悪影響は及ぼさない。むしろ、多階層ニューラルネットワークモデルの構造はより簡単になる。ステップS204におけるサブ構造を簡単化する詳細な例は後で与えられる。 In the embodiment of the present invention, when there is a hierarchy in which the calculation parameters and the calculation procedure are the same, the layers are completely transferred to the quantization layer in a layer other than the last layer, and the multi-layer neural network model is calculated. Since the data is no longer calculated in such a hierarchy, deleting such a hierarchy does not adversely affect the calculation accuracy. Rather, the structure of the multi-layer neural network model becomes simpler. A detailed example for simplifying the substructure in step S204 will be given later.
ステップS205:固定小数点ステップ
図4(b)の参照を続けると、ステップS205における固定小数点処理の詳細は:それぞれの階層における浮動小数点演算パラメータが固定小数点パラメータに変換されるように、多階層ニューラルネットワークモデルにおけるそれぞれの階層に対して固定小数点処理を行うことである。固定小数点処理の任意の技術はQ値技術であり、ここでQ値は正の整数Nであり、浮動小数点数がNビットだけ左にシフトされた(2のN乗だけ乗ずることに等価である増幅演算)後で丸められることを意味し、これにより、浮動小数点演算パラメータを固定小数点パラメータ(整数)に変換する。多階層ニューラルネットワークモデルにおける精度要求に応じて、1つのN値は多階層ニューラルネットワークモデル全体に対して設定され、N値は異なる階層に対してそれぞれ設定される。ステップS205における固定小数点の詳細な例については後に与えられる。
Step S205: Fixed-Point Step Continuing with reference to FIG. 4B, the details of the fixed-point processing in step S205 are: Multi-layer neural network so that floating-point arithmetic parameters in each layer are converted to fixed-point parameters. It is to perform fixed-point processing for each layer in the model. Any technique for fixed-point processing is the Q-value technique, where the Q-value is a positive integer N, where the floating-point number is shifted left by N bits (equivalent to multiplying 2 to the Nth power). Amplification operation) means that it will be rounded later, which converts the floating point operation parameter to a fixed point parameter (integer). One N value is set for the entire multi-layer neural network model, and one N value is set for each of the different layers, depending on the accuracy requirement in the multi-layer neural network model. A detailed example of the fixed point in step S205 will be given later.
なお、ステップS205は、ステップS203およびS204の処理が完了した後で実行される。もちろん、ステップS205はステップS203の前に実行されても良く、例えば、ステップS201とステップS202との間で実行されても良い、もしくはステップS203とステップS204との間で実行されても良い。本発明の実施形態は、多階層ニューラルネットワークモデルのそれぞれの階層における浮動小数点演算パラメータが固定小数点数に変換されることが可能である限りは、ステップS205の処理時点は限定しない。加えて、ステップS204およびS205は、本発明の実施形態においては好適なステップである。本発明の実施形態において、この2つのステップは同時に存在しても良いし、それらのうち1つが存在しても良いし、それらのうちどちらも存在しなくても良い。 Note that step S205 is executed after the processes of steps S203 and S204 are completed. Of course, step S205 may be executed before step S203, for example, may be executed between step S201 and step S202, or may be executed between step S203 and step S204. The embodiment of the present invention does not limit the processing time point of step S205 as long as the floating-point arithmetic parameters in each layer of the multi-layer neural network model can be converted into fixed-point numbers. In addition, steps S204 and S205 are suitable steps in the embodiments of the present invention. In embodiments of the invention, the two steps may be present at the same time, one of them may be present, or neither of them may be present.
ステップS206:保存ステップ
ステップS206における保存ステップの詳細は:前のステップS202〜S205を経て最適化された多階層ニューラルネットワークモデルを保存することである。好ましくは、多階層ニューラルネットワークモデルがバイナリ畳み込みニューラルネットワークモデルである場合、バイナリ畳み込み層における重みはバイナリストリームの形態で保存される。一方で、サブ構造における階層のそれぞれは、ステップS203において量子化層に対して、そのような階層における演算パラメータおよび演算手順を同等に転送したので、これらの階層における演算パラメータはネットワークモデルには含まれない。
Step S206: Preservation Step The details of the preservation step in step S206 are: Preserving the multi-layer neural network model optimized through the previous steps S202 to S205. Preferably, when the multi-layer neural network model is a binary convolutional neural network model, the weights in the binary convolutional layer are stored in the form of a binary stream. On the other hand, since each of the hierarchies in the substructure equally transferred the arithmetic parameters and procedures in such hierarchies to the quantized layer in step S203, the arithmetic parameters in these hierarchies are included in the network model. I can't.
なお、この保存ステップは、本発明の実施形態の任意のステップである。本発明の実施形態の方法においては、この保存ステップは実行されなくてもよく、最適化された多階層ニューラルネットワークモデルは直接、ネットワークインターフェースまたは他の入力/出力インターフェースを介して外部に出力される。 This preservation step is an arbitrary step according to the embodiment of the present invention. In the method of the embodiment of the invention, this preservation step does not have to be performed and the optimized multi-layer neural network model is output directly to the outside through a network interface or other input / output interface. ..
なお、本実施形態におけるステップS202〜S205で説明した最適化処理は、複数回実行されてもよく、すなわち、ステップS202〜S205において最適化処理手順の全てが実行されたとしても、最適化された多階層ニューラルネットワークモデルがステップS206において保存された後で、ステップS202〜S205における最適化処理は保存されたネットワークモデルに対して再度実行されも良く、これによりネットワークモデルの演算精度を向上させる。 The optimization processing described in steps S202 to S205 in this embodiment may be executed a plurality of times, that is, even if all the optimization processing procedures are executed in steps S202 to S205, the optimization is performed. After the multi-layer neural network model is saved in step S206, the optimization processing in steps S202 to S205 may be executed again for the saved network model, thereby improving the calculation accuracy of the network model.
ステップS202〜S205は以下、特定の例によって詳細に説明される。 Steps S202-S205 will be described in detail below by a specific example.
<ステップS202におけるサブ構造を分割する例>
図1に示されたバイナリ畳み込みニューラルネットワークモデルがステップS201で取得されるケースを例にとると、ステップS202では、このネットワークモデルからサブ構造を分割する手順が特に以下のように説明される。
<Example of dividing the substructure in step S202>
Taking the case where the binary convolutional neural network model shown in FIG. 1 is acquired in step S201 as an example, in step S202, the procedure for dividing the substructure from this network model is particularly described as follows.
図1を参照すると、バイナリ畳み込みニューラルネットワークモデルには、8層の畳み込み層が含まれている。このネットワークモデルの精度を保証するために、先頭及び末尾の畳み込み層の両方がフル精度の畳み込み層(すなわち、二値化されていない畳み込み層)として設定され、残りの畳み込み層は二値化されたバイナリ畳み込み層である。サブ構造の分割方式が、先頭層がバイナリ畳み込み層であり、末尾の階層が量子化層であること、とする。5つのサブ構造が図1に示されるモデルから分割され、サブ構造が分割されている図1は、それぞれの波線のブロックがサブ構造を表す図2Aに示される構造になる。ここで、第1のサブ構造における先頭層はバイナリ畳み込み層2であり、中間層は順次、プーリング層2およびバッチ正規化層2であり、末尾の階層は量子化層2であり、第2のサブ構造における先頭層はバイナリ畳み込み層3であり、中間層はバッチ正規化層3であり、末尾の階層は量子化層3であり、第3のサブ構造における先頭層はバイナリ畳み込み層4であり、中間層はバッチ正規化層4であり、末尾の階層は量子化層4であり、第4のサブ構造における先頭層はバイナリ畳み込み層5であり、中間層は順次、プーリング層5およびバッチ正規化層5であり、末尾の階層は量子化層5であり、第5のサブ構造における先頭層はバイナリ畳み込み層6であり、中間層はバッチ正規化層6であり、末尾の階層は量子化層6である。図2Bおよび2Cは、サブ構造が分割されている図2Aからのネットワークモデルの一部を示す。 Referring to FIG. 1, the binary convolutional neural network model contains eight convolutional layers. To ensure the accuracy of this network model, both the leading and trailing convolution layers are set as full-precision convolution layers (ie, non-binarized convolution layers), and the remaining convolution layers are binarized. It is a binary convolution layer. It is assumed that the substructure division method is that the first layer is a binary convolution layer and the last layer is a quantization layer. The five substructures are divided from the model shown in FIG. 1, and the substructures are divided. In FIG. 1, each wavy line block has the structure shown in FIG. 2A, which represents the substructure. Here, the first layer in the first substructure is the binary convolution layer 2, the intermediate layers are sequentially the pooling layer 2 and the batch normalization layer 2, the last layer is the quantization layer 2, and the second layer. The first layer in the substructure is the binary convolution layer 3, the middle layer is the batch normalization layer 3, the last layer is the quantization layer 3, and the first layer in the third substructure is the binary convolution layer 4. , The intermediate layer is the batch normalization layer 4, the last layer is the quantization layer 4, the first layer in the fourth substructure is the binary convolution layer 5, and the intermediate layers are sequentially the pooling layer 5 and the batch normalization. The chemical layer 5, the last layer is the quantization layer 5, the first layer in the fifth substructure is the binary convolution layer 6, the middle layer is the batch normalization layer 6, and the last layer is the quantization layer. Layer 6 2B and 2C show a part of the network model from FIG. 2A where the substructure is divided.
ネットワークモデルの説明を簡単にするために、多階層ニューラルネットワークモデルの階層のそれぞれには、表1に従って、異なる文字識別子が割り当てられている。 To simplify the description of the network model, different character identifiers are assigned to each layer of the multi-layer neural network model according to Table 1.
ここで、IPは、それぞれのニューロンが全ての入力ノードと接続している全結合層を表す。表1に示される文字識別子と階層との間の対応関係に基づき、図2Aに示されるバイナリ畳み込みニューラルネットワークモデルは、以下に示すように、文字列として表される。 Here, IP represents a fully connected layer in which each neuron is connected to all input nodes. Based on the correspondence between the character identifiers shown in Table 1 and the hierarchy, the binary convolutional neural network model shown in FIG. 2A is represented as a character string, as shown below.
上記の分割された5つのサブ構造を参照すると、文字列においてサブ列CPBQとサブ列CBQは分割されたサブ構造を表していることが分かる。従って、レギュラーマッチングサブストリングサーチ(regular matching sub-string search)などの方法を用いて、分割された5つのサブ構造は上記の文字列において、以下の形式のように表される。 With reference to the above five divided substructures, it can be seen that the subcolumn CPBQ and the subcolumn CBQ represent the divided substructures in the character string. Therefore, using a method such as regular matching sub-string search, the five substructures divided are represented in the above character string in the following format.
加えて、ネットワークモデルの正しい動作順序を保証するために、ネットワークモデルは最上層から最下層まで階層ごとに動作するため、分割されたサブ構造のそれぞれの間で入れ子はない。例えば、ネットワークモデルにおいてC→C→B→Q→B→Qなどのサブ列がある場合、中間における文字サブ列C→B→Qがサブ構造として表され且つ両端におけるCとB→Qがサブ構造を構成しないような方法(入れ子なし)でサブ構造を分割する必要がある。 In addition, to ensure the correct order of operation of the network model, the network model operates layer by layer from the top layer to the bottom layer, so there is no nesting between each of the divided substructures. For example, when there is a sub-column such as C-> C-> B-> Q-> B-> Q in the network model, the character sub-string C-> B-> Q in the middle is represented as a substructure and C and B-> Q at both ends are sub-columns. It is necessary to divide the substructure in a way that does not form the structure (without nesting).
サブ構造が以下の方法(入れ子有り)に従って分割される場合には、演算は間違っているという問題が生じる。 When the substructure is divided according to the following method (nested), the problem that the operation is wrong arises.
<ステップS203におけるデータ転送の例>
図5Aに示されるサブ構造を例にとると、このサブ構造は、最上層から最下層までに、畳み込み層、バッチ正規化層、および量子化層を含む。畳み込み層に入力される入力特徴マップ(すなわち、畳み込み層の上層における出力)X1を用いて式(2)に示される演算が実行された後、畳み込み層において、演算結果Y1がバッチ正規化層に対して出力される。バッチ正規化層では、受け取ったY1に対してバッチ正規化処理が行われ、バッチ正規化処理後の出力が同等に量子化層に対して転送される。その後、量子化層では、式(4)における量子化閾値パラメータが、バッチ正規化層からの入力特徴マップを用いて更新される。図5B〜5Dに示されるサブ構造は、図5Aのサブ構造の変更として考慮され、それらの転送手順は上記の手順と同様である。例えば、図5Aにおけるサブ構造と比べると、図5Bに示されるサブ構造では、プーリング層は畳み込み層とバッチ正規化層との間に追加される。プーリング演算自体がパラメータを全く要しないので、図5Bに示されるサブ構造では、転送動作結果の方式は、図5Aのサブ構造に基づく方式と一致する。図5Aのサブ構造と比べると、図5Cに示されるサブ構造では、バッチ正規化層はキャンセルされてプーリング層は追加されており、プーリング演算自体がパラメータを全く要しないので、畳み込み層の演算結果Y1は直接量子化層に入力される。図5Aのサブ構造と比べると、図5Dのサブ構造では、プーリング層およびスケーリング層が順次、畳み込み層とバッチ正規化層との間に追加されており、畳み込み層の演算出力Y1は、プーリング層を介してスケーリング層に転送される。スケーリング層では、スケーリング演算が入力Y1を用いて実行され、その後、出力結果はバッチ正規化層に転送される。最後に、バッチ正規化層では、スケーリング層から出力された結果を用いてバッチ正規化処理が実行され、バッチ正規化処理の後の結果が量子化層に転送される。
<Example of data transfer in step S203>
Taking the substructure shown in FIG. 5A as an example, this substructure includes a convolutional layer, a batch regularization layer, and a quantization layer from the top layer to the bottom layer. After the operation shown in equation (2) is executed using the input feature map (that is, the output in the upper layer of the convolution layer) X 1 input to the convolution layer, the operation result Y 1 is batch-normalized in the convolution layer. Output for layers. In the batch normalization layer, the batch normalization process is performed on the received Y 1 , and the output after the batch normalization process is equally transferred to the quantization layer. Then, in the quantization layer, the quantization threshold parameter in the equation (4) is updated using the input feature map from the batch regularization layer. The substructures shown in FIGS. 5B-5D are considered as modifications of the substructure of FIG. 5A, and their transfer procedures are similar to those described above. For example, in the substructure shown in FIG. 5B, the pooling layer is added between the convolutional layer and the batch regularization layer, as compared to the substructure in FIG. 5A. In the substructure shown in FIG. 5B, the method of the transfer operation result is consistent with the method based on the substructure of FIG. 5A, since the pooling operation itself does not require any parameters. Compared with the substructure of FIG. 5A, in the substructure shown in FIG. 5C, the batch regularization layer is canceled and the pooling layer is added, and the pooling operation itself does not require any parameters, so that the calculation result of the convolution layer Y 1 is directly input to the quantization layer. Compared with the sub-structure of Figure 5A, the sub-structure of FIG. 5D, pooling layer and scaling layers sequentially are added between the convolution layer and batch normalization layer, operation output Y 1 of the convolution layer, pooling Transferred to the scaling layer through the layer. The scaling layer, is performed scaling operations using the input Y 1, then the output result is transferred to the batch normalization layer. Finally, in the batch normalization layer, the batch normalization process is executed using the result output from the scaling layer, and the result after the batch normalization process is transferred to the quantization layer.
量子化閾値パラメータを転送して更新するための特定のアルゴリズムを、図5Aに示されるサブ構造を例にとり、さらに説明する。ステップS203の実行前に、式(2)に基づき、畳み込み層の出力が A specific algorithm for transferring and updating the quantization threshold parameters will be further described by taking the substructure shown in FIG. 5A as an example. Before the execution of step S203, the output of the convolution layer is output based on the equation (2).
として計算されるとする。ここで、βは量子化畳み込み層の入力特徴マップにおける非0の最小項パラメータであり、Xqは特徴マップの整数部の表現である。畳み込み層の出力は、バッチ正規化層に対して転送されてバッチ正規化処理を実行し、バッチ正規化処理の手順は以下の式(5)により表される。 Is calculated as. Here, β is a non-zero minimum term parameter in the input feature map of the quantized convolution layer, and X q is a representation of the integer part of the feature map. The output of the convolutional layer is transferred to the batch normalization layer to execute the batch normalization process, and the procedure of the batch normalization process is expressed by the following equation (5).
ここで、θは、バッチ正規化層の平均パラメータであり、σはバッチ正規化層の分散パラメータであり、θおよびσは浮動小数点型の数値であり、X2は、バッチ正規化層に転送される畳み込み層の出力(すなわちY1)であり、Y2は、量子化層に対するバッチ正規化層の出力である。バッチ正規化処理は、入力特徴マップを標準正規分布型のフォームに正規化する処理である。 Here, θ is the average parameter of the batch normalization layer, σ is the distribution parameter of the batch normalization layer, θ and σ are floating point numerical values, and X 2 is transferred to the batch normalization layer. Is the output of the convolution layer to be (ie Y 1 ), where Y 2 is the output of the batch normalization layer to the quantized layer. The batch normalization process is a process for normalizing an input feature map into a standard normal distribution type form.
さらに、量子化層における量子化(マッピング)手順が式(4)によって表され、バッチ正規化層により量子化層に出力される特徴マップをY2、特徴マップにおける要素のそれぞれをXiとする。次に、ステップS203において量子化層における量子化閾値パラメータの更新の実行手順について詳細に説明する。 Furthermore, the quantization (mapping) procedure in the quantization layer is expressed by Eq. (4), and the feature map output to the quantization layer by the batch regularization layer is Y 2 , and each of the elements in the feature map is X i . .. Next, in step S203, the procedure for executing the update of the quantization threshold parameter in the quantization layer will be described in detail.
量子化層は、入力特徴マップを2ビットで量子化し、量子化層における量子化(マッピング)手順は、式(4)から式(6)に展開される。 The quantization layer quantizes the input feature map with 2 bits, and the quantization (mapping) procedure in the quantization layer is expanded from the equation (4) to the equation (6).
ここで、β’=0.538,thr1=0,thr2=0.807,thr3=1.345,であり、Xiは、バッチ正規化層により量子化層に出力される入力特徴マップにおけるi番目の要素であり、Yiは、入力特徴マップにおけるi番目の要素に対する量子化層の出力である。 Here, β'= 0.538, thr 1 = 0, thr 2 = 0.807, thr 3 = 1.345, and X i is an input feature output to the quantization layer by the batch regularization layer. It is the i-th element in the map, and Y i is the output of the quantization layer for the i-th element in the input feature map.
式(2)と式(5)の組み合わせから、式(2)におけるY1は式(5)のX2であり、式(5)のY2は、バッチ正規化層により量子化層に入力される式(6)の入力特徴マップであることが分かり、ここで、i番目の要素は From the combination of equations (2) and (5), Y 1 in equation (2) is X 2 in equation (5), and Y 2 in equation (5) is input to the quantization layer by the batch regularization layer. It turns out that it is the input feature map of equation (6), where the i-th element is
である。従って、上記の式(6)はさらに式(7)に展開される。 Is. Therefore, the above equation (6) is further expanded into the equation (7).
式(7)は、数学的な変換を介して式(8)に展開され続ける。 Equation (7) continues to be expanded into equation (8) through a mathematical transformation.
式(8)は、再度数学的な変換を介して式(9)に展開され続ける。 Equation (8) continues to be expanded into equation (9) again through mathematical transformation.
上記の式(9)において、 In the above formula (9)
とし、その後、上記の式(9)は式(10)に展開される。 After that, the above equation (9) is expanded into the equation (10).
式(10)は、量子化層の上の階層のそれぞれにおける演算パラメータおよび演算手順が同等に量子化層に転送された後の量子化閾値パラメータの更新結果を示す。このとき、更新された量子化閾値パラメータは、畳み込み層およびバッチ正規化層における演算パラメータおよび演算手順を反映している。さらに、量子化(マッピング)処理に対応する結果は、非0の最小項パラメータと整数0,1,2,または3との積である、ここで、 Equation (10) shows the update result of the quantization threshold parameter after the operation parameters and the operation procedures in each of the layers above the quantization layer are equally transferred to the quantization layer. At this time, the updated quantization threshold parameters reflect the arithmetic parameters and procedures in the convolutional layer and the batch regularization layer. Furthermore, the result corresponding to the quantization (mapping) process is the product of the non-zero minimum term parameter and the integers 0, 1, 2, or 3, where
は、畳み込みフィルタのオフセットパラメータおよびスケーリングパラメータとは無関係の畳み込み層の出力を示す。 Shows the output of the convolution layer independent of the offset and scaling parameters of the convolution filter.
式(6)と式(10)とを比較すると、畳み込み層の畳み込み演算とバッチ正規化層のバッチ正規化演算とに関連するXiから、畳み込みフィルタのオフセットパラメータとスケーリングパラメータとに無関係な畳み込み層の出力 Compared to equation (6) and Equation (10), the X i associated with convolution convolution layer and the batch normalization operation batch normalization layer, unrelated to the offset parameter and the scaling parameter of the convolution filter convolution Layer output
に、量子化層に入力される入力特徴マップが変更されていることが分かる。同時に、量子化層における量子化閾値パラメータは、thr1からthr1’、thr2からthr2’、thr3からthr3’に変更されている。すなわち、入力特徴マップにおける中心点要素の演算によって決まる式(6)の量子化閾値パラメータは、中心点要素(thr1〜thr3およびβ’)、畳み込み層における演算パラメータ(二値化された重み畳み込みフィルタのスケーリング係数α、入力特徴マップにより量子化された非0最小項パラメータβ、および畳み込み演算のオフセットパラメータb)、およびバッチ正規化層における演算パラメータ(バッチ正規化層の平均パラメータθ、およびバッチ正規化層の分散パラメータσ)により決定される量子化閾値パラメータに変更される。畳み込み層およびバッチ正規化層の演算パラメータおよび演算手順を量子化層における量子化閾値パラメータに反映させることで、畳み込み層およびバッチ正規化層の演算パラメータおよび演算手順の量子化層への等価な転送が実現され、このとき、量子化層は、入力特徴マップにおける要素のそれぞれを直接0,1,2,若しくは3に量子化(マップ)して出力する。同時に、その非0最小項パラメータβ’も、後続の固定小数点のために出力される。 It can be seen that the input feature map input to the quantization layer has been changed. At the same time, the quantization threshold parameters in the quantization layer are changed from thr 1 to thr 1 ', thr 2 to thr 2 ', and thr 3 to thr 3 '. That is, the quantization threshold parameter of the equation (6) determined by the calculation of the center point element in the input feature map is the center point element (thr 1 to thr 3 and β') and the calculation parameter (binarized weight) in the convolution layer. The scaling factor α of the convolution filter, the non-zero minimum parameter β quantized by the input feature map, and the offset parameter b of the convolution operation), and the operation parameters in the batch normalization layer (average parameter θ of the batch normalization layer, and It is changed to the quantization threshold parameter determined by the dispersion parameter σ) of the batch normalization layer. Equivalent transfer of the computational parameters and procedures of the convolutional and batch normalization layers to the quantization layer by reflecting the computational parameters and procedures of the convolutional layer and batch normalization layer in the quantization threshold parameters of the quantization layer. At this time, the quantization layer directly quantizes (maps) each of the elements in the input feature map to 0, 1, 2, or 3 and outputs it. At the same time, its non-zero minimum term parameter β'is also output for the subsequent fixed point.
加えて、式(10)を参照すると、WbおよびXqがそれぞれ整数であり、すなわち In addition, referring to equation (10), W b and X q are integers, respectively, i.e.
が整数であり、thr1’〜thr3’の1つ以上が浮動小数点数である場合、丸められた浮動小数点部分は、浮動小数点を丸める丸め処理が、すなわち丸めがロスレスである前後の量子化結果である、thr1’〜thr3’における浮動小数点数に対して実行された後で、閾値比較結果に影響を及ぼさない。従って、浮動小数点を丸める簡単丸め処理により、式(10)はロスレス変換の場合、整数量子化演算に変換される。 There is an integer, if one or more of thr 1 '~thr 3' is the number of floating point, it rounded floating point portion, rounding rounding floating-point, i.e. before and after the rounding is lossless quantization it is the result, after being performed on floating point numbers in thr 1 '~thr 3', does not affect the threshold comparison result. Therefore, the equation (10) is converted into an integer quantization operation in the case of lossless conversion by the simple rounding process for rounding the floating point number.
第1の実施形態の方法により、特に式(10)の表現により、ネットワークモデルのそれぞれの階層において対応する演算が実行される場合に使用される、畳み込み層におけるスケーリング係数α等のパラメータが重みの形態で直接格納されるのではなく、量子化層の上のそれぞれの階層の演算パラメータおよび演算手順が量子化層に同様に転送された後で量子化閾値パラメータの形態で格納され、これにより、これらのパラメータが格納される場合に格納スペースを削減する。 Parameters such as the scaling factor α in the convolutional layer, which are used when the corresponding operations are performed in each layer of the network model by the method of the first embodiment, especially by the expression of equation (10), are weighted. Rather than being stored directly in form, it is stored in the form of quantization threshold parameters after the computational parameters and procedures of each layer above the quantization layer are similarly transferred to the quantization layer, thereby. Reduce storage space when these parameters are stored.
スケーリング係数αを例に取ると、一般にはαは浮動小数点数であり、二値の重みで表される畳み込みフィルタのパラメータWb={1,−1,1,...1,−1}は整数である。従来の方法が畳み込みフィルタのオリジナルパラメータW(W=Wb*α)を格納するために用いられる場合、Wbとαのそれぞれを格納する必要がある。しかし、本発明の第1の実施形態の方法が適用された後、特に式(10)の展開後、αは量子化層の量子化閾値パラメータに移される。このように、αを格納する必要はなく、Wb={1,−1,1,...1,−1}のみを格納する必要がある。従って、ネットワークモデルの畳み込み層の演算パラメータを格納するための空間が効率的に削減され、記憶資源を節約することができる。 Taking the scaling factor α as an example, α is generally a floating point number, and the parameter W b of the convolution filter represented by the binary weight = {1, -1, 1, 1. .. .. 1, -1} is an integer. When the conventional method is used to store the original parameter W (W = W b * α) of the convolution filter, it is necessary to store each of W b and α. However, after the method of the first embodiment of the present invention is applied, especially after the expansion of equation (10), α is transferred to the quantization threshold parameter of the quantization layer. In this way, it is not necessary to store α, and W b = {1, -1, 1, 1. .. .. It is necessary to store only 1, -1}. Therefore, the space for storing the arithmetic parameters of the convolution layer of the network model can be efficiently reduced, and the storage resources can be saved.
従来の方法では、オリジナルパラメータWを低いビット(例えば1ビット)で格納することが望まれる場合、αをオリジナルパラメータWに低いビットで含めることは困難であり、ネットワークモデルの動作中にαを使用することは困難である。しかし、本発明の第1の実施形態の方法が適用された後は、特に式(10)の展開後は、αは量子化層の量子化閾値パラメータに移される、このように、αを、低いビットの形態で格納されているオリジナルパラメータWに含まれなくても、移されるαは、ネットワークモデルの動作中に量子化された閾値パラメータの形態で使用され、これによりネットワークモデルの精度を改善する。 In the conventional method, when it is desired to store the original parameter W in a low bit (for example, 1 bit), it is difficult to include α in the original parameter W in a low bit, and α is used during the operation of the network model. It's difficult to do. However, after the method of the first embodiment of the present invention is applied, α is transferred to the quantization threshold parameter of the quantization layer, especially after the expansion of equation (10). Even if not included in the original parameter W stored in the form of lower bits, the transferred α is used in the form of a quantized threshold parameter during the operation of the network model, which improves the accuracy of the network model. To do.
なお、式(6)〜式(10)の演算手順を、図5Aのサブ構造を例に取り説明し、本発明の実施形態は他のサブ構造に限定しない。異なる複数のサブ構造について、量子化閾値パラメータを更新するように、階層のそれぞれにおける演算パラメータおよび演算手順が同様に、最上層から最下層まで量子化層に対して転送される場合、量子化閾値パラメータを更新するアルゴリズムおよび結果もまた異なる。本発明の実施形態は、本発明の実施形態にて説明したサブ構造が満たされ、且つ量子化層の上の階層のそれぞれにおける演算パラメータおよび演算手順が順次、それらが量子化層に転送されるまでステップS203にて説明した方法に従って転送される限りは、特定のサブ構造についての量子化閾値パラメータの更新アルゴリズムを限定しない。 The calculation procedure of equations (6) to (10) will be described by taking the substructure of FIG. 5A as an example, and the embodiment of the present invention is not limited to other substructures. Quantization thresholds when the arithmetic parameters and procedures in each of the layers are similarly transferred to the quantization layer from the top layer to the bottom layer, such as updating the quantization threshold parameters for different substructures. The algorithms and results for updating the parameters are also different. In the embodiment of the present invention, the substructure described in the embodiment of the present invention is satisfied, and the calculation parameters and the calculation procedure in each of the layers above the quantization layer are sequentially transferred to the quantization layer. The algorithm for updating the quantization threshold parameter for a specific substructure is not limited as long as it is transferred according to the method described in step S203.
好ましくは、転送ステップが実行されない場合の、式(4)における量子化閾値パラメータ間の関係を考慮し、式(4)は式(11)に展開される。 Preferably, the equation (4) is expanded into the equation (11) in consideration of the relationship between the quantization threshold parameters in the equation (4) when the transfer step is not executed.
式(4)が式(11)に展開され、その後、式(11)が式(7)のアルゴリズムと同じアルゴリズムに従って式(9)に展開された後では、式(12)が得られる。 After the equation (4) is expanded into the equation (11) and then the equation (11) is expanded into the equation (9) according to the same algorithm as the algorithm of the equation (7), the equation (12) is obtained.
更に、式(12)は式(13)に展開される。 Further, equation (12) is expanded into equation (13).
式(13)では、 In equation (13),
を基本係数γ、 The basic coefficient γ,
をシフト係数δとすると、式(13)は式(14)に簡略化される。 Is a shift coefficient δ, the equation (13) is simplified to the equation (14).
式(14)を参照すると、転送ステップ後に更新された量子化閾値パラメータは、1つの基本係数γ、1つのシフト係数δ、基本係数γに対して異なる量子化閾値パラメータ間の相関関係により表されることが分かる。従って、更新された量子化閾値パラメータが保存されると、基本係数γ、シフト係数δ、基本係数γに対する量子化閾値パラメータ間の相関関係、のみが保存され、全ての量子化閾値パラメータを順次保存する必要はなく、これにより、記憶スペースを節約する。 With reference to equation (14), the quantization threshold parameter updated after the transfer step is represented by the correlation between different quantization threshold parameters for one fundamental coefficient γ, one shift coefficient δ, and basic coefficient γ. It turns out that Therefore, when the updated quantization threshold parameters are saved, only the fundamental coefficient γ, the shift coefficient δ, and the correlation between the quantization threshold parameters with respect to the fundamental coefficient γ are saved, and all the quantization threshold parameters are sequentially saved. This saves storage space.
上記の式(14)の表現形態は簡単な数学的変換により変更されるので、本発明の実施形態は特に、上記の式(14)における基本係数γに対する量子化閾値パラメータ間の相関関係、δ、γを限定しない。例えば、式(14)における1.5γをγ+0.5γとして表し、2.5γを2γ+0.5γとして表し、その後、式(14)の1.5γ+δをγ+0.5γ+δ=γ+δ’として表しても良いし、2.5γ+δを2γ+0.5γ+δ=2γ+δ’として表しても良く、ここでδ’=0.5γ+δである。このように、上記の式(14)はγおよびδ’により表される新しい式に変換される。 Since the expression form of the above equation (14) is changed by a simple mathematical transformation, the embodiment of the present invention particularly describes the correlation between the quantization threshold parameters with respect to the basic coefficient γ in the above equation (14), δ. , Γ is not limited. For example, 1.5γ in the formula (14) may be represented as γ + 0.5γ, 2.5γ may be represented as 2γ + 0.5γ, and then 1.5γ + δ in the formula (14) may be represented as γ + 0.5γ + δ = γ + δ'. , 2.5γ + δ may be expressed as 2γ + 0.5γ + δ = 2γ + δ', where δ'= 0.5γ + δ. In this way, the above equation (14) is converted into a new equation represented by γ and δ'.
なお、選択された中心点要素として4つの数値(0,0.538、1.076、1.614)を用い、選択された中心点要素を平均化する方法で量子化閾値パラメータが決定され、且つ量子化層の上層からの入力特徴マップ中のそれぞれの要素がk=2ビットで表される数値空間に量子化(マップ)されるケースを例にとって式(4)が説明されているので、4種類の結果(すなわち、0,1,2,もしくは3)が式(14)において出力され、量子化閾値パラメータと非0最小項β’との間に変倍関係(すなわち、1.5倍および2.5倍)がある。しかし、量子化閾値パラメータが式(4)において他の方法で決定され、kの値が2以外の数値である場合、展開された式(11)〜式(14)における量子化閾値パラメータ間の相関関係が、それに応じて変わってしまう。例えば、式(14)と比較してより広い範囲をカバーする式(15)が得られる。 In addition, four numerical values (0,0.538, 1.076, 1.614) are used as the selected center point elements, and the quantization threshold parameter is determined by a method of averaging the selected center point elements. Moreover, since the equation (4) is explained by taking as an example the case where each element in the input feature map from the upper layer of the quantization layer is quantized (mapped) into the numerical space represented by k = 2 bits. Four kinds of results (that is, 0, 1, 2, or 3) are output in the equation (14), and a scaling relationship (that is, 1.5 times) between the quantization threshold parameter and the non-zero minimum term β'. And 2.5 times). However, when the quantization threshold parameter is determined by another method in the equation (4) and the value of k is a numerical value other than 2, between the quantization threshold parameters in the expanded equations (11) to (14). The correlation changes accordingly. For example, an equation (15) that covers a wider range than the equation (14) can be obtained.
ここで、kは、量子化(マッピング)のための数値空間がkビットで表されることを示しており、thr1”〜 Here, k indicates that the numerical space for quantization (mapping) is represented by k bits, and thr1 ”~.
は、特定の中心要素選択方法と特定の量子化閾値パラメータ決定方法とを用いる場合の閾値間の相関関係を具体化する簡単化した表現を表す。 Represents a simplified representation that embodies the correlation between thresholds when using a particular central element selection method and a particular quantization threshold parameter determination method.
しかし、たとえ量子化閾値パラメータを決定するために式(4)において方法が用いられても、量子化閾値パラメータ間に相関関係がある限りは、量子化閾値パラメータを簡単化するために式(11)〜式(14)に示される方法が使用されることは理解されるべきであり、これにより記憶スペースを節約する。 However, even if the method is used in equation (4) to determine the quantization threshold parameters, as long as there is a correlation between the quantization threshold parameters, the equation (11) is used to simplify the quantization threshold parameters. ) ~ It should be understood that the method of equation (14) is used, which saves storage space.
式(14)は実質的には式(10)と同じであり、これらはここでは2つの異なる表現の形式で説明される。本発明の実施形態は、式(14)および式(10)における他の変更に限定されない。 Equation (14) is substantially the same as Equation (10), which are described here in two different forms of expression. Embodiments of the present invention are not limited to other modifications in formula (14) and formula (10).
<ステップS204におけるサブ構造を簡単化する例>
さらに、図5Aに示されるサブ構造を例にとると、畳み込み層およびバッチ正規化層における演算パラメータおよび演算手順が同様に、ちょうど式(10)によって表されるように量子化層に転送された後、一方では、バッチ正規化層における演算パラメータおよび演算手順が完全に量子化層に同様に転送されたので、バッチ正規化層がサブ構造から削除され、一方では、畳み込み層の畳み込みフィルタのスケーリングパラメータおよびオフセットパラメータもまた量子化層に転送されるが、畳み込みフィルタのスケーリングパラメータおよびオフセットパラメータとは無関係の演算
<Example of simplifying the substructure in step S204>
Further, taking the substructure shown in FIG. 5A as an example, the arithmetic parameters and procedures in the convolution layer and the batch normalization layer were similarly transferred to the quantization layer as represented by Eq. (10). Later, on the one hand, the operation parameters and procedures in the batch normalization layer were completely transferred to the quantization layer as well, so that the batch normalization layer was removed from the substructure, and on the other hand, the scaling of the convolution filter of the convolution layer. Parameters and offset parameters are also transferred to the quantization layer, but operations independent of the convolution filter scaling and offset parameters.
を畳み込み層がさらに実行するので、畳み込み層は削除できない。ステップS204におけるサブ構造を簡単化する処理の後、多階層ニューラルネットワークモデルの構造は大いに簡単化される。上記の単純化された原則に基づき、図2Aに示されるバイナリ畳み込みニューラルネットワークモデルは、図2Dに示される、サブ構造における量子化層がジョイント量子化層になる、簡単化された構造に変化する。 The convolution layer cannot be deleted because the convolution layer does more. After the process of simplifying the substructure in step S204, the structure of the multi-layer neural network model is greatly simplified. Based on the above simplified principle, the binary convolutional neural network model shown in FIG. 2A is transformed into the simplified structure shown in FIG. 2D, where the quantization layer in the substructure becomes the joint quantization layer. ..
なお、図5Aに示されるサブ構造を説明のために例にとると、本発明の実施形態は特定のサブ構造に限定を加えない。サブ構造における演算パラメータおよび演算手順が完全に量子化層に転送される階層である限りは、そのような階層はサブ構造から削除されても良い。 Taking the substructure shown in FIG. 5A as an example for explanation, the embodiment of the present invention does not limit a specific substructure. Such hierarchies may be removed from the substructure as long as the arithmetic parameters and procedures in the substructure are completely transferred to the quantization layer.
<ステップS205における固定小数点の例>
本発明の実施形態における固定小数点処理の一例を、Q値技術を例にとり説明する。図2Dに示される簡単化処理が行われたバイナリ畳み込みニューラルネットワークモデルのそれぞれの階層について、Q値がそれぞれ設定されるとすると、特定の固定小数点手順は以下の通りである。
<Example of fixed point in step S205>
An example of fixed-point processing in the embodiment of the present invention will be described by taking Q value technology as an example. Assuming that Q values are set for each layer of the simplified binary convolutional neural network model shown in FIG. 2D, the specific fixed-point procedure is as follows.
図2Dに示されるネットワークモデルにおける5つのサブ構造は、ステップS203において転送されたデータに基づくジョイント量子化処理と、ステップS204におけるサブ構造簡単化処理と、が行われ、ネットワークモデルにおけるバイナリ畳み込み層2からバイナリ畳み込み層7における演算パラメータが整数であるから、バイナリ畳み込み層2からバイナリ畳み込み層7に対するQ値は1であり、他の階層における演算パラメータはまだ浮動小数点数であるから、フル精度畳み込み層1および量子化層1に対するQ値は9であり、フル精度畳み込み層8に対するQ値は13であり、これにより、図2Dに示されるモデルにおける階層のそれぞれにおける演算パラメータは全て、固定小数点パラメータに変換される。表2は、図2Dに示されるネットワークモデルに対して指定されたQ値の表である。 The five substructures in the network model shown in FIG. 2D are subjected to joint quantization processing based on the data transferred in step S203 and substructure simplification processing in step S204, and the binary convolution layer 2 in the network model is performed. Since the arithmetic parameters in the binary convolution layer 7 are integers, the Q value for the binary convolution layer 2 to the binary convolution layer 7 is 1, and the arithmetic parameters in the other layers are still floating point numbers, so the full precision convolution layer. The Q value for 1 and the quantization layer 1 is 9, and the Q value for the full precision convolution layer 8 is 13, so that all the arithmetic parameters in each of the hierarchies in the model shown in FIG. 2D are fixed point parameters. Will be converted. Table 2 is a table of Q values specified for the network model shown in FIG. 2D.
<第1の実施形態の効果>
図6の左側は、本発明の実施形態の最適化方法を使用していない部分的な多階層ニューラルネットワークモデルの演算手順の一部を示し、右側は、本発明の実施形態の最適化方法を使用した多階層ニューラルネットワークモデルの演算手順の一部を示す。理解を容易にするために、左側の畳み込み層における演算は、式(2)と同様の意味である、Convolve(Wb,Xq)および
<Effect of the first embodiment>
The left side of FIG. 6 shows a part of the calculation procedure of a partial multi-layer neural network model that does not use the optimization method of the embodiment of the present invention, and the right side shows the optimization method of the embodiment of the present invention. A part of the calculation procedure of the multi-layer neural network model used is shown. For ease of understanding, the operations on the left convolution layer have the same meaning as equation (2), Convolve (W b , X q ) and
により表され、ここで、Convolveは畳み込み演算を意味し、βおよびXqはそれぞれ、式(2)におけるX1により量子化された整数部分と非0最小項パラメータの表現と同様であり、バッチ正規化層における演算は、式(5)と同様の意味である、 Represented by, where Convolve means a convolution operation, where β and X q are similar to the representations of the integer part quantized by X 1 and the non-zero minimum parameter in equation (2), respectively, in batches. The operation in the normalization layer has the same meaning as in Eq. (5).
により表され、ここで、BNはバッチ正規化演算を意味し、量子化層における演算は、式(6)と同様の意味である、 Here, BN means a batch normalization operation, and the operation in the quantization layer has the same meaning as in Eq. (6).
により表され、ここで、thr0,thr1…は式(6)における量子化閾値パラメータであり、Quantは量子化演算を意味する。本発明の実施形態の最適化方法の後、右側における畳み込み層における演算は、畳み込みフィルタのスケーリングパラメータ及びオフセットパラメータとは無関係であり且つConvolve(Wb,Xq)により表され、バッチ正規化演算は省略され、量子化層における演算は、 Here, thr 0 , thr 1 ... Are the quantization threshold parameters in the equation (6), and Quant means the quantization operation. After the optimization method of the embodiment of the present invention, the operation in the convolution layer on the right side is independent of the scaling parameter and offset parameter of the convolution filter and is represented by Convolve (W b , X q ), and is a batch normalization operation. Is omitted, and the operations in the quantization layer are
により表される。 Represented by.
第1の実施形態に基づく方法では、多階層ニューラルネットワークモデルからサブ構造を分割し、サブ構造のそれぞれにおける最上層から最下層まで、末尾の量子化層に対して、階層のそれぞれにおける演算パラメータおよび演算手順を転送することで、量子化層における量子化閾値パラメータが更新され、量子化層は入力特徴マップにおける要素を整数に量子化(マップ)する。最適化されたネットワークモデルが適用される場合、従来のネットワークモデルにおける演算手順と比べて、最適化されたネットワークモデルにおける演算手順は効率的に、必要なサーバ資源を削減し、また、メモリ空間を節約し、同時に、ネットワークモデルの記憶スペースも節約し、組み込み機器において多階層ニューラルネットワークモデルが動作することを可能にする。さらに、実施形態の方法によれば、簡単化処理および固定小数点処理がネットワークモデル上でさらに実行され、更に最適化されたネットワークモデルが適用される場合、最適化された多階層ニューラルネットワークモデルを保存するための記憶スペースが更に削減され、従来のネットワークモデルにおける演算手順と比べて、ネットワークモデルを動作させるために必要なサーバ資源がさらに削減される。 In the method based on the first embodiment, the substructure is divided from the multi-layer neural network model, and the arithmetic parameters and the arithmetic parameters in each of the layers are divided from the top layer to the bottom layer in each of the substructures, with respect to the quantized layer at the end. By transferring the arithmetic procedure, the quantization threshold parameter in the quantization layer is updated, and the quantization layer quantizes (maps) the elements in the input feature map to integers. When an optimized network model is applied, the arithmetic procedure in the optimized network model efficiently reduces the required server resources and saves memory space compared to the arithmetic procedure in the conventional network model. It saves, and at the same time, saves the storage space of the network model, allowing the multi-layer neural network model to work in embedded devices. Further, according to the method of the embodiment, if simplification processing and fixed point processing are further performed on the network model and a further optimized network model is applied, the optimized multi-layer neural network model is saved. The storage space for this is further reduced, and the server resources required to operate the network model are further reduced as compared with the calculation procedure in the conventional network model.
第1の実施形態の最適化方法を用いて多階層ニューラルネットワークモデルを最適化した後、最適化されたネットワークモデルは適用される。例えば、画像分類のアプリケーションは、写真および対応する注釈付き真理値の入力など、多階層ニューラルネットワークモデルにより実行可能なタスク要求に対応するデータセットを入力することで実行される。出願人は、従来の多階層ニューラルネットワークモデル(本発明の実施形態の方法を用いて最適化されていないネットワークモデル)と、適用された場合の本発明の実施形態の方法を用いて最適化された多階層ニューラルネットワークモデルと、の精度性能を比較し、2つのネットワークモデルの全体的な精度性能は実質的には互いに近いことが分かった。バイナリ畳み込みニューラルネットワークモデルを用いて写真分類サービスが実行されるというケースを例にとると、本発明の実施形態の方法の使用なしでバイナリ畳み込みニューラルネットワークモデルの精度性能と、本発明の実施形態の方法を使用したネットワークモデルの精度性能と、は互いに近い。表3を参照すると、それらの写真分類精度はそれぞれ52.22%および52.21%であり、精度差は0.01%であり、ごくわずかである。従って、多階層ニューラルネットワークモデルが本発明の実施形態の方法を用いて最適化された後、従来の多階層ニューラルネットワークモデルと比べて、タスク処理の精度を維持しつつ、ネットワークモデルの全体演算コスト(必要なプロセッサ資源およびコンテンツリソース)および記憶要求を大幅に下げる。 After optimizing the multi-layer neural network model using the optimization method of the first embodiment, the optimized network model is applied. For example, an image classification application is performed by entering a dataset that corresponds to a task request that can be performed by a multi-layer neural network model, such as entering a photo and the corresponding annotated truth value. Applicants are optimized using conventional multi-layer neural network models (network models that are not optimized using the methods of the embodiments of the invention) and the methods of the embodiments of the invention when applied. By comparing the accuracy performance of the multi-layer neural network model, it was found that the overall accuracy performance of the two network models is substantially close to each other. Taking the case where the photo classification service is executed using the binary convolutional neural network model as an example, the accuracy performance of the binary convolutional neural network model and the embodiment of the present invention without using the method of the embodiment of the present invention. The accuracy performance of the network model using the method is close to each other. Referring to Table 3, their photo classification accuracy is 52.22% and 52.21%, respectively, and the accuracy difference is 0.01%, which is very small. Therefore, after the multi-layer neural network model is optimized using the method of the embodiment of the present invention, the overall calculation cost of the network model is maintained while maintaining the accuracy of task processing as compared with the conventional multi-layer neural network model. Significantly reduce (required processor and content resources) and storage requirements.
<第2の実施形態>
本発明の第2の実施形態は、多階層ニューラルネットワークモデルを最適化する装置を説明し、図7に示されるように、装置は、サブ構造分割モジュール301およびデータ転送モジュール302を含む。サブ構造分割モジュール301は第1の実施形態におけるステップS202で処理を実行し、データ転送モジュール302は第1の実施形態におけるステップS203で処理を実行する。具体的には、サブ構造分割モジュール301は、多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割するように構成されており、ここで、分割されたサブ構造の末尾の階層は量子化層であり、データ転送モジュール302は、量子化層以外の階層における演算パラメータおよび演算手順を、分割されたサブ構造のそれぞれについて量子化層に転送して量子化層における量子化閾値パラメータを更新するように構成されており、これにより最適化された多階層ニューラルネットワークモデルを生成する。
<Second embodiment>
A second embodiment of the present invention describes an apparatus for optimizing a multi-layer neural network model, which includes a
好ましくは、畳み込み層はさらに、分割されたサブ構造に含まれている。より好ましくは、サブ構造の先頭の階層は畳み込み層であり、末尾の階層は量子化層である。先頭の階層と末尾の階層との間にバッチ正規化層、プーリング層、スケーリング層、等の他の階層があっても良いし、他の階層が無くても良い。分割されたサブ構造の数が少なくとも2である場合は、サブ構造間には入れ子はない。 Preferably, the convolution layer is further included in the divided substructure. More preferably, the first layer of the substructure is the convolution layer and the last layer is the quantization layer. There may be other layers such as a batch regularization layer, a pooling layer, a scaling layer, etc. between the first layer and the last layer, or there may be no other layers. If the number of substructures divided is at least 2, there is no nesting between the substructures.
データ転送モジュール302はさらに、階層のそれぞれにおける演算パラメータおよび演算手順が全て量子化層に転送されるまで、1つのサブ構造における量子化層以外の階層のそれぞれについて、最上層から最下層まで、上層における演算パラメータおよび演算手順を下層に転送して、量子化層における量子化閾値パラメータを更新するように構成されている。
The
上記のサブ構造分割モジュール301およびデータ転送モジュール302に加えて、多階層ニューラルネットワークモデルを最適化する装置は、最適化される多階層ニューラルネットワークモデルを取得するように構成されている前処理モジュール303を更に含む。前処理モジュール303は、第1の実施形態におけるステップS201において処理を実行する。
In addition to the
好適には、多階層ニューラルネットワークモデルを最適化する装置は、それぞれのサブ構造における量子化層以外の階層について、演算パラメータおよび演算手順が量子化層に転送された階層を、サブ構造から除去するように構成されているサブ構造簡単化モジュール304を更に含む。サブ構造簡単化モジュール304は、第1の実施形態におけるステップS204において処理を行う。
Preferably, the device that optimizes the multi-layer neural network model removes from the substructure the layers in which the arithmetic parameters and procedures have been transferred to the quantization layer for the layers other than the quantization layer in each substructure. It further includes a
好ましくは、多階層ニューラルネットワークモデルを最適化する装置は、多階層ニューラルネットワークモデルにおける階層のそれぞれについて固定小数点処理を実行して、それぞれの階層における浮動小数点演算パラメータを固定小数点パラメータに変換するように構成されている固定小数点モジュール305を更に含む。固定小数点モジュール305は、第1の実施形態におけるステップS205において処理を行う。
Preferably, the device that optimizes the multi-layer neural network model performs fixed-point processing for each layer in the multi-layer neural network model and converts the floating-point arithmetic parameters in each layer to fixed-point parameters. It further includes a configured fixed-
好ましくは、多階層ニューラルネットワークモデルを最適化する装置は、最適化された多階層ニューラルネットワークモデルを保存するように構成されている保存モジュール306を更に含む。
Preferably, the device for optimizing the multi-layer neural network model further includes a
多階層ニューラルネットワークモデルが第2の実施形態の最適化装置により最適化された後、最適化されたネットワークモデルは、多階層ニューラルネットワークモデルを適用する装置を用いて動作される。適用装置は、ネットワークモデルを動作させる既知の装置であり、ネットワークモデルにより実行可能なタスク要求に対応するデータセットを、最適化された多階層ニューラルネットワークモデルに入力する入力モジュールと、最適化された多階層ニューラルネットワークモデルにおける最上層から最下層までの階層のそれぞれにおいてデータセットを演算して結果を出力する演算モジュールと、を含む。 After the multi-layer neural network model has been optimized by the optimizer of the second embodiment, the optimized network model is operated using an device that applies the multi-layer neural network model. The applicable device is a known device that operates the network model, and is optimized with an input module that inputs a data set corresponding to a task request that can be executed by the network model into an optimized multi-layer neural network model. It includes a calculation module that calculates a data set and outputs a result in each of the layers from the top layer to the bottom layer in a multi-layer neural network model.
更に、量子化閾値パラメータを格納するための記憶空間を節約するために、第1の実施形態の多階層ニューラルネットワークモデルに対する最適化方法では、転送ステップ後に更新された量子化閾値パラメータは、基本係数γ、シフト係数δ、基本係数γに対する異なる量子化閾値パラメータ間の相関関係により前述の式(14)に基づいて表され、すなわち、γ、δ、基本係数γに対する異なる量子化閾値パラメータ間の相関関係は格納される。その後、第1の実施形態を経て最適化されたネットワークモデルが適用装置によって動作される場合、演算モジュールは、入力されたデータセットがネットワークモデルにおける最上層から最下層までの量子化層について演算される場合に、γ、δ、γに対する量子化閾値パラメータ間の相関関係を用いて量子化閾値パラメータを決定し、その後、決定した量子化閾値パラメータに基づいて、データセットに対して量子化処理を行う。 Further, in order to save storage space for storing the quantization threshold parameters, in the optimization method for the multi-layered neural network model of the first embodiment, the quantization threshold parameters updated after the transfer step are the basic coefficients. It is expressed based on the above equation (14) by the correlation between different quantization threshold parameters for γ, shift coefficient δ, and basic coefficient γ, that is, the correlation between different quantization threshold parameters for γ, δ, and basic coefficient γ. Relationships are stored. Then, when the network model optimized through the first embodiment is operated by the applicable apparatus, the arithmetic module is computed on the input data set for the top-to-bottom quantization layer in the network model. In this case, the quantization threshold parameter is determined using the correlation between the quantization threshold parameters for γ, δ, and γ, and then the quantization process is performed on the data set based on the determined quantization threshold parameter. Do.
図8は、適用装置における演算モジュールの構成を示しており、データセットが入力モジュールを介して入力されると、図8に示される構成を介してデータセットが処理される。図8を参照すると、演算モジュールは、ネットワークモデル記憶ユニット401、特徴マップ記憶ユニット402、畳み込みユニット403、プーリング/活性化ユニット404、量子化ユニット405、およびコントロールユニット406、を有する。それぞれのユニットはそれぞれ、以下に説明される。
FIG. 8 shows the configuration of the arithmetic module in the application device, and when the data set is input via the input module, the data set is processed via the configuration shown in FIG. Referring to FIG. 8, the arithmetic module includes a network
ネットワークモデル記憶ユニット401は、第1の実施形態の最適化方法を用いて取得される、多階層ニューラルネットワークモデルに関する情報を記憶する。しかし多階層ニューラルネットワークモデルに関する情報はネットワーク構造情報に限らず、量子化層に転送された量子化閾値パラメータの情報、および他の階層のそれぞれにおいて行われる演算に要する情報、を含む。ここで、量子化層に転送される量子化閾値パラメータの情報は、γ、δ、γに対する量子化閾値パラメータ間の相関関係であっても良いし、量子化閾値パラメータを特徴付けることが可能な他の情報や量子化閾値パラメータそれら自身であっても良い。特徴マップ記憶ユニット402は、ネットワークモデルにおける演算中に要する特徴マップ情報を記憶する。
The network
畳み込みユニット403は、特徴マップ記憶ユニット402により入力されるi番目の階層の特徴マップ情報(すなわちXq)と、ネットワークモデル記憶ユニット401により入力される情報(すなわちWb)と、に従ってデータセットに対する畳み込み処理を行うために用いられる。プーリング/活性化ユニット404は、畳み込みユニット403の出力
The
およびネットワークモデル記憶ユニット401により入力される情報(例えば、プーリング/活性化処理が実行されるときに要する情報、ここで、ネットワークモデル記憶ユニット401は如何なる情報も入力していなくてもよい)に従って、データセットに対するプーリング/活性化処理を実行するために使用される。量子化ユニット405は、ネットワークモデル記憶ユニット401により入力された量子化閾値パラメータと、プーリング/活性化ユニット404から出力された結果と、に従って、データセットに対して量子化処理を実行するために使用され、量子化処理後の結果は、特徴マップ記憶ユニット402に格納される。コントロールユニット406は、制御信号を図8における他のユニットに対して出力することで、ネットワークモデル記憶ユニット401〜量子化ユニット405の動作を制御する。
And according to the information input by the network model storage unit 401 (eg, the information required when the pooling / activation process is performed, where the network
注意すべきことは、プーリング/活性化処理を実行可能なプーリング/活性化ユニット404は、図8に示される構成において一例として示されており、含まれても良い正規化処理およびスケーリング処理を実行可能な他のユニットは省略される。ここでは繰り返されない。加えて、ネットワークモデル記憶ユニット401に記憶されているネットワーク構造情報により示されるサブ構造において、バッチ正規化層、プーリング層、およびスケーリング層などのうち1つ以上が畳み込み層と量子化層との間にあっても良いし、また、これらの階層の何れもなくても良い。例えば、サブ構造において畳み込み層および量子化層のみが存在する場合、畳み込みユニット403の出力結果は、直接量子化ユニット405にアクセス可能である。
It should be noted that the pooling /
その他の実施例
記憶媒体(さらに「非一時コンピュータ読み取り可能な記憶媒体」としても良い)に記録されたコンピュータ実行可能な命令(例えば1つ以上のプログラム)を読み出して実行して前述の実施形態の1つ以上の機能を実行するシステム又は装置のコンピュータ、および/または前述した実施形態の1つ以上の機能を実行する1つ以上の回路(例えば、特定用途向け集積回路(ASIC))を含むシステム若しくは装置のコンピュータ、および例えば、上記システム又は装置のコンピュータにより、記憶媒体からコンピュータ実行可能な命令を読み出して実行して前述した実施形態の1つ以上の機能を実行すること、および/または1つ以上の回路を制御して前述した実施形態の1つ以上の機能を実行することにより行われる方法により本発明の実施形態を実現することもできる。上記コンピュータは、一つ以上のプロセッサ(例えば中央処理装置(CPU))、マイクロプロセッシングユニット(MPU)を構成し、別々のコンピュータのネットワーク又は別々のプロセッサを有してコンピュータ実行可能な命令を読み出して実行するようにしてもよい。上記コンピュータ実行可能な命令は、上記コンピュータに対して例えばネットワークや上記記憶媒体から提供されてもよい。上記記憶媒体は、例えば、ハードディスク、ランダムアクセスメモリ(RAM)、リードオンリーメモリ(ROM)、分散コンピューティングシステムのストレージ、光ディスク(コンパクトディスク(CD)、デジタル多用途ディスク(DVD)、Blu−ray Disc (BD)(記録商標)等)、フラッシュメモリ機器、メモリカード等のうち1つ以上を有してもよい。
Other Examples Of the above-described embodiment, a computer-executable instruction (for example, one or more programs) recorded on a storage medium (which may also be a “non-temporary computer-readable storage medium”) is read and executed. A computer of a system or device that performs one or more functions, and / or a system that includes one or more circuits that perform one or more functions of the aforementioned embodiments (eg, an application-specific integrated circuit (ASIC)). Alternatively, the computer of the device and, for example, the computer of the system or device may read and execute a computer-executable instruction from the storage medium to perform one or more functions of the above-described embodiment, and / or one. An embodiment of the present invention can also be realized by a method performed by controlling the above circuit and executing one or more functions of the above-described embodiment. The computer constitutes one or more processors (for example, a central processing unit (CPU)), a microprocessing unit (MPU), and has a network of different computers or a separate processor to read computer-executable instructions. You may want to do it. The computer-executable instructions may be provided to the computer, for example, from a network or storage medium. The storage medium includes, for example, a hard disk, a random access memory (RAM), a read-only memory (ROM), a storage of a distributed computing system, an optical disk (compact disk (CD), a digital versatile disk (DVD), a Blu-ray Disc). (BD) (Recording trademark), etc.), a flash memory device, a memory card, or the like.
前述の実施形態の機能を実行するソフトウェア(プログラム)を、ネットワーク若しくは様々な記憶媒体を介してシステム若しくは装置に供給し、システムもしくは装置のコンピュータ、もしくは中央処理装置(CPU)、マイクロプロセッシングユニット(MPU)等によりプログラムの方法を読み出して実行する方法により、本発明の実施形態を実現することもできる。 Software (program) that executes the functions of the above-described embodiment is supplied to the system or device via a network or various storage media, and the computer of the system or device, or the central processing unit (CPU), microprocessing unit (MPU). The embodiment of the present invention can also be realized by a method of reading and executing the method of the program by means of) or the like.
本発明を実施形態を参照して説明したが、本発明は記載した実施形態に限定されないことが理解されるべきである。以下の請求項の範囲は、全ての変形や同等な構成や機能を含み、最大に広く解釈されるべきである。 Although the present invention has been described with reference to embodiments, it should be understood that the invention is not limited to the described embodiments. The scope of the following claims should be construed to the maximum extent, including all modifications and equivalent configurations and functions.
Claims (15)
前記多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割するサブ構造分割モジュールであって、ここで、前記分割されたサブ構造の末尾の階層は量子化層であり、
前記分割されたサブ構造のそれぞれについて、前記量子化層以外の階層における演算パラメータを前記量子化層に転送し、前記転送された演算パラメータに基づいて、前記量子化層における量子化閾値パラメータを更新するデータ転送モジュールと
を備えることを特徴とする装置。 A device that optimizes multi-layer neural network models
A substructure division module that divides at least one substructure from the multi-layer neural network model, wherein the last layer of the divided substructure is a quantization layer.
For each of the divided substructures, the arithmetic parameters in the layers other than the quantization layer are transferred to the quantization layer, and the quantization threshold parameters in the quantization layer are updated based on the transferred arithmetic parameters. A device characterized by being provided with a data transfer module.
前記量子化層に対して前記演算パラメータが完全に転送された階層を、前記サブ構造から削除するサブ構造簡単化モジュールを備えることを特徴とする請求項1に記載の装置。 In addition
The apparatus according to claim 1, further comprising a substructure simplification module for deleting the layer in which the arithmetic parameters are completely transferred to the quantization layer from the substructure.
浮動小数点演算パラメータが固定小数点パラメータに変換されるように、前記多階層ニューラルネットワークモデルにおける階層のそれぞれについて固定小数点処理を実行する固定小数点モジュールを備えることを特徴とする請求項1に記載の装置。 In addition
The apparatus according to claim 1, further comprising a fixed-point module that performs fixed-point processing for each of the layers in the multi-layer neural network model so that the floating-point arithmetic parameters are converted into fixed-point parameters.
前記多階層ニューラルネットワークモデルを保存する保存モジュールと、
前記多階層ニューラルネットワークモデルにより実行されることが可能なタスク要求に対応するデータセットを、前記保存された多階層ニューラルネットワークモデルに入力する入力モジュールと、
前記多階層ニューラルネットワークモデルにおける最上層から最下層の階層のそれぞれにおいて前記データセットを演算して結果を出力する演算モジュールと
を備え、
前記多階層ニューラルネットワークモデルは量子化層を含み、前記保存モジュールは当該量子化層における量子化閾値パラメータの情報を保存しており、
前記演算モジュールは、前記量子化閾値パラメータの情報が示す基本係数、シフト係数、および前記基本係数に対する前記量子化閾値パラメータ間の相関関係に基づいて決定される量子化閾値パラメータに基づいて、前記データセットに対して前記量子化層において量子化処理を行うことを特徴とする装置。 A device that applies a multi-layer neural network model
A storage module that stores the multi-layer neural network model,
An input module that inputs a data set corresponding to a task request that can be executed by the multi-layer neural network model into the stored multi-layer neural network model.
It is provided with a calculation module that calculates the data set and outputs the result in each of the layers from the top layer to the bottom layer in the multi-layer neural network model.
The multi-layer neural network model includes a quantization layer, and the storage module stores information on quantization threshold parameters in the quantization layer.
The calculation module is based on the quantization threshold parameter determined based on the fundamental coefficient, the shift coefficient, and the correlation between the quantization threshold parameter with respect to the basic coefficient indicated by the information of the quantization threshold parameter. An apparatus characterized in that a set is subjected to a quantization process in the quantization layer.
前記多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割することと、ここで、前記分割されたサブ構造の末尾の階層は量子化層であり、
前記分割されたサブ構造のそれぞれについて、前記量子化層以外の階層における演算パラメータを前記量子化層に転送し、前記転送された演算パラメータに基づいて、前記量子化層における量子化閾値パラメータを更新することと
を有することを特徴とする方法。 A method of optimizing a multi-layer neural network model
Dividing at least one substructure from the multi-layered neural network model, where the last layer of the divided substructure is the quantization layer.
For each of the divided substructures, the arithmetic parameters in the layers other than the quantization layer are transferred to the quantization layer, and the quantization threshold parameters in the quantization layer are updated based on the transferred arithmetic parameters. A method characterized by having to do and have.
前記多階層ニューラルネットワークモデルを保存することと、
前記多階層ニューラルネットワークモデルにより実行されることが可能なタスク要求に対応するデータセットを、前記保存された多階層ニューラルネットワークモデルに入力することと、
前記多階層ニューラルネットワークモデルにおける最上層から最下層の階層のそれぞれにおいて前記データセットを演算して結果を出力することと
を有し、
前記多階層ニューラルネットワークモデルは量子化層を含み、当該量子化層における量子化閾値パラメータの情報を保存しており、
更に、前記演算において、前記量子化閾値パラメータの情報が示す基本係数、シフト係数、および前記基本係数に対する前記量子化閾値パラメータ間の相関関係に基づいて決定される量子化閾値パラメータに基づいて、前記データセットに対して前記量子化層において量子化処理を行うことを特徴とする方法。 A method of applying a multi-layer neural network model,
Saving the multi-layer neural network model and
Inputting a data set corresponding to a task request that can be executed by the multi-layer neural network model into the stored multi-layer neural network model, and
It has the function of calculating the data set in each of the layers from the top layer to the bottom layer in the multi-layer neural network model and outputting the result.
The multi-layer neural network model includes a quantization layer and stores information on quantization threshold parameters in the quantization layer.
Further, in the calculation, based on the quantization threshold parameter determined based on the basic coefficient, the shift coefficient, and the correlation between the quantization threshold parameters with respect to the basic coefficient indicated by the information of the quantization threshold parameter. A method characterized in that a data set is subjected to a quantization process in the quantization layer.
最適化される前記多階層ニューラルネットワークモデルから少なくとも1つのサブ構造を分割することと、ここで、前記分割されたサブ構造の末尾の階層は量子化層であり、
前記分割されたサブ構造のそれぞれについて、前記量子化層以外の階層における演算パラメータを前記量子化層に転送し、前記転送された演算パラメータに基づいて、前記量子化層における量子化閾値パラメータを更新することと
を有することを特徴とする非一時的なコンピュータ読み取り可能な記憶媒体。 A non-temporary computer-readable storage medium that stores instructions for causing the computer to execute a method of optimizing a multi-layer neural network model when executed by a computer.
Dividing at least one substructure from the optimized multi-layer neural network model, where the last layer of the divided substructure is the quantization layer.
For each of the divided substructures, the arithmetic parameters in the layers other than the quantization layer are transferred to the quantization layer, and the quantization threshold parameters in the quantization layer are updated based on the transferred arithmetic parameters. A non-temporary computer-readable storage medium characterized by having to do.
前記多階層ニューラルネットワークモデルを保存することと、
前記多階層ニューラルネットワークモデルにより実行されることが可能なタスク要求に対応するデータセットを、前記保存された多階層ニューラルネットワークモデルに入力することと、
前記多階層ニューラルネットワークモデルにおける最上層から最下層の階層のそれぞれにおいて前記データセットを演算して結果を出力することと
を有し、
前記多階層ニューラルネットワークモデルは量子化層を含み、当該量子化層における量子化閾値パラメータの情報を保存しており、
更に、前記演算において、前記量子化閾値パラメータの情報が示す基本係数、シフト係数、および前記基本係数に対する前記量子化閾値パラメータ間の相関関係に基づいて決定される量子化閾値パラメータに基づいて、前記データセットに対して前記量子化層において量子化処理を行うことを特徴とする非一時的なコンピュータ読み取り可能な記憶媒体。 A non-temporary computer-readable storage medium that stores instructions for causing the computer to perform a method of applying a multi-layer neural network model when executed by a computer.
Saving the multi-layer neural network model and
Inputting a data set corresponding to a task request that can be executed by the multi-layer neural network model into the stored multi-layer neural network model, and
It has the function of calculating the data set in each of the layers from the top layer to the bottom layer in the multi-layer neural network model and outputting the result.
The multi-layer neural network model includes a quantization layer and stores information on quantization threshold parameters in the quantization layer.
Further, in the calculation, based on the quantization threshold parameter determined based on the basic coefficient, the shift coefficient, and the correlation between the quantization threshold parameters with respect to the basic coefficient indicated by the information of the quantization threshold parameter. A non-temporary computer-readable storage medium characterized in that a data set is quantized in the quantization layer.
Applications Claiming Priority (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810193968 | 2018-03-09 | ||
| CN201810193968.9 | 2018-03-09 | ||
| CN201811389762.X | 2018-11-21 | ||
| CN201811389762.XA CN110245741A (en) | 2018-03-09 | 2018-11-21 | Optimization and methods for using them, device and the storage medium of multilayer neural network model |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2019160319A JP2019160319A (en) | 2019-09-19 |
| JP6794593B2 true JP6794593B2 (en) | 2020-12-02 |
Family
ID=67882429
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2019044175A Active JP6794593B2 (en) | 2018-03-09 | 2019-03-11 | Methods and devices for optimizing and applying multi-layer neural network models, and storage media |
Country Status (2)
| Country | Link |
|---|---|
| JP (1) | JP6794593B2 (en) |
| CN (1) | CN110245741A (en) |
Families Citing this family (38)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110648681B (en) * | 2019-09-26 | 2024-02-09 | 腾讯科技(深圳)有限公司 | Speech enhancement method, device, electronic equipment and computer readable storage medium |
| WO2021068249A1 (en) * | 2019-10-12 | 2021-04-15 | 深圳鲲云信息科技有限公司 | Method and apparatus for hardware simulation and emulation during running, and device and storage medium |
| CN112766472B (en) * | 2019-11-01 | 2024-04-12 | 中科寒武纪科技股份有限公司 | Data processing method, device, computer equipment and storage medium |
| CN112765541B (en) * | 2019-11-01 | 2024-02-23 | 中科寒武纪科技股份有限公司 | Data processing method, device, computer equipment and storage medium |
| US12039430B2 (en) * | 2019-11-15 | 2024-07-16 | Samsung Electronics Co., Ltd. | Electronic device and method for inference binary and ternary neural networks |
| CN111260022B (en) * | 2019-11-22 | 2023-09-05 | 中国电子科技集团公司第五十二研究所 | A method for full INT8 fixed-point quantization of convolutional neural network |
| CN111008701B (en) * | 2019-12-03 | 2024-12-03 | 北京硅升科技有限公司 | A data quantization method, device and computer-readable storage medium based on neural network |
| CN113811897B (en) * | 2019-12-30 | 2022-05-31 | 深圳元戎启行科技有限公司 | Inference method and apparatus of neural network model, computer device, and storage medium |
| CN113112008B (en) * | 2020-01-13 | 2024-05-10 | 中科寒武纪科技股份有限公司 | Method, apparatus and computer readable storage medium for neural network data quantization |
| CN113111997B (en) * | 2020-01-13 | 2024-03-22 | 中科寒武纪科技股份有限公司 | Method, apparatus and related products for neural network data quantization |
| CN111310890B (en) * | 2020-01-19 | 2023-10-17 | 深圳云天励飞技术有限公司 | Optimization method and device of deep learning model and terminal equipment |
| CN113222098B (en) * | 2020-01-21 | 2024-11-01 | 上海商汤智能科技有限公司 | Data processing method and related product |
| CN113222097B (en) * | 2020-01-21 | 2024-09-17 | 上海商汤智能科技有限公司 | Data processing method and related product |
| CN113326942B (en) * | 2020-02-28 | 2024-06-11 | 上海商汤智能科技有限公司 | Model reasoning method and device, electronic equipment and storage medium |
| CN111368978B (en) * | 2020-03-02 | 2023-03-24 | 开放智能机器(上海)有限公司 | Precision improving method for offline quantization tool |
| JP6896306B1 (en) * | 2020-04-13 | 2021-06-30 | LeapMind株式会社 | Neural network circuits, edge devices and neural network calculation methods |
| US12050888B2 (en) * | 2020-04-15 | 2024-07-30 | Macronix International Co., Ltd. | In-memory computing method and apparatus |
| CN113554164B (en) * | 2020-04-24 | 2025-04-11 | 上海商汤智能科技有限公司 | Optimization of neural network model, data processing method and device, storage medium |
| WO2021230006A1 (en) * | 2020-05-13 | 2021-11-18 | 株式会社ソシオネクスト | Network quantization method and network quantization device |
| CN113793601B (en) * | 2020-05-27 | 2024-04-02 | 北京声智科技有限公司 | Voice recognition method and device |
| CN113762496B (en) * | 2020-06-04 | 2024-05-03 | 合肥君正科技有限公司 | Method for reducing low-bit convolutional neural network reasoning operation complexity |
| KR20210152244A (en) * | 2020-06-08 | 2021-12-15 | 삼성전자주식회사 | Apparatus for implementing neural network and operation method thereof |
| CN113780513B (en) * | 2020-06-10 | 2024-05-03 | 杭州海康威视数字技术股份有限公司 | Network model quantization and reasoning method and device, electronic equipment and storage medium |
| CN111860841B (en) * | 2020-07-28 | 2023-11-14 | Oppo广东移动通信有限公司 | Optimization methods, devices, terminals and storage media for quantitative models |
| JP7537734B2 (en) * | 2020-08-24 | 2024-08-21 | アシオット株式会社 | Information processing device and program |
| CN112085195B (en) * | 2020-09-04 | 2022-09-23 | 西北工业大学 | X-ADMM-based deep learning model environment self-adaption method |
| CN112381205A (en) * | 2020-09-29 | 2021-02-19 | 北京清微智能科技有限公司 | Neural network low bit quantization method |
| CN112329923B (en) * | 2020-11-24 | 2024-05-28 | 杭州海康威视数字技术股份有限公司 | Model compression method, device, electronic device and readable storage medium |
| CN113177627B (en) * | 2021-01-11 | 2024-05-10 | 联合微电子中心有限责任公司 | Optimization system, retraining system, method thereof, processor and readable medium |
| JP2022117866A (en) * | 2021-02-01 | 2022-08-12 | LeapMind株式会社 | Neural network generation apparatus, neural network computing apparatus, edge device, neural network control method, and software generation program |
| CN115867923B (en) * | 2021-04-12 | 2026-04-14 | 深圳元戎启行科技有限公司 | Neural network model reasoning method, device, computer equipment and storage medium |
| KR20230020856A (en) * | 2021-08-04 | 2023-02-13 | 주식회사 사피온코리아 | Device and Method for Quantizing Parameters of Neural Network |
| CN113593538B (en) * | 2021-09-02 | 2024-05-03 | 北京声智科技有限公司 | Voice characteristic classification method, related equipment and readable storage medium |
| CN115908087B (en) * | 2021-09-30 | 2025-09-26 | 鸿海精密工业股份有限公司 | Image processing method, electronic device and storage medium based on neural network model |
| CN114492778B (en) * | 2022-02-16 | 2024-09-06 | 安谋科技(中国)有限公司 | Operation method of neural network model, readable medium and electronic equipment |
| CN115019150B (en) * | 2022-08-03 | 2022-11-04 | 深圳比特微电子科技有限公司 | Target detection fixed point model establishing method and device and readable storage medium |
| CN116187420B (en) * | 2023-05-04 | 2023-07-25 | 上海齐感电子信息科技有限公司 | Training method, system, equipment and medium for lightweight deep neural network |
| CN119676336B (en) * | 2024-12-19 | 2025-10-17 | 北京华软恒信科技发展有限公司 | Communication protocol identification method, device, computer equipment, storage medium and product |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP3549700B2 (en) * | 1997-03-25 | 2004-08-04 | シャープ株式会社 | Image processing device |
| JP2006268825A (en) * | 2005-02-28 | 2006-10-05 | Toshiba Corp | Object detection device, learning device, object detection system, method, and program |
| JP6921079B2 (en) * | 2016-07-21 | 2021-08-18 | 株式会社デンソーアイティーラボラトリ | Neural network equipment, vehicle control systems, decomposition processing equipment, and programs |
| JP6183980B1 (en) * | 2016-12-02 | 2017-08-23 | 国立大学法人東京工業大学 | Neural network circuit device, neural network, neural network processing method, and neural network execution program |
-
2018
- 2018-11-21 CN CN201811389762.XA patent/CN110245741A/en active Pending
-
2019
- 2019-03-11 JP JP2019044175A patent/JP6794593B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| CN110245741A (en) | 2019-09-17 |
| JP2019160319A (en) | 2019-09-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6794593B2 (en) | Methods and devices for optimizing and applying multi-layer neural network models, and storage media | |
| US11755880B2 (en) | Method and apparatus for optimizing and applying multilayer neural network model, and storage medium | |
| US9355067B1 (en) | Distribution of parameter calculation for iterative optimization methods | |
| US20200151573A1 (en) | Dynamic precision scaling at epoch granularity in neural networks | |
| CN108337000A (en) | Automated process for being transformed into lower accuracy data format | |
| CN111382833A (en) | Method and device for training and applying multilayer neural network model and storage medium | |
| CN108171010B (en) | Protein complex detection method and device based on semi-supervised network embedded model | |
| US20220076121A1 (en) | Method and apparatus with neural architecture search based on hardware performance | |
| JP7150651B2 (en) | Neural network model reducer | |
| CN109472344A (en) | Design method of neural network system | |
| KR102765759B1 (en) | Method and apparatus for quantizing deep neural network | |
| CN120409566B (en) | A method and system for joint quantization of weights and activations of large language models | |
| CN111967583B (en) | Method, device, apparatus and medium for compressing neural network | |
| US20230130638A1 (en) | Computer-readable recording medium having stored therein machine learning program, method for machine learning, and information processing apparatus | |
| US11429864B1 (en) | System and method for bank-balanced sparse activation and joint-activation-weight-sparse training of neural networks | |
| CN113537447A (en) | Generation method, device, application method and storage medium of multi-layer neural network | |
| JP7686444B2 (en) | Apparatus and method for determining a knowledge graph | |
| CN115600658A (en) | Sampling method and sampling acceleration device applied to graph neural network training | |
| KR20230135435A (en) | Method and apparatus for artificial neural network computation based on parameter quantization using hysteresis | |
| CN120894549A (en) | A Medical Image Segmentation Method and Apparatus Based on Topological Constraint Enhancement | |
| CN120180128A (en) | Forgetting update method, device, equipment, storage medium and program product for large language model | |
| KR20230000686A (en) | Electronic device and controlling method of electronic device | |
| KR20250156500A (en) | Efficient data classification method and apparatus based on dictionary contrastive learning via adaptive label embedding | |
| US20220405561A1 (en) | Electronic device and controlling method of electronic device | |
| CN117634566A (en) | A model quantified perception training method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190311 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20200207 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20200217 |
|
| A601 | Written request for extension of time |
Free format text: JAPANESE INTERMEDIATE CODE: A601 Effective date: 20200403 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20200616 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20200706 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20200824 |
|
| 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: 20200907 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20201001 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20201006 |
|
| R151 | Written notification of patent or utility model registration |
Ref document number: 6794593 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |