JP7420100B2 - Processing device, processing method, and program - Google Patents
Processing device, processing method, and program Download PDFInfo
- Publication number
- JP7420100B2 JP7420100B2 JP2021041201A JP2021041201A JP7420100B2 JP 7420100 B2 JP7420100 B2 JP 7420100B2 JP 2021041201 A JP2021041201 A JP 2021041201A JP 2021041201 A JP2021041201 A JP 2021041201A JP 7420100 B2 JP7420100 B2 JP 7420100B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- processing
- filter
- processor
- row
- 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
- 238000003672 processing method Methods 0.000 title claims description 12
- 230000015654 memory Effects 0.000 claims description 86
- 238000000034 method Methods 0.000 claims description 35
- 238000013527 convolutional neural network Methods 0.000 claims description 25
- 238000001914 filtration Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 10
- 101100481702 Arabidopsis thaliana TMK1 gene Proteins 0.000 description 5
- 101100481703 Arabidopsis thaliana TMK2 gene Proteins 0.000 description 5
- 238000011176 pooling Methods 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 2
- 230000010365 information processing Effects 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 101100481704 Arabidopsis thaliana TMK3 gene Proteins 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
Images
Landscapes
- Complex Calculations (AREA)
- Memory System (AREA)
Description
本発明は、畳み込みニューラルネットワークに用いる処理装置、処理方法、およびプログラムに関する。 The present invention relates to a processing device, a processing method, and a program for use in a convolutional neural network.
従来、機械学習の分野において、畳み込みニューラルネットワーク(CNN;Convolutional neural network)と呼ばれるモデルを用いて、画像や動画の認識が行われている。例えば、画像の認識では、畳み込み層とプーリング層を使って入力画像を変換しながら、データ量を徐々に小さくしていき、最終的に各カテゴリの確率の値を出力する。 Conventionally, in the field of machine learning, images and videos have been recognized using a model called a convolutional neural network (CNN). For example, in image recognition, a convolution layer and a pooling layer are used to transform an input image, gradually reducing the amount of data, and finally outputting probability values for each category.
ここで、CNNの畳み込み層では、入力データにおけるそれぞれの局所領域(例えば、3×3のセルの領域)に対して、フィルタをかけ合わせること(フィルタ処理;畳み込み処理)が行われる。畳み込み処理では、入力データの同じセルのデータが何度も(例えばフィルタのセル(係数)の数と同じ回数)メインメモリ(RAM)から読み出される可能性がある。しかも、1つの畳み込み層において、数十から数百のフィルタが用いられる。このため、メインメモリからのデータ読み出しの回数が極めて多く、これがCNNの処理の高速化を阻むボトルネックとなっていた。 Here, in the convolution layer of the CNN, filtering (filter processing; convolution processing) is performed on each local region (for example, a 3×3 cell region) in the input data. In the convolution process, data of the same cell of input data may be read from the main memory (RAM) many times (for example, as many times as the number of cells (coefficients) of the filter). Moreover, tens to hundreds of filters are used in one convolutional layer. For this reason, the number of times data is read from the main memory is extremely large, and this has become a bottleneck that prevents speeding up of CNN processing.
特許文献1では、CNNの畳み込み層の効率的実装のために、複数のチャンネルに渡っている入力データを並び替えることが行われている。
In
しかし、特許文献1では、入力データを単純に分割して並び替えているだけなので、例えば、元の入力データにおいて分割の境目に位置するセルでは、並び替え後には隣接関係が大きく変化してしまう。このため、元の入力データにおいて分割の境目に位置するセルに対してフィルタ処理を行う場合には、並び替えた後のデータの様々な位置のセルを参照する必要がある。このため、メインメモリからレジスタへの並び替え後のデータの読み出し処理などに多くの処理数を要し、効率的な畳み込み層の処理が実現できなかった。
However, in
そこで、本発明は、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現することを目的とする。 Therefore, an object of the present invention is to efficiently realize processing of convolutional layers of a convolutional neural network.
上記目的を達成するために本発明は、以下の構成を採用する。 In order to achieve the above object, the present invention employs the following configuration.
すなわち、本発明の一側面に係る処理装置は、各セルにデータを有する2次元データである入力データであって、畳み込みニューラルネットワークの畳み込み層の入力データに対する畳み込み処理を行う処理装置であって、前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ上の連続したアドレスに配置データとして配置する配置手段と、前記配置データをプロセッサにより読み出して、前記配置データに対してフィルタを用いた畳み込み処理を行う処理手段と、を有し、前記複数の領域のそ
れぞれの行方向の大きさは、プロセッサが一括で読み出し可能なセルの数の整数倍に対応する大きさであって、前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有することを特徴とする処理装置である。
That is, a processing device according to one aspect of the present invention is a processing device that performs convolution processing on input data of a convolution layer of a convolutional neural network, the input data being two-dimensional data having data in each cell, arranging means for selecting a plurality of areas from the input data, concatenating the data of the plurality of areas and arranging the data at consecutive addresses on a main memory as arrangement data; processing means for performing convolution processing using a filter on a cell, and the size of each of the plurality of regions in the row direction is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor. The processing device is characterized in that each of the plurality of regions has data that overlaps columns in other regions by a number of columns equal to the size of the
このように、複数の領域のそれぞれの行方向の大きさが、プロセッサが一括で読み出し可能なセルの数(ワードサイズ)の整数倍であることによれば、一括で所定数のセルからデータを読み出せるプロセッサが、対象の領域から所定数未満のセルのデータしか読み出さないことを防げる。つまり、プロセッサの読み出し能力を最大限に活用できる。また、配置データには重畳領域が存在するため、フィルタ処理の対象のセルの周囲に、当該フィルタ処理に必要な他のセルが集まっている状態になる。このため、プロセッサは、メインメモリからの読み出し回数を低減しながら、畳み込み層のフィルタ処理を実行可能である。従って、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現できる。なお、ここで、フィルタのサイズとは、nセル×nセルのフィルタであれば、nセル分の大きさである。 In this way, if the size of each of the multiple areas in the row direction is an integral multiple of the number of cells (word size) that the processor can read at once, it is possible to read data from a predetermined number of cells at once. It is possible to prevent a processor capable of reading data from reading only data of less than a predetermined number of cells from a target area. In other words, the read capacity of the processor can be utilized to the fullest. Furthermore, since there is an overlapping region in the arrangement data, other cells necessary for the filtering process are gathered around the cell to be filtered. Therefore, the processor can perform filter processing on the convolutional layer while reducing the number of reads from the main memory. Therefore, the processing of the convolutional layer of the convolutional neural network can be efficiently realized. Note that, here, the size of the filter is the size of n cells in the case of a filter of n cells×n cells.
上記処理装置において、前記配置手段は、前記複数の領域のデータをメインメモリ上で列方向に連結(接続)して前記配置データとして配置してもよい。これによれば、複数の領域のうちの1つの領域に、当該領域に関するフィルタ処理を実行するために必要なセル(データ)が集約される。このため、プロセッサは、メインメモリからの読み出し回数を低減しながら、畳み込み層のフィルタ処理を実行可能である。従って、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現できる。 In the above processing device, the arrangement means may connect (connect) the data of the plurality of areas in a column direction on the main memory and arrange the data as the arrangement data. According to this, cells (data) necessary for performing filter processing regarding the area are aggregated in one area out of the plurality of areas. Therefore, the processor can perform filter processing on the convolutional layer while reducing the number of reads from the main memory. Therefore, the processing of the convolutional layer of the convolutional neural network can be efficiently realized.
上記処理装置において、前記配置手段は、前記配置データを配置する場合に、前記複数の領域のうち隣接する2つの領域の間に前記フィルタのデータを有する行を配置してもよい。これによれば、例えば、チャンネル数分のフィルタのデータを常に、プロセッサにおける複数のレジスタが格納しておく必要がなくなるため、レジスタをより効果的にフィルタ処理に用いることが可能になる。 In the above processing device, when arranging the arrangement data, the arrangement means may arrange a row having the filter data between two adjacent regions among the plurality of regions. According to this, for example, it is not necessary to always store filter data for the number of channels in a plurality of registers in the processor, so that the registers can be used more effectively for filter processing.
上記処理装置において、前記複数の領域のそれぞれは、さらに、前記フィルタのサイズから1を引いた数の行だけ他の領域の行と重複したデータを有していてもよい。行が重複していることによれば、フィルタ処理を実行する場合に、複数の領域のうちの他の領域を参照せずにフィルタ処理を実行することができる。このため、配置データにおいて一度読み出した行を再度読み出すことなく、畳み込み層の処理ができるため、畳み込み層の処理が効率化できる。
In the processing device, each of the plurality of regions may further include data that overlaps with rows in other regions by a number of rows equal to the size of the
上記処理装置において、前記配置データの各行の先頭のメモリアドレスは、前記プロセッサが一括で読み出せるメモリアドレスの数の整数倍のメモリアドレスであってもよい。これによれば、配置データの各行の先頭のメモリアドレスを、メインメモリのメモリブロックの先頭のメモリアドレスに合わせることができる。このため、不要なメモリブロックにアクセスすることを抑制できるため、プロセッサのメインメモリからの読み出し処理が効率化する。 In the above processing device, the first memory address of each row of the arrangement data may be a memory address that is an integral multiple of the number of memory addresses that the processor can read out at once. According to this, the memory address at the beginning of each row of arrangement data can be matched with the memory address at the beginning of the memory block of the main memory. Therefore, accessing unnecessary memory blocks can be suppressed, so that reading processing from the main memory of the processor becomes more efficient.
上記処理装置において、前記入力データは、複数のチャンネルに渡るデータであり、前記配置手段は、前記複数の領域に対して列、行、チャンネルの順で優先順序を決定し、前記複数の領域のデータを前記優先順序に従いメインメモリ上で列方向に連結して前記配置データとして配置してもよい。このような配置によれば、フィルタ処理を行う場合に、同じ列かつ同じ行でチャンネルのみが異なる領域に対して、連続的に処理を実行することができる。このため、1つのチャンネルに対して実行したフィルタ処理の結果を中間結果としてレジスタに格納させている間に、他のレジスタを用いて他のチャンネルのフィルタ処理を実行できる。つまり、1つのチャンネルの中間結果をメインメモリに読み書きする処
理の発生を抑制できるので、全てのチャンネルについての中間結果を合計する必要のある畳み込み層の処理を効率的に実行できる。
In the above processing device, the input data is data spanning a plurality of channels, and the arrangement means determines a priority order for the plurality of regions in the order of column, row, and channel, and The data may be connected in a column direction on the main memory according to the priority order and arranged as the arrangement data. According to such an arrangement, when performing filter processing, it is possible to continuously perform the processing on regions in the same column and the same row that differ only in channels. Therefore, while the result of filter processing performed on one channel is stored in a register as an intermediate result, filter processing on another channel can be performed using another register. In other words, it is possible to suppress the occurrence of the process of reading and writing the intermediate results of one channel to the main memory, so that the processing of the convolution layer that requires summing the intermediate results of all channels can be efficiently executed.
上記処理装置において、前記処理手段は、前記畳み込み処理を行う場合には、前記フィルタのサイズ分の数の行のデータブロックであって、前記配置データにおいて列方向に連続する第1の複数の行のデータブロックを前記配置データから読み出してレジスタに格納し、前記第1の複数の行の各行のデータブロックに対して、行方向へのシフトする処理およびフィルタの1つのセルの値を乗算する処理を行ってもよい。これによれば、1つのデータブロックが有する複数のデータに対して一括で演算処理を適用することができるので、結果的に、複数の局所領域に対して一括でフィルタ処理を実行することができる。このため、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現できる。 In the above processing device, when performing the convolution process, the processing means is configured to generate a data block having a number of rows equal to the size of the filter, and a first plurality of rows that are continuous in the column direction in the arrangement data. reading the data block from the arrangement data and storing it in a register, shifting the data block in each row of the first plurality of rows in the row direction, and multiplying the data block by the value of one cell of the filter. You may do so. According to this, arithmetic processing can be applied to multiple pieces of data included in one data block at once, and as a result, filter processing can be executed on multiple local areas at once. . Therefore, the processing of the convolutional layer of the convolutional neural network can be efficiently realized.
上記処理装置において、前記処理手段は、前記畳み込み処理を行う場合には、前記第1の複数の行の各行のデータブロックを1セル分だけ行方向にシフトしたデータブロックから、前記第1の複数の行の各行のデータブロックを前記フィルタのサイズから1引いた数のセル分だけ行方向にシフトしたデータブロックまでのそれぞれのデータブロックと前記第1の複数の行の各行のデータブロックとを取得し、取得したデータブロックのそれぞれに対して、前記第1の複数の行のうちの当該データブロックが対応する行と当該データブロックをシフトした量とに対応する前記フィルタのセルが示す値を乗算することにより、第2の複数の行のデータブロックを取得し、前記第2の複数の行の各行のデータブロックにおける対応する位置のセルの値同士を合計してもよい。
In the above processing device, when performing the convolution process, the processing means shifts the data blocks of each row of the first plurality of rows by one cell in the row direction to the first plurality of data blocks. obtain each data block of each row of the rows up to the data block shifted in the row direction by a number of cells equal to the size of the
本発明は、上記手段の少なくとも一部を有する装置として捉えてもよいし、電子機器や制御システム、情報処理システム、情報処理装置、処理システム、データ配置装置として捉えてもよい。また、本発明は、上記処理の少なくとも一部を含む制御方法、処理方法、配置方法して捉えてもよい。また、本発明は、かかる方法を実現するためのプログラムやそのプログラムを非一時的に記録した記録媒体(記憶媒体)として捉えることもできる。なお、上記手段および処理の各々は可能な限り互いに組み合せて本発明を構成することができる。 The present invention may be understood as a device having at least a part of the above means, or as an electronic device, a control system, an information processing system, an information processing device, a processing system, or a data arrangement device. Further, the present invention may be understood as a control method, a processing method, and an arrangement method that include at least a part of the above processing. Further, the present invention can also be understood as a program for realizing such a method and a recording medium (storage medium) on which the program is recorded non-temporarily. Note that each of the above means and processes can be combined to the extent possible to constitute the present invention.
本発明によれば、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現できる。 According to the present invention, processing of convolutional layers of a convolutional neural network can be efficiently realized.
以下、本発明を実施するための実施形態について図面を用いて記載する。 Embodiments for carrying out the present invention will be described below with reference to the drawings.
まず、畳み込みニューラルネットワーク(CNN)について説明する。CNNは、畳み込み層とプーリング層を含む。画像などの入力データは、畳み込み層とプーリング層とに
おける処理のセットが繰り返し実行されることによって、データ量が減少していく。そして、最終的には、例えば、当該画像が所定の物体(例えば、人、顔、犬などの動物)である確率の値が出力データとして出力される。
First, a convolutional neural network (CNN) will be explained. CNN includes convolution layers and pooling layers. The amount of input data such as images is reduced by repeatedly performing a set of processes in the convolution layer and the pooling layer. Finally, for example, a value of the probability that the image is a predetermined object (for example, a person, a face, an animal such as a dog) is output as output data.
畳み込み層では、例えば、図2に示すように、画像の各画素のR,G,Bのそれぞれチャンネルについて、画素値を2次元状に示したマトリクスが入力データとして入力される。そして、畳み込み層では、入力画像の各チャンネルの局所領域201~203(例えば、3×3の領域)に対して、カーネルと呼ばれるフィルタ211~213をかけ合わせる(適用する)。このように、一般的には、チャンネルの数、またはそれ以上の数だけ、入力データに適用するためのフィルタが必要になる。その後、局所領域201にフィルタ211をかけた値と、局所領域202にフィルタ212をかけた値と、局所領域203にフィルタ213をかけた値とを、合計することによって当該局所領域(当該局所領域の中心のセル)に対応する出力220(出力値V22)を得る。ここで、例えば、局所領域201にフィルタ211をかけた結果は、局所領域201とフィルタ211とにおける3×3の領域の対応する位置の数値同士を乗算した結果を合計する処理によって、式1に示す値のように算出できる。なお、以下では、入力データ(局所領域)に基づき出力220を有するような出力データを生成する処理を「畳み込み処理」と呼ぶ。また、「畳み込み処理」の一部の処理であって、局所領域に対してフィルタをかけ合わせる処理を、「フィルタ処理」と呼ぶ。
プーリング層では、畳み込み層で処理された後のマトリクスについて、局所領域ごとに、情報を処理して出力する。例えば、2×2の領域における最大値や平均値などが、その局所領域に対応する出力値として出力される。 The pooling layer processes and outputs information for each local region of the matrix processed by the convolutional layer. For example, the maximum value, average value, etc. in a 2×2 area are output as output values corresponding to that local area.
<適用例>
以下では、各セルにデータを有する2次元データである入力データであって、畳み込みニューラルネットワークの畳み込み層の入力データに対する畳み込み処理(フィルタ処理)を行う処理装置1について説明する。処理装置1は、入力データから複数の領域(選択領域)を選択して、複数の選択領域のデータを連結しメインメモリ上の連続したアドレスに配置データとして配置する。そして、処理装置1は、配置データをプロセッサにより読み出して、畳み込み処理を行う。このとき、処理装置1は、複数の選択領域のそれぞれの行方向の大きさを、プロセッサが一括で読み出し可能なセルの数(ワードサイズ)の整数倍に対応する大きさにする。また、処理装置1は、複数の選択領域のそれぞれが、フィルタサイズから1を引いた数の列だけ他の選択領域の列と重畳したデータ(重畳領域)を有するように、複数の選択領域を選択する。
<Application example>
In the following, a
複数の選択領域のそれぞれの行方向の大きさがワードサイズの整数倍であることによれば、一括で所定数のセルからデータを読み出せるプロセッサが、対象の選択領域から所定数未満のセルのデータしか読み出さないことを防げる。つまり、プロセッサの読み出し能力を最大限に活用できる。また、配置データには重畳領域が存在するため、フィルタ処理の対象のセルの周囲に、当該フィルタ処理に必要な他のセルが集まっている状態になる。このため、プロセッサは、メインメモリからの読み出し回数を低減しながら、畳み込み処理を実行可能である。従って、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現できる。 If the size of each of the multiple selection areas in the row direction is an integral multiple of the word size, a processor that can read data from a predetermined number of cells at once can read data from less than the predetermined number of cells from the target selection area. This prevents only data from being read. In other words, the read capacity of the processor can be utilized to the fullest. Further, since there is an overlapping region in the arrangement data, other cells necessary for the filtering process are gathered around the cell to be filtered. Therefore, the processor can execute the convolution process while reducing the number of reads from the main memory. Therefore, processing of the convolutional layer of the convolutional neural network can be efficiently realized.
<実施形態1>
以下では、図1A、図1Bを参照して、実施形態1に係る処理装置1の構成について説明する。図1Aは、処理装置1の簡易的な構成図である。処理装置1は、PC、サーバ、スマートフォンなどの任意の処理装置(処理端末)であってよい。処理装置1は、プロセッサ10、記憶装置20、入出力装置30、バス40を有する。
<
The configuration of the
プロセッサ10(CPU;中央処理装置)は、処理装置1における各構成(装置)を制御する。例えば、入出力装置30に対して入力されたユーザ指示に従って、記憶装置20に記憶されたデータを用いた制御をする。プロセッサ10は、複数のレジスタ11(一般的には、16個または32個のレジスタ11)を有する。
A processor 10 (CPU; central processing unit) controls each component (device) in the
複数のレジスタ11のそれぞれは、データを一時的に格納する記憶回路である。複数のレジスタ11のそれぞれは、記憶装置20(メインメモリ21)よりも高速にデータの読み書きをすることができる。このため、プロセッサ10は、複数のレジスタ11にデータを一時的に格納しながら、各種の処理を実行する。なお、複数のレジスタ11は、演算などの用途が特定された複数の専用レジスタと、用途が特定されていない複数の汎用レジスタを有する。複数のレジスタ11のそれぞれは、例えば、16bitのデータを8セット格納することができる。このため、例えば、複数のレジスタ11のそれぞれは、入力データの8つのセルのデータを一括で格納することもできる。
Each of the plurality of
記憶装置20は、プロセッサ10が処理を行うためのデータを記憶(記録)する。記憶装置20は、ハードディスク、RAM(メインメモリ21;Random Access
Memory)、データを非一時的に記憶するROM(Read Only Memory)を含む。ROMは、例えば、OS(Operation System)のバイオスや、プロセッサ10が動作するためのプログラムを記憶する。
The
ROM (Read Only Memory) that stores data non-temporarily. The ROM stores, for example, a bios of an OS (operation system) and a program for the
メインメモリ21は、入力データやフィルタなどのデータを一時的に記憶する。メインメモリ21では、1ビットの情報を記憶するメモリセルが2次元状(行方向および列方向)に広がっている。なお、メインメモリ21は処理装置1から取り外し可能であってもよく、この場合には、処理装置1をメモリ制御装置として捉えることができる。なお、上述のように、フィルタは、入力データのチャンネルの数(またはそれ以上の数)だけ必要であるので、メインメモリ21には入力データのチャンネル分のフィルタのデータが記憶される。
The
また、メインメモリ21は、所定のブロック(以下、メモリブロックと称する)単位でデータを記憶する。このため、例えば、1つのメモリブロックのサイズが4Byteである場合には、各メモリブロックの先頭のメモリアドレスは、4Byteの整数倍になる。一方で、プロセッサ10は、ワード(プロセッサ10が一括して読み出し可能なセルの数またはビット数)単位で、メインメモリ21からデータを一括で読み出すことができる。このため、プロセッサ10が読み出し要求するデータが、メインメモリ21における2つのメモリブロックに渡っている場合には、プロセッサ10は2回のメモリアクセスをする必要がある。従って、プロセッサ10がメインメモリ21にアクセスする場合には、アクセスの対象となるメモリブロックの数を少なくすることが、高速なメモリアクセスを実現する。なお、プロセッサ10は、1行における複数のセルから一括でデータを読み出すことはできるが、1列における複数のセルから一括でデータを読み出すことはできない。
The
入出力装置30は、ユーザの指示(操作)を受け付ける入力装置と、プロセッサ10による処理後のデータを出力する出力装置を有する。入力装置は、例えば、マウス、キーボード、タッチパネル、ボタン、ダイヤル、マイク(音声入力装置)、姿勢検知装置(ジャ
イロセンサ)、温度センサなどを含む。出力装置は、例えば、ディスプレイ(表示装置)、スピーカー(音声出力装置)、プリンタなどを含む。
The input/
バス40は、プロセッサ10と記憶装置20と入出力装置30との間の通信を行うための経路である。プロセッサ10は、バス40を介して、記憶装置20からデータを取得して、当該データを用いて処理を実行し、処理後のデータを記憶装置20に記憶させることができる。
The
(プロセッサの内部構成)
続いて、図1Bを参照して、プロセッサ10の内部構成を説明する。図1Bは、入力データの再配置や畳み込み処理(フィルタ処理)などに用いられるプロセッサ10の内部構成図である。プロセッサ10は、取得部101、配置部102、処理部103を有する。これらの構成は、専用のロジック回路により実現されてもよいし、プロセッサ10がプログラムを実行することによりソフトウエア的に実現されてもよい。
(Internal configuration of processor)
Next, the internal configuration of the
取得部101は、CNNの入力データ(図2参照)をメインメモリ21やプーリング層から取得する。ここで、例えば、入力データは、複数のチャンネル(例えば、それぞれがRBGのいずれかの画素値を示すチャンネルR、チャンネルB、チャンネルB)に渡るデータを有する。各チャンネルにおいて、1つ1つがデータを有するセルが2次元状に広がっている。なお、入力データは、複数のチャンネルを有している必要はなく、単一のチャンネルのみを有していてもよい。
The
配置部102は、入力データにおいて、所定の大きさの複数の領域を選択領域として選択する。また、配置部102は、選択領域のデータを所定の順序(優先順序)で連結(接続)するように配置していき、配置データとしてメインメモリ21に記憶させる。これによって、入力データを並び変えた配置データがメインメモリ21に記憶される。そして、処理部103は、メインメモリ21に記憶された配置データをレジスタ11に読み出して、畳み込み層における畳み込み処理(フィルタ処理)を実行する。
The
[データ配置処理]
以下では、上述したデータ配置処理の詳細な処理を図3のフローチャートを用いて説明する。図3のフローチャートの処理は、プロセッサ10がROMに記憶されたプログラムを実行することによって実現する。
[Data placement processing]
Below, detailed processing of the data arrangement processing mentioned above will be explained using the flowchart of FIG. 3. The processing in the flowchart of FIG. 3 is realized by the
ステップS1001では、取得部101は、CNNの畳み込み層に用いられる入力データを取得する。
In step S1001, the
ステップS1002では、配置部102は、入力データから複数の領域を選択領域として選択する。ここでは、複数の選択領域のそれぞれの行方向の大きさが、上述のワード(プロセッサ10が一括で読み出し可能なセルの数)のサイズの整数倍であるように、配置部102は、複数の選択領域を選択する。また、複数の選択領域のそれぞれが、フィルタのサイズから1を引いた数の列だけ他の選択領域の列と重複したデータを有するように、配置部102は、複数の選択領域を選択する。ここで、フィルタのサイズとは、3×3のセルを有するフィルタであれば、3セル分の大きさである。なお、複数の選択領域のそれぞれが、フィルタのサイズから1を引いた数の行だけ他の選択領域の行と重複したデータを有していてもよい。
In step S1002, the
ステップS1003では、配置部102は、選択した全ての選択領域から、配置する順序を表す優先順序を決定する。具体的には、配置部102は、列、行、チャンネルの順で、全ての選択領域における優先順序を決定する。
In step S1003, the
例えば、配置部102が、図4Aに示すような選択領域CH_R11,CH_R21,CH_R31,CH_G11,CH_G21,CH_G31,CH_B11,CH_B21,CH_B31を、入力データから選択したと仮定する。この場合には、チャンネルよりも行が優先されるため、配置部102は、選択領域CH_R11,CH_G11,CH_B11,CH_R21,CH_G21,CH_B21,CH_R31,CH_G31,CH_B31の順を優先順序として決定する(図4B参照)。
For example, assume that the
また、例えば、図5に示すような選択領域CH_R11,CH_R12,CH_R13,CH_R21,CH_R22,CH_R23,CH_R31,CH_R32,CH_R33を、入力データから選択したと仮定する。この場合には、行よりも列が優先されるため、配置部102は、選択領域CH_R11,CH_R21,CH_R31,CH_R12,CH_R22,CH_R32,CH_R13,CH_R23,CH_R33の順を優先順序として決定する。
Further, for example, it is assumed that selection regions CH_R11, CH_R12, CH_R13, CH_R21, CH_R22, CH_R23, CH_R31, CH_R32, and CH_R33 as shown in FIG. 5 are selected from the input data. In this case, since columns are prioritized over rows, the
ステップS1004では、配置部102は、優先順序に従って、選択領域のデータを連結して配置データを生成する。例えば、配置部102は、図4Aに示すように、入力データから選択領域を選択していた場合には、選択領域CH_R11を先頭に、選択領域CH_G11,CH_B11,CH_R21と優先順序に従って列方向に連結するように配置していく。配置部102は、このように選択した複数の選択領域を配置することによって、配置データを生成する。
In step S1004, the
ステップS1005では、配置部102は、配置データをメインメモリ21に記憶させる。なお、配置部102は、配置データの各行の先頭のメモリアドレスが、プロセッサ10が一括で読み出せるメモリアドレスの数(個数)の整数倍のメモリアドレスであるように、配置データを配置するとよい。ここで、プロセッサ10が一括で読み出せるメモリアドレスの数(個数)は一般的にメインメモリ21の1つのメモリブロックが含むメモリアドレスの数と同等または整数倍である。このため、配置データの各行の先頭のメモリアドレスを、メインメモリ21のメモリブロックの先頭のメモリアドレスに一致させることができる。従って、メインメモリ21のワードサイズ分のセルからプロセッサ10がデータを一括で読み出す場合に、読み出しの対象のメモリブロックの数を少なくできるため、メモリアクセスを行う回数を少なくできる。
In step S1005, the
本実施形態のように、複数の選択領域それぞれの行方向の大きさがワードのサイズの整数倍であれば、プロセッサ10が1つの選択領域の1つの行を読み出す場合に、選択領域からワードサイズずつ読み出して、ワードサイズずつの読み出しから余ったセルのみ読み出すといった処理が不要になる。従って、プロセッサ10によるメインメモリの不要な読み出しを減らすことができるので、畳み込み層での処理が効率化する。
As in this embodiment, if the size in the row direction of each of a plurality of selected areas is an integer multiple of the word size, when the
なお、上述のようにプロセッサ10は、1行に並んだ複数のセルから一括でデータを読み出すことはできるが、1列に並んだ複数のセルから一括でデータを読み出すことはできない。従って、複数の選択領域それぞれの列方向の大きさは、フィルタサイズよりも大きければ任意の大きさであってもよい。ここで、レジスタ11の数が十分に多い場合には、複数の選択領域それぞれの列方向の大きさを大きくすることで、フィルタ処理の対象の選択領域の切り替わりを少なくできる。このため、レジスタ11へのデータの読み込みおよびレジスタ11のデータの解放の処理を少なくできる。一方で、レジスタ11の数が少ない場合には、複数の選択領域それぞれの列方向の大きさを小さくすることで、1つの選択領域に対するフィルタ処理の算出結果(中間結果)をレジスタ11に格納しておくだけの余裕ができる。このため、結果的に中間結果をメインメモリ21に一時的に書き込み、その後、中間結果をメインメモリ21から読み出すという処理の発生を抑制できる。従って
、プロセッサ10は、複数の選択領域それぞれの列方向の大きさを、レジスタ11の個数などに基づき、決定するとよい。また、プロセッサ10は、複数の選択領域それぞれの列方向の大きさを実験的に様々な大きさにして畳み込み層の処理を行って、結果として最も早く処理が可能なものを最終的な複数の選択領域それぞれの列方向の大きさとしてもよい。
Note that, as described above, the
また、本実施形態では、複数の選択領域のそれぞれが、フィルタのサイズから1を引いた数の列だけ他の選択領域の列と重複したデータを有する。なお、複数の選択領域のそれぞれが、フィルタのサイズから1を引いた数の行だけ他の選択領域の行と重複したデータを有していてもよい。ここで、選択領域間でデータが重複させずに、例えば、選択領域の端のセルについてフィルタ処理を行う場合、入力データにおける当該端のセルの周囲のセルのデータも用いる必要がある。このため、このような場合には、プロセッサ10は、他の選択領域(メインメモリ21の他のメモリブロック)から当該周囲のセルのデータを読み出す必要がある。一方、本実施形態のようにデータが重複していれば、その重複部分のセルのデータを用いて、フィルタ処理を実行できるため、他の選択領域のセルからプロセッサ10がデータを読み出す必要がなくなる。よって、プロセッサ10によるメインメモリ21の不要な読み出しを減らすことができるので、畳み込み処理(畳み込み層での処理)が効率化する。
Furthermore, in this embodiment, each of the plurality of selection areas has data that overlaps with columns of other selection areas by the number of columns that is the size of the
[優先順序に従って配置することの効果]
また、以下では、列、行、チャンネルの順で、全ての選択領域における優先順序を決定して、当該優先順序に従って選択領域を配置することの効果を説明する。
[Effect of placing according to priority order]
Further, below, the effect of determining the priority order for all selection areas in the order of column, row, and channel, and arranging the selection areas according to the priority order will be explained.
(優先順序に従って配置しない場合)
まず、優先順序に従って配置しない場合のプロセッサ10がメインメモリ21からデータを読み出す際の処理の一例を説明する。データ配置処理を行わない場合、図4Aに示すような、複数のチャンネルに渡っている入力データに対して畳み込み層における処理が行われる。そして、この場合には、プロセッサ10は、例えば、チャンネルRの先頭行の先頭列のデータから順に、複数のレジスタ11に格納していき、レジスタ11に格納されたデータに基づきフィルタ処理を実行する。ここで、例えば、フィルタのサイズが3×3であった場合、図6に示すように、左上から順に、3行のワードサイズのブロックBLK1~BLK3(データブロック)をレジスタ11に格納する。これによって、プロセッサ10は、3つのブロックとフィルタを用いた計算により、フィルタ処理による出力値が計算できる。その後、プロセッサ10は、ブロックBLK1~BLK3の次の列(右方向)に移動して、3つのブロックBLK4~BLK6をレジスタ11に格納して、フィルタと掛け合わせて出力値を計算する。なお、例えば、ブロックBLK1~BLK3とブロックBLK4~BLK6とに跨る局所領域に対してフィルタ処理を行う場合には、プロセッサ10は、ブロックBLK1~BLK6の6つをレジスタ11に格納して、これらのブロックのデータを用いてフィルタ処理を行う。つまり、1つの局所領域に対してフィルタ処理を行う場合に、取得したブロックのデータを格納しておくために、6個(フィルタサイズの2倍)のレジスタが必要になることがある。
(If not placed according to priority order)
First, an example of a process when the
そして、このような処理を繰り返して、先頭の3行のデータを用いたフィルタ処理が終了すると、2行目~4行目のデータに対して同様の処理を行う。このとき、複数のレジスタ11の数にも限りがあるので、初期のフィルタ処理に用いたブロックについてのデータは、複数のレジスタ11から破棄されてしまう。これによれば、プロセッサ10は、3行目のブロックBLK3のセルを中心とする局所領域についてフィルタ処理を実行しようとする場合に、再度、ブロックBLK2,BLK3を読み出す必要がある。このため、本実施形態の優先順序に従って配置しない場合には、1つのセルのデータが、フィルタのサイズの数だけ複数のメインメモリ21から読み出される可能性がある。
Then, by repeating such processing, when the filter processing using the data in the first three rows is completed, the same processing is performed on the data in the second to fourth rows. At this time, since the number of
(優先順序に従って配置する場合)
続いて、本実施形態に係るデータ配置処理を行う場合のプロセッサ10がメインメモリ21からデータを読み出す際の処理を説明する。本実施形態では、図4Aに示す入力データを、図4Bに示すような配置データに配置し直して、当該配置データを用いてプロセッサ10は、フィルタ処理を実行する。
(When arranging according to priority order)
Next, a process when the
ここで、例えば、各選択領域の行の大きさがワードサイズと同じであると仮定する。この場合、プロセッサ10は、配置データを1行ずつ列方向に連続で(行順で)読み出して、レジスタ11にそれぞれ格納していく。そして、そのレジスタ11に格納されたデータを用いてフィルタ処理を実行する。なお、各選択領域は、列方向および行方向に、フィルタサイズから1を引いた分の行および列だけ他の選択領域と重複したデータを有するとする。この場合には、プロセッサ10は、配置データを行順に読み出せば、過去に配置データから読み出した行を再度読み出して、フィルタ処理に用いるということを行わなくてよい。つまり、プロセッサ10によるレジスタ11への読み出し処理を連続的にする(単純化する)ことができる。
Here, for example, assume that the row size of each selection area is the same as the word size. In this case, the
そして、図2を用いて説明したように、複数のチャンネルそれぞれに対してフィルタ処理をした結果(中間結果)を合計することによって、畳み込み層の出力値は算出される。これに対応すべく、配置データでは、複数のチャンネルにおいて対応する位置(対応する列および行)の選択領域が連続して連結されるように配置されている。これによれば、プロセッサ10は、例えば、チャンネルRの選択領域、これに対応するチャンネルGの選択領域、チャンネルBの選択領域を連続してフィルタ処理することができる。このため、チャンネルRの選択領域に対してフィルタ処理した結果をレジスタ11に保持した状態で、チャンネルGの選択領域、チャンネルBの選択領域をフィルタ処理できる可能性が向上する。従って、例えば、プロセッサ10が、チャンネルRの選択領域に対してフィルタ処理した結果をメインメモリ21に記憶し、チャンネルG,B選択領域をフィルタ処理し終わった後に、メインメモリ21からチャンネルRの選択領域に対してフィルタ処理した結果を読み出すという処理が不要になる。よって、畳み込み層における処理が効率化できる。
Then, as explained using FIG. 2, the output value of the convolution layer is calculated by summing the results (intermediate results) of filtering each of the plurality of channels. In order to cope with this, in the arrangement data, selection areas at corresponding positions (corresponding columns and rows) in a plurality of channels are arranged so as to be continuously connected. According to this, the
[本実施形態に係るフィルタ処理について]
ここで、図7を参照して、本実施形態に係るフィルタ処理について具体的に説明する。以下では、選択領域の列方向に連続する、3行のブロック710,720,730(3行のデータブロック)とフィルタ750を用いて、ブロック720に含まれる複数のセル(R22~R27の値を有するセル)それぞれを中心とする局所領域に対するフィルタ処理について説明する。なお、ブロック710,720,730のそれぞれは、ワードサイズと同一の8つのセルを有しており、レジスタ11に一時的に格納されるものとする。また、フィルタ750のサイズは、3セル分のサイズである(3セル×3セルである)とする。
[About filter processing according to this embodiment]
Here, with reference to FIG. 7, the filter processing according to this embodiment will be specifically described. Below, we will use three rows of
まず、プロセッサ10の処理部103は、ブロック710から、ブロック710、ブロック710を左方向(行方向)に1セル分シフトしたブロック711、ブロック710を左方向に2セル分シフトしたブロック712を取得する。つまり、処理部103は、対象のブロックから、フィルタサイズから1を引いた値のセル分だけ対象のブロックを左にシフトしたブロックまでのそれぞれを取得する。そして、処理部103は、ブロック710の各セルの値にフィルタ750の1行1列目のセルの値aを一括に乗算したブロック715を取得する。同様に、処理部103は、ブロック711の各セルの値にフィルタ750の1行2列目のセルの値bを一括に乗算したブロック716を取得し、ブロック710の各セルの値にフィルタ750の1行3列目のセルの値を一括に乗算したブロック717を取得する。つまり、3行のブロックのうち1行目に対応するブロック710~712には
、フィルタ750の1行目のセルの値を乗算する。このとき、ブロック710~712のそれぞれについて、フィルタにおける、当該ブロックのシフトの量に応じた列(位置)のセルの値をブロック710~712に乗算する。
First, the
このような処理を、ブロック720,730についても同様に行うことにより、処理部103は、図7に示す、ブロック720,730をシフトした、ブロック720~722,730~732を取得する。また、処理部103は、ブロック720~722,730~732のそれぞれに、フィルタ750のうちの対応するセルの値(3つのブロック710,720,730のうち対象のブロックが対応するブロック(行)、および対象のブロックのシフト量に、対応するセルの値)を乗算することによって、ブロック725,726,727,735,736,737を取得する。
By similarly performing such processing on
そして、処理部103は、ブロック715~717,725~727,735~737の同じ位置(列)のセルの値を合計することによって、R22~R27を有するセルを中心とする局所領域についての出力値v22~v27を算出できる。
Then, the
なお、出力値v22~v27を算出するにあたっては、上述の算出順序である必要はなく、最適化された算出順序であってよい。例えば、処理部103は、ブロック715~ブロック717の同一の位置のセルの値を合計した後にその値を1つのレジスタ11に格納し、ブロック720に基づき、ブロック720~ブロック723を取得し、さらにブロック725~727を取得する順序で処理を行ってもよい。これによれば、ブロック715~ブロック717の値を格納していた3つのレジスタ11のうち少なくとも一部は、格納しているデータを解放(破棄)できる。このため、少ないレジスタ11の数で、フィルタ処理が可能になる。
Note that when calculating the output values v22 to v27, the calculation order does not need to be as described above, and an optimized calculation order may be used. For example, the
このようにフィルタ処理が行われることによれば、複数のセル(本実施形態では6つのセル)について一括でフィルタ処理を実行することができる。このため、1つ1つのセルについて、フィルタ処理を実行する場合よりも、大幅に処理数を減少させることができる。なお、このような一括の処理は、例えば、単一の命令で複数のデータに対して同じ処理を行うことができるSIMD(Single Instruction Multiple Data)と呼ばれる処理方式を用いることで実現できる。 By performing filter processing in this manner, it is possible to perform filter processing on a plurality of cells (six cells in this embodiment) at once. Therefore, the number of processes can be significantly reduced compared to the case where filter processing is performed on each cell one by one. Note that such batch processing can be realized, for example, by using a processing method called SIMD (Single Instruction Multiple Data), which allows the same processing to be performed on multiple pieces of data with a single instruction.
そして、本実施形態では、メインメモリの配置データにおいて、複数の選択領域のそれぞれの行方向の大きさは、プロセッサが一括で読み出し可能なセルの数(ワードサイズ)の整数倍に対応する大きさである。これによれば、一括で所定数のセルからデータを読み出せるプロセッサが、選択領域から所定数未満のセルのデータしか読み出さないことを防げる。つまり、プロセッサの読み出し能力を最大限に活用できる。 In this embodiment, in the layout data of the main memory, the size of each of the plurality of selection areas in the row direction is a size corresponding to an integral multiple of the number of cells (word size) that the processor can read at once. It is. According to this, it is possible to prevent a processor that can read data from a predetermined number of cells at once from reading data from fewer than the predetermined number of cells from the selected area. In other words, the read capacity of the processor can be utilized to the fullest.
さらに、複数の選択領域のそれぞれは、フィルタのサイズから1を引いた数の列(および行)だけ他の選択領域の列(および行)と重複したデータを有する。これによれば、フィルタ処理の対象のセルの周囲に、当該フィルタ処理に必要な他のセルが集まっている状態になる。このため、メインメモリからの不要な読み出しを行う必要性が低減できるので、プロセッサは、メインメモリからの読み出し回数を低減しながら、畳み込み層のフィルタ処理を実行可能である。 Furthermore, each of the plurality of selection regions has data that overlaps columns (and rows) of other selection regions by a number of columns (and rows) that is the size of the filter minus one. According to this, the cell to be filtered is surrounded by other cells necessary for the filtering. Therefore, the need to perform unnecessary reading from the main memory can be reduced, so that the processor can perform filter processing on the convolutional layer while reducing the number of times of reading from the main memory.
従って、畳み込みニューラルネットワークの畳み込み層の処理を効率的に実現できる。 Therefore, the processing of the convolutional layer of the convolutional neural network can be efficiently realized.
なお、ステップS1004において、配置部102は、2つの選択領域のデータを連結する場合に、当該2つの選択領域の間にフィルタのデータを差し込んでもよい。つまり、配置データにおいて、配置部102は、隣接する2つの選択領域の間に、フィルタのデー
タを有する行が配置されていてもよい。このとき、2つの選択領域のうちフィルタよりも後に連結される選択領域に対して当該フィルタを用いたフィルタ処理を実行するために、当該選択領域に対応するフィルタのデータが差し込まれる。これによれば、例えば、チャンネル数分のフィルタのデータを常に、複数のレジスタ11が格納しておく必要がなくなるため、レジスタ11をより効果的にフィルタ処理に用いることが可能になる。
Note that in step S1004, when connecting the data of two selected areas, the
なお、実施形態に記載された事項のみによって特許請求の範囲の記載の解釈が限定されるものではない。特許請求の範囲の記載の解釈には、出願時の技術常識を考慮した、発明の課題が解決できることを当業者が認識できるように記載された範囲も含む。 Note that the interpretation of the claims is not limited only by the matters described in the embodiments. The interpretation of the claims includes the range described in such a way that a person skilled in the art can recognize that the problem to be solved by the invention can be solved, taking into consideration the common general knowledge at the time of filing.
(付記1)
各セルにデータを有する2次元データである入力データであって、畳み込みニューラルネットワークの畳み込み層の入力データに対する畳み込み処理を行う処理装置(1)であって、
前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ(21)上の連続したアドレスに配置データとして配置する配置手段(102)と、
前記配置データをプロセッサ(10)により読み出して、前記配置データに対してフィルタを用いた畳み込み処理を行う処理手段(103)と、
を有し、
前記複数の領域のそれぞれの行方向の大きさは、プロセッサ(10)が一括で読み出し可能なセルの数の整数倍に対応する大きさであって、
前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有する、
ことを特徴とする処理装置(1)。
(Additional note 1)
A processing device (1) that performs convolution processing on input data of a convolution layer of a convolutional neural network, the input data being two-dimensional data having data in each cell,
arranging means (102) for selecting a plurality of areas from the input data, concatenating the data of the plurality of areas and arranging the data at consecutive addresses on the main memory (21) as arrangement data;
processing means (103) for reading out the arrangement data by a processor (10) and performing convolution processing on the arrangement data using a filter;
has
The size in the row direction of each of the plurality of areas is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor (10),
Each of the plurality of regions has data that overlaps columns of other regions by a number of columns that is the size of the
A processing device (1) characterized by:
(付記2)
各セルにデータを有する2次元データである入力データであって、畳み込みニューラルネットワークの畳み込み層の入力データに対する畳み込み処理を行う処理装置(1)のプロセッサ(10)が実行する処理方法であって、
前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ(21)上の連続したアドレスに配置データとして配置する配置ステップ(S1005)と、
前記配置データをプロセッサ(10)により読み出して、前記配置データに対してフィルタを用いた畳み込み処理を行う処理ステップと、
を有し、
前記複数の領域のそれぞれの行方向の大きさは、プロセッサ(10)が一括で読み出し可能なセルの数の整数倍に対応する大きさであって、
前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有する、
ことを特徴とする処理方法。
(Additional note 2)
A processing method executed by a processor (10) of a processing device (1) that performs convolution processing on input data of a convolution layer of a convolutional neural network, the input data being two-dimensional data having data in each cell,
a placement step (S1005) of selecting a plurality of areas from the input data, concatenating the data of the plurality of areas and placing it as placement data at consecutive addresses on the main memory (21);
a processing step of reading the placement data by a processor (10) and performing convolution processing using a filter on the placement data;
has
The size in the row direction of each of the plurality of areas is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor (10),
Each of the plurality of regions has data that overlaps columns of other regions by a number of columns that is the size of the
A processing method characterized by:
(付記3)
各セルにデータを有する2次元データである入力データであって、畳み込みニューラルネットワークの畳み込み層の入力データに対する畳み込み処理を行う処理装置(1)のプロセッサ(10)が処理方法を実行するためのプログラムであって、
前記処理方法は、
前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ(21)上の連続したアドレスに配置データとして配置する配置ステップ(S1005)と、
前記配置データをプロセッサ(10)により読み出して、前記配置データに対してフィ
ルタを用いた畳み込み処理を行う処理ステップと、
を有し、
前記複数の領域のそれぞれの行方向の大きさは、プロセッサ(10)が一括で読み出し可能なセルの数の整数倍に対応する大きさであって、
前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有する、
ことを特徴とするプログラム。
(Appendix 3)
A program for executing a processing method by a processor (10) of a processing device (1) that performs convolution processing on input data of a convolution layer of a convolutional neural network, which is input data that is two-dimensional data having data in each cell. And,
The processing method includes:
a placement step (S1005) of selecting a plurality of areas from the input data, concatenating the data of the plurality of areas and placing it as placement data at consecutive addresses on the main memory (21);
a processing step of reading the placement data by a processor (10) and performing convolution processing using a filter on the placement data;
has
The size in the row direction of each of the plurality of areas is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor (10),
Each of the plurality of regions has data that overlaps columns of other regions by a number of columns that is the size of the
A program characterized by:
1:処理装置、10:プロセッサ、11:レジスタ、
20:記憶装置、21:メインメモリ、30:入出力装置、40:バス、
101:取得部、102:配置部、103:処理部
1: Processing device, 10: Processor, 11: Register,
20: storage device, 21: main memory, 30: input/output device, 40: bus,
101: Acquisition unit, 102: Arrangement unit, 103: Processing unit
Claims (10)
前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ上の連続したアドレスに配置データとして配置する配置手段と、
前記配置データをプロセッサにより読み出して、前記配置データに対してフィルタを用いた畳み込み処理を行う処理手段と、
を有し、
前記複数の領域のそれぞれの行方向の大きさは、プロセッサが一括で読み出し可能なセルの数の整数倍に対応する大きさであって、
前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有する、
ことを特徴とする処理装置。 A processing device that performs convolution processing on input data of a convolution layer of a convolutional neural network, the input data being two-dimensional data having data in each cell,
arranging means for selecting a plurality of areas from the input data, concatenating data in the plurality of areas and arranging the data at consecutive addresses on a main memory as arrangement data;
processing means for reading the arrangement data by a processor and performing convolution processing on the arrangement data using a filter;
has
The size in the row direction of each of the plurality of areas is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor,
Each of the plurality of regions has data that overlaps columns of other regions by a number of columns that is the size of the filter minus 1.
A processing device characterized by:
ことを特徴とする請求項1に記載の処理装置。 The arrangement means connects the data of the plurality of areas in a column direction on the main memory and arranges the data as the arrangement data.
The processing device according to claim 1, characterized in that:
ことを特徴とする請求項2に記載の処理装置。 When arranging the arrangement data, the arrangement means places a row having the filter data between two adjacent regions of the plurality of regions;
The processing device according to claim 2, characterized in that:
ことを特徴とする請求項1から3のいずれか1項に記載の処理装置。 Each of the plurality of regions further has data that overlaps with rows in other regions by a number of rows equal to the size of the filter minus 1.
The processing device according to any one of claims 1 to 3, characterized in that:
ことを特徴とする請求項1から4のいずれか1項に記載の処理装置。 The first memory address of each row of the arrangement data is a memory address that is an integral multiple of the number of memory addresses that the processor can read out at once.
The processing device according to any one of claims 1 to 4.
前記配置手段は、前記複数の領域に対して列、行、チャンネルの順で優先順序を決定し、前記複数の領域のデータを前記優先順序に従いメインメモリ上で列方向に連結して前記配置データとして配置する、
ことを特徴とする請求項1から5のいずれか1項に記載の処理装置。 The input data is data spanning multiple channels,
The arrangement means determines a priority order for the plurality of areas in the order of column, row, and channel, and connects the data of the plurality of areas in the column direction on the main memory according to the priority order to create the arrangement data. to be placed as,
The processing device according to any one of claims 1 to 5.
前記フィルタのサイズ分の数の行のデータブロックであって、前記配置データにおいて列方向に連続する第1の複数の行のデータブロックを前記配置データから読み出してレジスタに格納し、
前記第1の複数の行の各行のデータブロックに対して、行方向へのシフトする処理およびフィルタの1つのセルの値を乗算する処理を行う、
ことを特徴とする請求項1から6のいずれか1項に記載の処理装置。 When performing the convolution process, the processing means:
reading data blocks of a first plurality of rows of rows corresponding to the size of the filter and which are continuous in the column direction in the arrangement data from the arrangement data and storing them in a register;
performing a process of shifting in the row direction and a process of multiplying the data block in each row of the first plurality of rows by the value of one cell of the filter;
The processing device according to any one of claims 1 to 6, characterized in that:
前記第1の複数の行の各行のデータブロックを1セル分だけ行方向にシフトしたデータブロックから、前記第1の複数の行の各行のデータブロックを前記フィルタのサイズから1引いた数のセル分だけ行方向にシフトしたデータブロックまでのそれぞれのデータブロックと、前記第1の複数の行の各行のデータブロックとを取得し、
取得したデータブロックのそれぞれに対して、前記第1の複数の行のうちの当該データブロックが対応する行と当該データブロックをシフトした量とに対応する前記フィルタのセルが示す値を乗算することにより、第2の複数の行のデータブロックを取得し、
前記第2の複数の行の各行のデータブロックにおける対応する位置のセルの値同士を合計する、
ことを特徴とする請求項7に記載の処理装置。 When performing the convolution process, the processing means:
A data block obtained by shifting the data block in each row of the first plurality of rows by one cell in the row direction, and a data block in each row of the first plurality of rows having a number of cells equal to the size of the filter minus 1. obtaining each data block up to the data block shifted in the row direction by the amount and the data block of each row of the first plurality of rows;
Multiplying each of the obtained data blocks by a value indicated by a cell of the filter corresponding to a row to which the data block corresponds among the first plurality of rows and an amount by which the data block is shifted. Obtain a second multi-row data block by
summing the values of cells at corresponding positions in the data blocks of each row of the second plurality of rows;
The processing device according to claim 7, characterized in that:
前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ上の連続したアドレスに配置データとして配置する配置ステップと、
前記配置データをプロセッサにより読み出して、前記配置データに対してフィルタを用いた畳み込み処理を行う処理ステップと、
を有し、
前記複数の領域のそれぞれの行方向の大きさは、プロセッサが一括で読み出し可能なセルの数の整数倍に対応する大きさであって、
前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有する、
ことを特徴とする処理方法。 A processing method executed by a processor of a processing device that performs convolution processing on input data of a convolution layer of a convolutional neural network, the input data being two-dimensional data having data in each cell,
a placement step of selecting a plurality of areas from the input data, concatenating the data of the plurality of areas and placing the data at consecutive addresses on the main memory as placement data;
a processing step of reading the placement data by a processor and performing convolution processing using a filter on the placement data;
has
The size in the row direction of each of the plurality of areas is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor,
Each of the plurality of regions has data that overlaps columns of other regions by a number of columns that is the size of the filter minus 1.
A processing method characterized by:
前記処理方法は、
前記入力データから複数の領域を選択して、前記複数の領域のデータを連結しメインメモリ上の連続したアドレスに配置データとして配置する配置ステップと、
前記配置データをプロセッサにより読み出して、前記配置データに対してフィルタを用いた畳み込み処理を行う処理ステップと、
を有し、
前記複数の領域のそれぞれの行方向の大きさは、プロセッサが一括で読み出し可能なセルの数の整数倍に対応する大きさであって、
前記複数の領域のそれぞれは、前記フィルタのサイズから1を引いた数の列だけ他の領域の列と重複したデータを有する、
ことを特徴とするプログラム。
A program for executing a processing method by a processor of a processing device that performs convolution processing on input data of a convolution layer of a convolutional neural network, the input data being two-dimensional data having data in each cell,
The processing method includes:
a placement step of selecting a plurality of areas from the input data, concatenating the data of the plurality of areas and placing the data at consecutive addresses on the main memory as placement data;
a processing step of reading the placement data by a processor and performing convolution processing using a filter on the placement data;
has
The size in the row direction of each of the plurality of areas is a size corresponding to an integral multiple of the number of cells that can be read out at once by the processor,
Each of the plurality of regions has data that overlaps columns of other regions by a number of columns that is the size of the filter minus 1.
A program characterized by:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021041201A JP7420100B2 (en) | 2021-03-15 | 2021-03-15 | Processing device, processing method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021041201A JP7420100B2 (en) | 2021-03-15 | 2021-03-15 | Processing device, processing method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2022141064A JP2022141064A (en) | 2022-09-29 |
JP7420100B2 true JP7420100B2 (en) | 2024-01-23 |
Family
ID=83403126
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2021041201A Active JP7420100B2 (en) | 2021-03-15 | 2021-03-15 | Processing device, processing method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7420100B2 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019183202A1 (en) | 2018-03-23 | 2019-09-26 | Amazon Technologies, Inc. | Accelerated quantized multiply-and-add operations |
JP2019535079A (en) | 2016-10-04 | 2019-12-05 | マジック リープ, インコーポレイテッドMagic Leap,Inc. | Efficient data layout for convolutional neural networks |
WO2020003345A1 (en) | 2018-06-25 | 2020-01-02 | オリンパス株式会社 | Arithmetic processing device |
JP2021501377A (en) | 2018-10-24 | 2021-01-14 | アドバンスド ニュー テクノロジーズ カンパニー リミテッド | High-speed calculation of convolutional neural network |
-
2021
- 2021-03-15 JP JP2021041201A patent/JP7420100B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019535079A (en) | 2016-10-04 | 2019-12-05 | マジック リープ, インコーポレイテッドMagic Leap,Inc. | Efficient data layout for convolutional neural networks |
WO2019183202A1 (en) | 2018-03-23 | 2019-09-26 | Amazon Technologies, Inc. | Accelerated quantized multiply-and-add operations |
WO2020003345A1 (en) | 2018-06-25 | 2020-01-02 | オリンパス株式会社 | Arithmetic processing device |
JP2021501377A (en) | 2018-10-24 | 2021-01-14 | アドバンスド ニュー テクノロジーズ カンパニー リミテッド | High-speed calculation of convolutional neural network |
Also Published As
Publication number | Publication date |
---|---|
JP2022141064A (en) | 2022-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210034277A1 (en) | Matrix transfer accelerator system and method | |
US20210390368A1 (en) | Buffer Addressing for a Convolutional Neural Network | |
JP6927320B2 (en) | Inference device, convolution operation execution method and program | |
US20180181406A1 (en) | Arithmetic processing device and control method of the arithmetic processing device | |
KR20210024865A (en) | A method and an apparatus for processing data | |
US11763131B1 (en) | Systems and methods for reducing power consumption of convolution operations for artificial neural networks | |
EP3985572A1 (en) | Implementation of a neural network in multicore hardware | |
CN109902821B (en) | Data processing method and device and related components | |
CN109598335B (en) | Two-dimensional convolution pulse array structure and implementation method | |
CN112884137A (en) | Hardware implementation of neural network | |
JP7020485B2 (en) | Arithmetic logic unit, arithmetic method and program | |
JP7420100B2 (en) | Processing device, processing method, and program | |
EP3663938A1 (en) | Signal processing method and apparatus | |
JP7419574B2 (en) | Dilated convolution acceleration calculation method and device | |
JP2022518640A (en) | Data processing methods, equipment, equipment, storage media and program products | |
JP7152107B2 (en) | Arithmetic processing device, arithmetic processing method and program | |
US11467973B1 (en) | Fine-grained access memory controller | |
WO2019077933A1 (en) | Calculating circuit and calculating method | |
JP2024516514A (en) | Memory mapping of activations for implementing convolutional neural networks | |
JP7251354B2 (en) | Information processing device, information processing program, and information processing method | |
GB2585810A (en) | Buffer addressing for a convolutional neural network | |
CN112884138A (en) | Hardware implementation of neural network | |
CN113918879A (en) | Matrix operation method and accelerator | |
JP4992753B2 (en) | Image processing apparatus and image processing method | |
US20220092409A1 (en) | Neural network processing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20230308 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20231130 |
|
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: 20231212 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20231225 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7420100 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |