JP2021532498A - Video memory processing methods, devices and recording media based on convolutional neural networks - Google Patents
Video memory processing methods, devices and recording media based on convolutional neural networks Download PDFInfo
- Publication number
- JP2021532498A JP2021532498A JP2021506309A JP2021506309A JP2021532498A JP 2021532498 A JP2021532498 A JP 2021532498A JP 2021506309 A JP2021506309 A JP 2021506309A JP 2021506309 A JP2021506309 A JP 2021506309A JP 2021532498 A JP2021532498 A JP 2021532498A
- Authority
- JP
- Japan
- Prior art keywords
- storage space
- data
- temporary storage
- video memory
- neural network
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/14—Digital output to display device ; Cooperation and interconnection of the display device with other functional units
- G06F3/1407—General aspects irrespective of display type, e.g. determination of decimal point position, display with fixed or driving decimal point, suppression of non-significant zeros
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4411—Configuring for operating with peripheral devices; Loading of device drivers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Computer Security & Cryptography (AREA)
- Human Computer Interaction (AREA)
- Image Analysis (AREA)
Abstract
本願は、ニューラルネットワークの分野に関し、畳み込みニューラルネットワークに基づくビデオメモリ処理方法、装置及び記録媒体を提供し、ビデオメモリ処理方法は、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成するステップと、処理対象データのタイプ及び方向に応じて、前記処理対象データに対応する一時記憶空間を呼び出し、かつ前記処理対象データを呼び出された一時記憶空間に読み込むステップと、前記呼び出された一時記憶空間内で前記処理対象データに対して所定の処理を行うステップと、処理後のデータのタイプ及び方向に応じて、前記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むステップと、を含む。本願はビデオメモリを大幅に節約し、GPU計算の並列度を向上させることができる。【選択図】図5The present application provides a video memory processing method, an apparatus and a recording medium based on a convolutional neural network in the field of a neural network, in which the video memory processing method temporarily stores input data, output data, input error and output error. Depending on the step of creating the temporary storage space, which is the storage space, and the type and direction of the data to be processed, the temporary storage space corresponding to the data to be processed is called, and the temporary storage space to which the data to be processed is called is used. A step to read, a step to perform predetermined processing on the data to be processed in the called temporary storage space, and data in the called temporary storage space according to the type and direction of the processed data. Includes a step to write to the specified external storage space. The present application can save a lot of video memory and improve the parallelism of GPU calculation. [Selection diagram] FIG. 5
Description
本願は、中国特許出願番号第201910497396.8号(出願日2019年6月10日、発明の名称「畳み込みニューラルネットワークに基づくビデオメモリ処理方法、装置及び記録媒体」)の特許出願の優先権を主張するものである。 This application claims the priority of the patent application of Chinese Patent Application No. 201910497396.8 (Filing date June 10, 2019, title of invention "Video memory processing method, apparatus and recording medium based on convolutional neural network"). It is something to do.
本願は、畳み込みニューラルネットワーク(CNN:Convolutional Neural Network)の技術分野に関し、特に畳み込みニューラルネットワークに基づくビデオメモリ処理方法、装置及び記録媒体に関する。 The present application relates to the technical field of a convolutional neural network (CNN), and more particularly to a video memory processing method, an apparatus and a recording medium based on a convolutional neural network.
ビデオメモリは、GPU表示コアの一時メモリであり、処理すべきコアデータを一時的に記憶するものである。その役割は、CPU及びメモリの役割と同じである。ビデオメモリの容量は、ビデオメモリがデータを一時的に記憶する能力を決定し、ビデオカードのコアが十分強い場合、大容量ビデオメモリは、データを読み取る回数を低減し、遅延を低減することができる。出願人は、現在の畳み込みニューラルネットワークモデルのトレーニングプロセスにおいて、モデルの入出力データが異なるビデオメモリ空間に繰り返して記憶され、不必要なビデオメモリオーバーヘッドを引き起こし、モデルのトレーニングのバッチ処理数を低減するため、モデルのトレーニングの精度に影響を与えることを着目した。 The video memory is a temporary memory of the GPU display core, and temporarily stores the core data to be processed. Its role is the same as that of the CPU and memory. The capacity of the video memory determines the ability of the video memory to temporarily store the data, and if the core of the video card is strong enough, the large capacity video memory can reduce the number of times the data is read and reduce the delay. can. In the current convolutional neural network model training process, the applicant repeatedly stores the model's input / output data in different video memory spaces, causing unnecessary video memory overhead and reducing the number of batch processes for model training. Therefore, we focused on affecting the accuracy of model training.
例えば、Concat層及びAddition層は、現在の深層学習分類ネットワーク及びターゲット検出ネットワークにおいてよく使用されている層である。Concat層は、特徴次元で複数の入力データに対してマージ処理を行うものであり、Addition層は、複数の入力データに対して累積処理を行うものである。Caffe、TensorFlowなどの従来の深層学習ネットワークトレーニングフレームワークは、いずれもConcat及びAddition層に対してビデオメモリ最適化を行わないため、入出力データが異なるビデオメモリ空間に繰り返し記憶され、不必要なビデオメモリオーバーヘッドをもたらし、モデルのトレーニングのバッチ処理数の低減を引き起こすため、モデルのトレーニング精度に影響を与える。それと共に、ビデオメモリ空間はまた、自動化機械学習技術autoMLの最適化方式の探索空間などを制限する。 For example, the Concat layer and the Addition layer are commonly used layers in current deep learning classification networks and target detection networks. The Concat layer performs merge processing on a plurality of input data in the feature dimension, and the Addition layer performs cumulative processing on a plurality of input data. Traditional deep learning network training frameworks such as Caffe and TensorFlow do not perform video memory optimization for the Concat and Addition layers, so I / O data is repeatedly stored in different video memory spaces and unnecessary video. It affects the training accuracy of the model by introducing memory overhead and reducing the number of batch processes for training the model. At the same time, the video memory space also limits the search space of the optimization method of the automated machine learning technology autoML.
本願は、共有一時記憶空間を作成し、処理すべきデータのタイプ及び指示に応じてデータを対応する一時記憶空間内に読み込むか又は書き込むことを主な目的として、従来のフレームワークと比較して、ユーザが様々なモジュールと任意に組み合わせて新たなCNN構造を形成することができ、ビデオメモリを大幅に節約し、GPU計算の並列度を向上させることができる、畳み込みニューラルネットワークに基づくビデオメモリ処理方法、装置及びコンピュータ読取り可能な記録媒体を提供する。 The present application is compared with conventional frameworks with the main purpose of creating a shared temporary storage space and reading or writing the data into the corresponding temporary storage space according to the type and instructions of the data to be processed. , Video memory processing based on convolutional neural network, which allows the user to arbitrarily combine with various modules to form a new CNN structure, which can save a lot of video memory and improve the parallelism of GPU computation. Methods, devices and computer-readable recording media are provided.
上記目的を達成するために、本願に係る、電子装置に適用される畳み込みニューラルネットワークに基づくビデオメモリ処理方法は、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成するステップと、処理対象データのタイプ及び方向に応じて、前記処理対象データに対応する一時記憶空間を呼び出し、前記処理対象データを呼び出された一時記憶空間に読み込むステップと、前記呼び出された一時記憶空間で前記処理対象データに対して所定の処理を行うステップと、処理後のデータのタイプ及び方向に応じて、前記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むステップと、を含む。 In order to achieve the above object, the video memory processing method based on the convolutional neural network applied to the electronic device according to the present application is a storage space for temporarily storing input data, output data, input error and output error. A step of creating a temporary storage space, a step of calling a temporary storage space corresponding to the processing target data according to the type and direction of the processing target data, and a step of reading the processing target data into the called temporary storage space, and the above-mentioned The data in the called temporary storage space is specified as an external storage according to the step of performing a predetermined process on the data to be processed in the called temporary storage space and the type and direction of the processed data. Includes steps to write to space.
本願に係る畳み込みニューラルネットワークに基づくビデオメモリ処理システムは、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成する空間作成部と、処理対象データのタイプ及び方向に応じて、前記処理対象データに対応する一時記憶空間を呼び出し、前記処理対象データを呼び出された一時記憶空間に読み込むデータ呼び出し部と、前記呼び出された一時記憶空間で前記処理対象データに対して所定の処理を行う前処理部と、処理後のデータのタイプ及び方向に応じて、前記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むデータ書き込み部と、を含む。 The video memory processing system based on the convolutional neural network according to the present application has a space creation unit for creating a temporary storage space, which is a storage space for temporarily storing input data, output data, input error, and output error, and a space creation unit for processing target data. A data calling unit that calls the temporary storage space corresponding to the processing target data and reads the processing target data into the called temporary storage space according to the type and direction, and the processing target data in the called temporary storage space. A pre-processing unit that performs predetermined processing on the data, and a data writing unit that writes data in the called temporary storage space to a designated external storage space according to the type and direction of the data after processing. include.
また、上記目的を達成するために、本願に係る電子装置は、メモリ及びプロセッサを含み、前記メモリは、前記プロセッサによって実行されると、前述した畳み込みニューラルネットワークに基づくビデオメモリ処理方法のステップを実現する、畳み込みニューラルネットワークに基づくビデオメモリ処理プログラムを含む。 Further, in order to achieve the above object, the electronic device according to the present application includes a memory and a processor, and when the memory is executed by the processor, the step of the video memory processing method based on the convolutional neural network described above is realized. Includes a video memory processor based on a convolutional neural network.
また、上記目的を達成するために、本願に係るコンピュータ読取り可能な記録媒体は、プロセッサによって実行されると、上記畳み込みニューラルネットワークに基づくビデオメモリ処理方法のステップを実現する、畳み込みニューラルネットワークに基づくビデオメモリ処理プログラムを含む。 Further, in order to achieve the above object, the computer-readable recording medium according to the present application, when executed by a processor, realizes a step of a video memory processing method based on the convolutional neural network, a video based on a convolutional neural network. Includes memory processing program.
本願に係る畳み込みニューラルネットワークに基づくビデオメモリ処理方法、システム、電子装置及びコンピュータ読取り可能な記録媒体は、共有一時記憶空間を設定し、処理すべきデータのタイプ及び指示に応じて、対応する一時記憶空間を呼び出し、かつデータを対応する一時記憶空間内に読み込むか又は書き込んで演算処理を行うことにより、CNNアルゴリズムに適用することができ、他のフレームワークと比較して、Dense、Residual、Inceptionモジュールと任意に組み合わせて新たなCNN構造を形成することができ、約半分のビデオメモリを節約すると共に、GPU計算の並列度を向上させることができる。 The video memory processing method, system, electronic device and computer readable recording medium based on the convolutional neural network according to the present application set a shared temporary storage space and correspond to the corresponding temporary storage according to the type and instruction of the data to be processed. It can be applied to CNN algorithms by calling space and reading or writing data into the corresponding temporary storage space for arithmetic processing, and compared to other frameworks, the Dense, Memory, and Injection modules. A new CNN structure can be formed by any combination with and can save about half of the video memory and improve the parallelism of GPU calculation.
本願の目的の達成、機能特徴及び利点について、実施例と組み合わせて、図面を参照しながらさらに説明する。
なお、ここで説明する具体的な実施例は、本願を解釈するためのものに過ぎず、本願を限定するものではない。 It should be noted that the specific examples described here are merely for interpreting the present application and do not limit the present application.
(実施例1)
本願は、電子装置1に適用される畳み込みニューラルネットワークに基づくビデオメモリ処理方法を提供する。図1に示すように、本願の畳み込みニューラルネットワークに基づくビデオメモリ処理方法の好ましい実施例の適用環境の概略図である。
(Example 1)
The present application provides a video memory processing method based on a convolutional neural network applied to the
本実施例で、電子装置1は、サーバ、スマートフォン、タブレットコンピュータ、ポータブルコンピュータ、デスクトップコンピュータなどの、演算機能を持つ端末装置であってよい。
In this embodiment, the
該電子装置1は、プロセッサ12、メモリ11、ネットワークインタフェース14及び通信バス15を含む。
The
メモリ11は、少なくとも1種の読取り可能な記録媒体を含み、フラッシュメモリ、ハードディスク、マルチメディアカード、カード型メモリ11などの不揮発性記録媒体であってよい。いくつかの実施例では、読取り可能な記録媒体は、上記電子装置1の内部記憶部であってよく、例えば、該電子装置1のハードディスクである。別の実施例では、読取り可能な記録媒体は、上記電子装置1の外部メモリ11であってよく、例えば、電子装置1に搭載されたプラグインハードディスク、スマートメディアカード(Smart Media Card、SMC)、セキュアデジタル(Secure Digital、SD)カード、フラッシュカード(Flash Card)である。
The
本実施例では、メモリ11の読取り可能な記録媒体は、一般的に、電子装置1に搭載された畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10などを記憶する。また、メモリ11は、出力されたデータ又は出力しようとするデータを一時的に記憶することができる。
In this embodiment, the readable recording medium of the
いくつかの実施例では、プロセッサ12は、中央処理装置(Central Processing Unit、CPU)、マイクロプロセッサ又はその他のデータ処理チップであってよく、メモリ11に記憶されたプログラムコード又は処理データを実行し、例えば、畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10などを実行する。
In some embodiments, the
ネットワークインタフェース14は、好ましくは、標準的な有線インタフェース、無線インタフェース(例えば、WI−FIインタフェース)を含んでよく、一般的に該電子装置1とその他の電子装置との間に通信接続を確立する。
The
通信バス15は、これらのコンポーネントの間の接続通信を実現する。
The
図1でコンポーネント11〜15を有する電子装置1のみを示しているが、全ての示されたコンポーネントを実施することを要求せず、より多くの又はより少ないコンポーネントを代替的に実施できることを理解されたい。
Although only
該電子装置1は、ユーザインタフェース、ディスプレイ、タッチセンサを含んでよく、ユーザインタフェースは、キーボードなどの入力部と、マイクロホンなどの音声認識機能を持つ装置などの音声入力装置と、オーディオ、ヘッドフォンなどの音声出力装置とを含んでよい。ディスプレイは、LEDディスプレイ、液晶ディスプレイ、タッチ式液晶ディスプレイ及び有機発光ダイオード(Organic Light−Emitting Diode、OLED)タッチ装置などであってよい。タッチセンサは、抵抗式タッチセンサ、静電容量式タッチセンサなどであってよい。また、上記タッチセンサは、接触式タッチセンサを含むだけでなく、近接式タッチセンサなどを含んでもよい。また、上記タッチセンサは、単一のセンサであってもよいし、例えばアレイ状に配置された複数のセンサであってもよい。
The
好ましくは、該電子装置1は、無線周波数(Radio Frequency、RF)回路、センサ、オーディオ回路などをさらに含んでよく、ここでは説明を省略する。
Preferably, the
図1に示す装置の実施例では、コンピュータ記録媒体であるメモリ11には、オペレーティングシステム、畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10などが含まれてよく、プロセッサ12は、メモリ11に記憶された畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10を実行すると、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成するステップ1と、処理対象データのタイプ及び方向に応じて、上記処理対象データに対応する一時記憶空間を呼び出し、上記処理対象データを呼び出された一時記憶空間に読み込むステップ2と、呼び出された一時記憶空間で上記処理対象データに対して所定の処理を行うステップ3と、処理後のデータのタイプ及び方向に応じて、上記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むステップ4とを実現する。
In the embodiment of the apparatus shown in FIG. 1, the
ステップ1では、一時記憶空間は、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間であり、対応する一時記憶空間は、入力データ一時記憶空間、出力データ一時記憶空間、入力誤差一時記憶空間及び出力誤差一時記憶空間を含む。該一時記憶空間はビデオメモリ内に設定されてもよく、ビデオメモリはモデル又はデータを記憶するもので、ビデオメモリが大きいほど、動作可能なネットワークも大きくなり、一般的なビデオカードは、主に以下のいくつかの種類を有する。
ビデオメモリの記憶単位は、主に、
1Byte=8bitと、
1K=1024Byteと、
1KB=1000Byteと、
1M=1024Kと、
1MB=1000KBと、
1G=1024Mと、
1GB=1000GBと、
10K=10*1024Byteと、
10KB=10000Byteと、を含む。
The storage unit of video memory is mainly
1Byte = 8bit,
1K = 1024Byte,
1KB = 1000Byte,
1M = 1024K,
1MB = 1000KB,
1G = 1024M,
1GB = 1000GB,
10K = 10 * 1024Byte,
Includes 10KB = 10000Byte.
一般的な数値のタイプ及びそのサイズは以下の表に示すとおりである。
上記表において、Intは整数型の数値であり、longは長整数型の数値であり、floatは浮動小数点型の数値である(singleは単精度浮動小数点型の数値であり、doubleは倍精度浮動小数点型の数値である)。 In the above table, Int is an integer type numerical value, long is a long integer type numerical value, float is a floating point type numerical value (single is a single precision floating point type numerical value, and double is a double precision floating point type numerical value). (Floating point number).
ステップ2で、処理対象データのタイプが誤差であり方向が出力である場合、出力誤差データに応じて、対応する出力誤差一時記憶空間を呼び出し、該出力誤差を該出力誤差一時記憶空間内に読み込んで処理することができる。
In
上記処理対象データに対して所定の処理を行うステップは、上記処理対象データに対して畳み込み処理、重畳処理、乗算処理又は積分演算のうちの少なくとも1つを行うステップを含む。 The step of performing a predetermined process on the process target data includes a step of performing at least one of a convolution process, a superimposition process, a multiplication process, and an integral operation on the process target data.
例えば、データに対して畳み込み処理を行うときに、主に2つの変数をある範囲内で乗算した後に加算した結果を取得する。畳み込みの変数が系列x(n)及びh(n)であれば、畳み込み結果は下式に示すとおりである。
式中、*は畳み込みを示す。時系列n=0の場合、系列h(−i)はh(i)の時系列iが反転された結果であり、時系列の反転によりh(i)が縦軸を中心として180度反転するため、このような、乗算後に加算する計算法は、畳み込み和と呼ばれ、畳み込みと略称される。また、nはh(−i)をシフトさせる量であり、異なるnは異なる畳み込み結果に対応する。 In the formula, * indicates convolution. When the time series n = 0, the series h (-i) is the result of the time series i of h (i) being inverted, and the time series inversion causes h (i) to be inverted 180 degrees about the vertical axis. Therefore, such a calculation method of adding after multiplication is called a convolution sum, and is abbreviated as convolution. Further, n is an amount that shifts h (−i), and different n corresponds to different convolution results.
畳み込みの変数がx(t)とh(t)の2つの関数であれば、畳み込みの計算は下式に従って行われる。
pは積分変数であり、積分も加算であり、tは関数h(−p)をシフトさせた量であり、*は畳み込みを示す。 p is an integral variable, integral is also an addition, t is a shifted quantity of the function h (-p), and * indicates convolution.
ビデオメモリを節約するという目的を達成するために、上記これらの演算は、いずれも一時記憶空間内で行うことができる。 All of these operations can be performed in temporary storage space to achieve the goal of saving video memory.
ステップ4で、上記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むステップは、設定された書き込み方式で上記一時記憶空間内の処理後のデータを指定された外部記憶空間に書き込むステップを含み、上記書き込み方式はAdditionモード及びConcatモードを含む。 In step 4, the step of writing the data in the called temporary storage space to the designated external storage space is to write the processed data in the temporary storage space to the designated external storage space by the set writing method. The writing method includes a writing step, and the writing method includes an Addition mode and a Concat mode.
また、データのタイプは、入力データ、出力データ、入力誤差及び出力誤差を含み、上記データの方向は、入力及び出力を含む。 The type of data includes input data, output data, input error and output error, and the direction of the data includes input and output.
具体的には、ユーザにより設定された書き込み方式(Addition、Concat)に応じて異なる方式でデータを指定されたメモリ空間内に書き込むことができる。例えば、ユーザがAdditionモードを設定した場合、対応する一時記憶空間内のデータを指定された記憶空間内に累積的に書き込み、ユーザがConcatモードを設定した場合、ユーザにより設定されたデータ長情報に基づいて、対応する一時記憶空間内のデータを指定された記憶空間内に間隔をあけて順次書き込む。 Specifically, data can be written in the designated memory space by a different method according to the writing method (Addition, Concat) set by the user. For example, when the user sets the Addition mode, the data in the corresponding temporary storage space is cumulatively written in the specified storage space, and when the user sets the Concat mode, the data length information set by the user is used. Based on this, the data in the corresponding temporary storage space is sequentially written to the specified storage space at intervals.
以下、畳み込みニューラルネットワークを例として、本願の畳み込みニューラルネットワークに基づくビデオメモリ処理プログラムの実行について詳細に説明する。 Hereinafter, the execution of the video memory processing program based on the convolutional neural network of the present application will be described in detail by taking the convolutional neural network as an example.
ニューラルネットワークの各層の出力のビデオメモリ使用量状況を取得するには、各層のfeature mapの形状を計算し、かつバックプロパゲーションのために勾配を保存する必要があり、ビデオメモリ使用量はbatch sizeに正比例する。ニューラルネットワーク全体のビデオメモリ使用量は、モデルビデオメモリ+batch size*各サンプルのビデオメモリ使用量であり、モデルが小さい場合に、batch size*各サンプルのビデオメモリ使用量とほぼ等しい。 In order to obtain the video memory usage status of the output of each layer of the neural network, it is necessary to calculate the shape of the feature map of each layer and save the gradient for backpropagation, and the video memory usage is batch size. Is directly proportional to. The video memory usage of the entire neural network is the model video memory + the video memory usage of each batch size * sample, and when the model is small, it is almost equal to the video memory usage of each batch size * sample.
畳み込みニューラルネットワークモデルによるトレーニングプロセスにおけるビデオメモリの使用量を節約するために、例えば、対応する一時記憶空間で複数の入力データにマージ処理を行い、対応する一時記憶空間で複数の入力データに累積処理を行うようにConcat及びAddition層などに対してビデオメモリ最適化を行うことができる。 To save video memory usage in the training process with a convolutional neural network model, for example, merge multiple input data in the corresponding temporary storage space and accumulate multiple input data in the corresponding temporary storage space. Video memory optimization can be performed for the Concat and Addition layers and the like.
例えば、図3は、ビデオメモリ最適化処理が行われていない従来のCNNネットワークの部分構造である。 For example, FIG. 3 is a partial structure of a conventional CNN network in which video memory optimization processing is not performed.
図3に示すように、逆伝搬を一時的に考慮せず、順伝搬を例とすると、畳み込み層の入力データのサイズは32*32*3であり、batch sizeが5であれば、該層の入力データのサイズは32*32*3*5であり、各入出力データのサイズの計算方式は以上と同じである。したがって、データがfloatで表されると、最適化処理が行われていない該CNNネットワーク部分が使用するビデオメモリは1980kbである。 As shown in FIG. 3, if the back propagation is not considered temporarily and the forward propagation is taken as an example, the size of the input data of the convolution layer is 32 * 32 * 3, and if the batch size is 5, the layer is said. The size of the input data of is 32 * 32 * 3 * 5, and the calculation method of the size of each input / output data is the same as described above. Therefore, when the data is represented by float, the video memory used by the CNN network portion that has not been optimized is 1980 kb.
本願の畳み込みニューラルネットワークに基づくビデオメモリ処理方法を利用して上記部分に対してビデオメモリ最適化を行い、最適化後の構成図は図4に示すとおりである。 Video memory optimization is performed on the above portion using the video memory processing method based on the convolutional neural network of the present application, and the configuration diagram after the optimization is as shown in FIG.
逆伝搬を一時的に考慮しないため、出力データ一時記憶空間を呼び出すことのみを考慮すればよく、該一時記憶空間の寸法又はサイズは、CNNネットワークにおける畳み込み層の出力データの最大サイズに設定され、該実施例では32*32*16である。図4における破線枠内の畳み込み層の出力データに対して、いずれも実際のビデオメモリ空間を割り当てず、出力データ一時記憶空間を呼び出す。 Since backpropagation is not considered temporarily, only calling the output data temporary storage space needs to be considered, and the size or size of the temporary storage space is set to the maximum size of the output data of the convolutional layer in the CNN network. In this example, it is 32 * 32 * 16. No actual video memory space is allocated to the output data of the convolution layer in the broken line frame in FIG. 4, and the output data temporary storage space is called.
以上より、batch sizeが5であり、かつデータがfloatで表される場合、ビデオメモリ最適化後、該CNNネットワーク部分が使用するビデオメモリは1340kbであり、ビデオメモリを32.3%節約することができる。 From the above, when the batch size is 5 and the data is represented by float, the video memory used by the CNN network portion after the video memory optimization is 1340 kb, which saves 32.3% of the video memory. Can be done.
上記実施例に係る電子装置1は、共有一時記憶空間を設定し、処理すべきデータのタイプ及び指示に応じて対応する一時記憶空間を呼び出し、データを対応する一時記憶空間内に読み込むか又は書き込んで演算処理を行うことにより、CNNアルゴリズムに適用することができ、他のフレームワークと比較して、Dense、Residual、Inceptionモジュールと任意に組み合わせて新たなCNN構造を形成することができ、約半分のビデオメモリを節約すると共に、GPU計算の並列度を向上させることができる。
The
他の実施例では、畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10には、共有一時記憶空間マネージャがさらに設定されてもよく、該マネージャは、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する一時記憶空間を含む。該マネージャは、対応する一時記憶空間を取得し操作するいくつかのサブモジュールを提供し、1つ以上のモジュールは、メモリ11に記憶され、かつプロセッサ12により実行されることで、本願を完成させる。本願でいうモジュールとは、特定の機能を実行できる一連のコンピュータプログラム命令セグメントを指す。図2は図1における畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10の好ましい実施例のプログラムモジュールの図である。上記畳み込みニューラルネットワークに基づくビデオメモリ処理プログラム10は、以下のサブモジュール210〜230に分割することができる。
In another embodiment, the video
一時空間取得サブモジュール210は、モジュールに入力されたデータのタイプ(データ又は誤差)及び方向(入力又は出力)に応じて、対応する一時記憶空間を呼び出して出力する。
例えば、該一時空間取得サブモジュールに「誤差及び出力」を入力すれば、該サブモジュールは対応する出力誤差一時記憶空間を呼び出して出力する。
The temporary space acquisition submodule 210 calls and outputs the corresponding temporary storage space according to the type (data or error) and direction (input or output) of the data input to the module.
For example, if "error and output" is input to the temporary space acquisition submodule, the submodule calls and outputs the corresponding output error temporary storage space.
データ読み込みサブモジュール220は、該データ読み込みサブモジュールに入力されたデータのタイプ(データ又は誤差)及び方向(入力又は出力)に応じて、指定された記憶空間内のデータを対応する一時記憶空間内に読み込み、かつ該一時記憶空間を出力する。 The data read submodule 220 accommodates data in the specified storage space in the corresponding temporary storage space, depending on the type (data or error) and direction (input or output) of the data input to the data read submodule. And output the temporary storage space.
例えば、該データ読み込みサブモジュールに「誤差及び出力」を入力すれば、該モジュールは指定された記憶空間内のデータを出力誤差一時記憶空間内に読み込み、出力誤差一時記憶空間を出力する。 For example, if "error and output" is input to the data reading submodule, the module reads the data in the designated storage space into the output error temporary storage space and outputs the output error temporary storage space.
上記指定された空間とは、主に、処理対象データが現在存在する記憶空間を指し、処理対象データは該指定された空間から一時記憶空間内に読み込まれて処理される。以下は同じである。 The above-designated space mainly refers to a storage space in which the processing target data currently exists, and the processing target data is read from the designated space into the temporary storage space and processed. The following is the same.
データ書き込みサブモジュール230は、該データ書き込みサブモジュールに入力されたデータのタイプ(データ又は誤差)及び方向(入力又は出力)に応じて、対応する一時記憶空間内のデータを指定された一時記憶空間内に書き込む。 The data writing submodule 230 is a temporary storage space in which data in the corresponding temporary storage space is designated according to the type (data or error) and direction (input or output) of the data input to the data writing submodule. Write in.
例えば、該データ書き込みサブモジュールに「誤差及び入力」を入力すれば、該データ書き込みモジュールは入力誤差一時記憶空間内のデータを指定された記憶空間内に書き込む。 For example, if "error and input" is input to the data writing submodule, the data writing module writes the data in the input error temporary storage space into the designated storage space.
なお、該データ書き込みサブモジュールはまたユーザにより設定された書き込み方式(Addition¥Concat)に応じて、異なる方式でデータを指定されたメモリ空間内に書き込む場合もある。例えば、ユーザがAdditionモードを設定した場合、該データ書き込みサブモジュールは、対応する一時記憶空間内のデータを指定された記憶空間に累積的に書き込み、ユーザがConcatモードを設定した場合、該データ書き込みサブモジュールは、ユーザにより設定されたデータ長情報に基づいて、対応する一時記憶空間内のデータを指定された記憶空間に間隔をあけて順次書き込む。 The data writing submodule may also write data in the designated memory space by a different method according to the writing method (Addition \ Concat) set by the user. For example, when the user sets the Addition mode, the data write submodule cumulatively writes the data in the corresponding temporary storage space to the specified storage space, and when the user sets the Concat mode, the data write. The submodule sequentially writes data in the corresponding temporary storage space to the specified storage space at intervals based on the data length information set by the user.
(実施例2)
本願は、畳み込みニューラルネットワークに基づくビデオメモリ処理方法をさらに提供する。図5は本願に係る畳み込みニューラルネットワークに基づくビデオメモリ処理方法の好ましい実施例のフローチャートである。該方法は、装置によって実行されてよく、該装置は、ソフトウェア及び/又はハードウェアによって実現されてよい。
(Example 2)
The present application further provides a video memory processing method based on a convolutional neural network. FIG. 5 is a flowchart of a preferred embodiment of the video memory processing method based on the convolutional neural network according to the present application. The method may be performed by a device, which may be implemented by software and / or hardware.
本実施例では、畳み込みニューラルネットワークに基づくビデオメモリ処理方法は、以下のS110〜S140を含む。 In this embodiment, the video memory processing method based on the convolutional neural network includes the following S110 to S140.
S110では、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成する。 In S110, a temporary storage space, which is a storage space for temporarily storing input data, output data, input error, and output error, is created.
該ステップでは、一時記憶空間は、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間であり、対応する一時記憶空間は、入力データ一時記憶空間、出力データ一時記憶空間、入力誤差一時記憶空間及び出力誤差一時記憶空間を含む。 In this step, the temporary storage space is a storage space that temporarily stores input data, output data, input error, and output error, and the corresponding temporary storage space is an input data temporary storage space, an output data temporary storage space, and the like. Includes input error temporary storage space and output error temporary storage space.
該一時記憶空間はビデオメモリ内に設定されてもよく、ビデオメモリはモデル又はデータを記憶するもので、ビデオメモリが大きいほど、動作可能なネットワークも大きくなり、一般的なビデオカードは、主に以下のいくつかの種類を有する。
ビデオメモリの記憶単位は、主に、
1Byte=8bitと、
1K=1024Byteと、
1KB=1000Byteと、
1M=1024Kと、
1MB=1000KBと、
1G=1024Mと、
1GB=1000GBと、
10K=10*1024Byteと、
10KB=10000Byteと、を含む。
The storage unit of video memory is mainly
1Byte = 8bit,
1K = 1024Byte,
1KB = 1000Byte,
1M = 1024K,
1MB = 1000KB,
1G = 1024M,
1GB = 1000GB,
10K = 10 * 1024Byte,
Includes 10KB = 10000Byte.
一般的な数値のタイプ及びそのサイズは以下の表に示すとおりである。
上記表において、Intは整数型の数値であり、longは長整数型の数値であり、floatは浮動小数点型の数値である(singleは単精度浮動小数点型の数値であり、doubleは倍精度浮動小数点型の数値である)。 In the above table, Int is an integer type numerical value, long is a long integer type numerical value, float is a floating point type numerical value (single is a single precision floating point type numerical value, and double is a double precision floating point type numerical value). (Floating point number).
S120では、処理対象データのタイプ及び方向に応じて、上記処理対象データに対応する一時記憶空間を呼び出し、上記処理対象データを呼び出された一時記憶空間内に読み込む。 In S120, the temporary storage space corresponding to the processing target data is called according to the type and direction of the processing target data, and the processing target data is read into the called temporary storage space.
例えば、処理対象データのタイプが誤差であり、方向が出力である場合、出力誤差データに応じて、対応する出力誤差一時記憶空間を呼び出し、該出力誤差を該出力誤差一時記憶空間内に読み込んで処理することができる。 For example, if the type of data to be processed is error and the direction is output, the corresponding output error temporary storage space is called according to the output error data, and the output error is read into the output error temporary storage space. Can be processed.
S130では、呼び出された一時記憶空間で上記処理対象データに対して所定の処理を行う。 In S130, predetermined processing is performed on the processing target data in the called temporary storage space.
上記処理対象データに対して所定の処理を行うステップは、上記処理対象データに対して畳み込み処理、重畳処理、乗算処理又は積分演算のうちの少なくとも1つを行うステップを含む。 The step of performing a predetermined process on the process target data includes a step of performing at least one of a convolution process, a superimposition process, a multiplication process, and an integral operation on the process target data.
例えば、データに対して畳み込み処理を行うとき、主に2つの変数をある範囲内で乗算した後に加算した結果を取得する。畳み込みの変数が系列x(n)及びh(n)であれば、畳み込み結果は、下式に示すとおりである。
式中、*は畳み込みを示す。時系列n=0の場合、系列h(−i)はh(i)の時系列iが反転された結果であり、時系列の反転によりh(i)が縦軸を中心として180度反転するため、このような、乗算後に加算する計算法は、畳み込み和と呼ばれ、畳み込みと略称される。また、nはh(−i)をシフトさせる量であり、異なるnは異なる畳み込み結果に対応する。 In the formula, * indicates convolution. When the time series n = 0, the series h (-i) is the result of the time series i of h (i) being inverted, and the time series inversion causes h (i) to be inverted 180 degrees about the vertical axis. Therefore, such a calculation method of adding after multiplication is called a convolution sum, and is abbreviated as convolution. Further, n is an amount that shifts h (−i), and different n corresponds to different convolution results.
畳み込みの変数がx(t)とh(t)の2つの関数であれば、畳み込みの計算は、下式に従って行われる。
pは積分変数であり、積分も加算であり、tは関数h(−p)をシフトさせた量であり、*は畳み込みを示す。 p is an integral variable, integral is also an addition, t is a shifted quantity of the function h (-p), and * indicates convolution.
同様に、ビデオメモリを節約するという目的を達成するために、上記これらの演算はいずれも一時記憶空間内で行うことができる。 Similarly, any of these operations can be performed within the temporary storage space to achieve the goal of saving video memory.
S140では、処理後のデータのタイプ及び方向に応じて、上記呼び出された一時記憶空間内のデータを指定された外部記憶空間内に書き込む。 In S140, the data in the called temporary storage space is written in the designated external storage space according to the type and direction of the processed data.
該ステップでは、上記呼び出された一時記憶空間内のデータを指定された外部記憶空間内に書き込むステップは、設定された書き込み方式で、上記一時記憶空間内の処理後のデータを指定された外部記憶空間内に書き込むステップを含み、書き込み方式は、additionモード及びconcatモードを含む。 In the step, the step of writing the data in the called temporary storage space into the designated external storage space is a set writing method, and the processed data in the temporary storage space is designated as external storage. The writing method includes a step of writing in space, and a writing method includes an addition mode and a concat mode.
また、データのタイプは、入力データ、出力データ、入力誤差及び出力誤差を含み、上記データの方向は、入力及び出力を含む。 The type of data includes input data, output data, input error and output error, and the direction of the data includes input and output.
具体的には、ユーザにより設定された書き込み方式(Addition、Concat)に応じて、異なる方式でデータを指定されたメモリ空間内に書き込むことができる。例えば、ユーザがAdditionモードを設定した場合、対応する一時記憶空間内のデータを指定された記憶空間内に累積的に書き込み、ユーザがConcatモードを設定した場合、ユーザにより設定されたデータ長情報に基づいて、対応する一時記憶空間内のデータを指定された記憶空間内に間隔をあけて順次書き込む。 Specifically, data can be written in the designated memory space by a different method according to the writing method (Addition, Concat) set by the user. For example, when the user sets the Addition mode, the data in the corresponding temporary storage space is cumulatively written in the specified storage space, and when the user sets the Concat mode, the data length information set by the user is used. Based on this, the data in the corresponding temporary storage space is sequentially written to the specified storage space at intervals.
以下、畳み込みニューラルネットワークを例として、本願に係る畳み込みニューラルネットワークに基づくビデオメモリ処理方法について詳細に説明する。 Hereinafter, the video memory processing method based on the convolutional neural network according to the present application will be described in detail by taking the convolutional neural network as an example.
ニューラルネットワークの各層の出力のビデオメモリ使用量状況を取得するには、各層のfeature mapの形状を計算し、かつバックプロパゲーションのために勾配を保存する必要があり、ビデオメモリ使用量はbatch sizeに正比例する。ニューラルネットワーク全体のビデオメモリ使用量は、モデルビデオメモリ+batch size*各サンプルのビデオメモリ使用量であり、モデルが小さい場合に、batch size*各サンプルのビデオメモリ使用量とほぼ等しい。 In order to obtain the video memory usage status of the output of each layer of the neural network, it is necessary to calculate the shape of the feature map of each layer and save the gradient for backpropagation, and the video memory usage is batch size. Is directly proportional to. The video memory usage of the entire neural network is the model video memory + the video memory usage of each batch size * sample, and when the model is small, it is almost equal to the video memory usage of each batch size * sample.
畳み込みニューラルネットワークモデルによるトレーニングプロセスにおけるビデオメモリの使用量を節約するために、例えば対応する一時記憶空間内で複数の入力データにマージ処理を行い、対応する一時記憶空間内で複数の入力データに累積処理を行うようにconcat及びaddition層などに対してビデオメモリ最適化を行うことができる。 To save video memory usage in the training process with a convolutional neural network model, for example, merge multiple input data in the corresponding temporary storage space and accumulate to multiple input data in the corresponding temporary storage space. Video memory optimization can be performed for the concat and addition layers and the like so as to perform processing.
例えば、図3は、ビデオメモリ最適化処理が行われていない従来のCNNネットワークの部分構造である。 For example, FIG. 3 is a partial structure of a conventional CNN network in which video memory optimization processing is not performed.
図3に示すように、逆伝搬を一時的に考慮せず、順伝搬を例とすると、畳み込み層の入力データのサイズは32*32*3であり、batch sizeが5であれば、該層の入力データのサイズは32*32*3*5であり、各入出力データのサイズの計算方式は以上と同じである。したがって、データがfloatで表されると、最適化処理が行われない該CNNネットワーク部分が使用するビデオメモリは1980kbである。 As shown in FIG. 3, if the back propagation is not considered temporarily and the forward propagation is taken as an example, the size of the input data of the convolution layer is 32 * 32 * 3, and if the batch size is 5, the layer is said. The size of the input data of is 32 * 32 * 3 * 5, and the calculation method of the size of each input / output data is the same as described above. Therefore, when the data is represented by float, the video memory used by the CNN network portion that is not optimized is 1980 kb.
本願に係る畳み込みニューラルネットワークに基づくビデオメモリ処理方法を利用して上記部分に対しビデオメモリ最適化を行い、最適化後の構成図は図4に示すとおりである。 Video memory optimization is performed on the above portion using the video memory processing method based on the convolutional neural network according to the present application, and the configuration diagram after the optimization is as shown in FIG.
逆伝搬を一時的に考慮しないため、出力データ一時記憶空間を呼び出すことのみを考慮すればよく、該一時記憶空間の寸法又はサイズは、CNNネットワークにおける畳み込み層の出力データの最大サイズに設定され、該実施例では32*32*16である。図4における破線枠内の畳み込み層の出力データに対して、いずれも実際のビデオメモリ空間を割り当てず、出力データ一時記憶空間を呼び出す。 Since backpropagation is not considered temporarily, only calling the output data temporary storage space needs to be considered, and the size or size of the temporary storage space is set to the maximum size of the output data of the convolutional layer in the CNN network. In this example, it is 32 * 32 * 16. No actual video memory space is allocated to the output data of the convolution layer in the broken line frame in FIG. 4, and the output data temporary storage space is called.
以上より、batch sizeが5であり、かつデータがfloatで表される場合、ビデオメモリ最適化後、該CNNネットワーク部分が使用するビデオメモリは1340kbであり、ビデオメモリを32.3%節約することができる。 From the above, when the batch size is 5 and the data is represented by float, the video memory used by the CNN network portion after the video memory optimization is 1340 kb, which saves 32.3% of the video memory. Can be done.
上記実施例に係る畳み込みニューラルに基づくビデオメモリ処理方法は、共有一時記憶空間を設定し、処理すべきデータのタイプ及び指示に応じて、対応する一時記憶空間を呼び出し、かつデータを対応する一時記憶空間内に読み込むか又は書き込んで演算処理を行うことにより、CNNアルゴリズムに適用することができ、他のフレームワークと比較して、Dense、Residual、Inceptionモジュールと任意に組み合わせて新たなCNN構造を形成することができ、約半分のビデオメモリを節約すると共に、GPU計算の並列度を向上させることができる。 In the video memory processing method based on the convolutional neural according to the above embodiment, a shared temporary storage space is set, the corresponding temporary storage space is called according to the type and instruction of the data to be processed, and the data is stored in the corresponding temporary storage space. It can be applied to the CNN algorithm by reading or writing in space and performing arithmetic processing, and compared with other frameworks, it can be arbitrarily combined with the Dense, Memory, and Injection modules to form a new CNN structure. It can save about half the video memory and improve the degree of parallelism of GPU calculation.
(実施例3)
上記実施例2に係る畳み込みニューラルネットワークに基づくビデオメモリ処理方法に対応し、本願は畳み込みニューラルネットワークに基づくビデオメモリ処理システムをさらに提供する。図6は、本実施例に係る畳み込みニューラルネットワークに基づくビデオメモリ処理システムの論理構造を示す。
(Example 3)
Corresponding to the video memory processing method based on the convolutional neural network according to the second embodiment, the present application further provides a video memory processing system based on the convolutional neural network. FIG. 6 shows the logical structure of the video memory processing system based on the convolutional neural network according to this embodiment.
図6に示すように、本実施例に係る畳み込みニューラルネットワークに基づくビデオメモリ処理システム600は、空間作成部610、データ呼び出し部620、前処理部630、及びデータ書き込み部640を含む。空間作成部610、データ呼び出し部620、前処理部630及びデータ書き込み部640により実現される機能は、上記実施例2における畳み込みニューラルネットワークに基づくビデオメモリ処理方法における対応するステップと一対一に対応する。 As shown in FIG. 6, the video memory processing system 600 based on the convolutional neural network according to the present embodiment includes a space creation unit 610, a data calling unit 620, a preprocessing unit 630, and a data writing unit 640. The functions realized by the space creation unit 610, the data calling unit 620, the preprocessing unit 630, and the data writing unit 640 correspond one-to-one with the corresponding steps in the video memory processing method based on the convolutional neural network in the second embodiment. ..
具体的には、空間作成部610は、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成し、空間作成部610は、ビデオメモリ内で一時記憶空間を作成することができ、ビデオメモリは、モデル又はデータを記憶するもので、ビデオメモリが大きいほど、動作可能なネットワークも大きくなる。作成された一時記憶空間は、入力データ一時記憶空間、出力データ一時記憶空間、入力誤差一時記憶空間及び出力誤差一時記憶空間を含んでよい。 Specifically, the space creation unit 610 creates a temporary storage space which is a storage space for temporarily storing input data, output data, input error, and output error, and the space creation unit 610 temporarily stores the input data, output data, input error, and output error in the video memory. A storage space can be created, and the video memory stores a model or data, and the larger the video memory, the larger the operable network. The created temporary storage space may include an input data temporary storage space, an output data temporary storage space, an input error temporary storage space, and an output error temporary storage space.
データ呼び出し部620は、処理対象データのタイプ及び方向に応じて、該処理対象データに対応する一時記憶空間を呼び出し、該処理対象データを呼び出された一時記憶空間内に読み込む。例えば、処理対象データのタイプが誤差であり、方向が出力である場合、出力誤差データに応じて、対応する出力誤差一時記憶空間を呼び出し、該出力誤差を該出力誤差一時記憶空間内に読み込んで処理することができる。 The data calling unit 620 calls the temporary storage space corresponding to the processing target data according to the type and direction of the processing target data, and reads the processing target data into the called temporary storage space. For example, if the type of data to be processed is error and the direction is output, the corresponding output error temporary storage space is called according to the output error data, and the output error is read into the output error temporary storage space. Can be processed.
前処理部630は、データ呼び出し部620により呼び出された一時記憶空間内で処理対象データに対して所定の処理を行う。該所定の処理は、上記処理対象データに対して行う畳み込み処理、重畳処理、乗算処理又は積分演算のうちの少なくとも1つを含んでよい。 The pre-processing unit 630 performs predetermined processing on the data to be processed in the temporary storage space called by the data calling unit 620. The predetermined process may include at least one of a convolution process, a superimposition process, a multiplication process, or an integral operation performed on the data to be processed.
例えば、前処理部630がデータに対して畳み込み処理を行うときに、主に2つの変数をある範囲内で乗算した後に加算した結果を取得する。畳み込みの変数が系列x(n)及びh(n)であれば、畳み込み結果は下式に示すとおりである。
式中、*は畳み込みを示す。時系列n=0の場合、系列h(−i)はh(i)の時系列iが反転された結果であり、時系列の反転によりh(i)が縦軸を中心として180度反転するため、このような乗算後に加算する計算法は畳み込み和と呼ばれ、畳み込みと略称される。また、nはh(−i)をシフトさせる量であり、異なるnは異なる畳み込み結果に対応する。 In the formula, * indicates convolution. When the time series n = 0, the series h (-i) is the result of the time series i of h (i) being inverted, and the time series inversion causes h (i) to be inverted 180 degrees about the vertical axis. Therefore, such a calculation method of adding after multiplication is called a convolution sum, and is abbreviated as convolution. Further, n is an amount that shifts h (−i), and different n corresponds to different convolution results.
畳み込みの変数がx(t)とh(t)の2つの関数であれば、畳み込みの計算は、下式に従って行われる。
pは積分変数であり、積分も加算であり、tは関数h(−p)をシフトさせた量であり、*は畳み込みを示す。 p is an integral variable, integral is also an addition, t is a shifted quantity of the function h (-p), and * indicates convolution.
同様に、ビデオメモリを節約するという目的を達成するために、上記これらの演算はいずれも一時記憶空間内で行うことができる。 Similarly, any of these operations can be performed within the temporary storage space to achieve the goal of saving video memory.
データ書き込み部640は、処理後のデータのタイプ及び方向に応じて、呼び出された一時記憶空間内のデータを指定された外部記憶空間内に書き込む。 The data writing unit 640 writes the data in the called temporary storage space into the designated external storage space according to the type and direction of the processed data.
データ書き込み部640は、設定された書き込み方式で、上記一時記憶空間内の処理後のデータを指定された外部記憶空間に書き込むことができ、該書き込み方式はAdditionモード及びConcatモードを含む。ユーザがAdditionモードを設定した場合、対応する一時記憶空間内のデータを指定された記憶空間に累積的に書き込み、ユーザがConcatモードを設定した場合、ユーザにより設定されたデータ長情報に基づき、対応する一時記憶空間内のデータを指定された記憶空間に間隔をあけて順次書き込む。 The data writing unit 640 can write the processed data in the temporary storage space to the designated external storage space by the set writing method, and the writing method includes the Addition mode and the Concat mode. When the user sets the Addition mode, the data in the corresponding temporary storage space is cumulatively written to the specified storage space, and when the user sets the Concat mode, it corresponds based on the data length information set by the user. Writes the data in the temporary storage space to the specified storage space in sequence at intervals.
上記実施例に係る畳み込みニューラルに基づくビデオメモリ処理システムは、共有一時記憶空間を設定し、処理すべきデータのタイプ及び指示に応じて、対応する一時記憶空間を呼び出し、かつデータを対応する一時記憶空間に読み込むか又は書き込んで演算処理を行うことにより、CNNアルゴリズムに適用することができ、他のフレームワークと比較して、Dense、Residual、Inceptionモジュールと任意に組み合わせて新たなCNN構造を形成することができ、約半分のビデオメモリを節約すると共に、GPU計算の並列度を向上させることができる。 The video memory processing system based on the convolutional neural network according to the above embodiment sets a shared temporary storage space, calls the corresponding temporary storage space according to the type and instruction of the data to be processed, and stores the data in the corresponding temporary storage space. It can be applied to the CNN algorithm by reading or writing to space and performing arithmetic processing, and can be arbitrarily combined with the Dense, Memory, and Injection modules to form a new CNN structure compared to other frameworks. It can save about half the video memory and improve the parallelism of GPU calculation.
(実施例4)
本願の実施例に係るコンピュータ読取り可能な記録媒体は、プロセッサによって実行されると、入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成する動作と、処理対象データのタイプ及び方向に応じて、処理対象データに対応する一時記憶空間を呼び出し、処理対象データを呼び出された一時記憶空間内に読み込む動作と、呼び出された一時記憶空間で処理対象データに対して所定の処理を行う動作と、処理後のデータのタイプ及び方向に応じて、呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込む動作と、を実現する、畳み込みニューラルに基づくビデオメモリ処理プログラムを含む。
(Example 4)
The computer-readable recording medium according to the embodiment of the present application has an operation of creating a temporary storage space, which is a storage space for temporarily storing input data, output data, input error, and output error when executed by a processor. , The operation of calling the temporary storage space corresponding to the processing target data and reading the processing target data into the called temporary storage space according to the type and direction of the processing target data, and the processing target data in the called temporary storage space. A convolutional neural that realizes the operation of performing a predetermined process on the data and the operation of writing the data in the called temporary storage space to the specified external storage space according to the type and direction of the processed data. Includes a video memory processing program based on.
好ましくは、一時記憶空間は、入力データ一時記憶空間、出力データ一時記憶空間、入力誤差一時記憶空間及び出力誤差一時記憶空間を含む。 Preferably, the temporary storage space includes an input data temporary storage space, an output data temporary storage space, an input error temporary storage space, and an output error temporary storage space.
好ましくは、処理対象データに対して所定の処理を行うステップは、処理対象データに対して畳み込み処理、重畳処理、乗算処理又は積分演算のうちの少なくとも1つを行うステップを含む。 Preferably, the step of performing a predetermined process on the data to be processed includes a step of performing at least one of a convolution process, a superimposition process, a multiplication process, or an integral operation on the data to be processed.
好ましくは、上記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むステップは、設定された書き込み方式で、一時記憶空間内の処理後のデータを指定された外部記憶空間に書き込むステップを含み、書き込み方式は、Additionモード及びConcatモードを含む。 Preferably, the step of writing the data in the called temporary storage space to the specified external storage space writes the processed data in the temporary storage space to the specified external storage space by the set writing method. The writing method includes an Addition mode and a Concat mode.
好ましくは、データのタイプは、入力データ、出力データ、入力誤差及び出力誤差を含み、上記データの方向は、入力及び出力を含む。 Preferably, the type of data includes input data, output data, input errors and output errors, and the direction of the data includes inputs and outputs.
本願のコンピュータ読取り可能な記録媒体の具体的な実施形態は、上記畳み込みニューラルネットワークに基づくビデオメモリ処理方法、システム、電子装置の具体的な実施形態とほぼ同じであるため、ここでは説明を省略する。 Since the specific embodiment of the computer-readable recording medium of the present application is almost the same as the specific embodiment of the video memory processing method, the system, and the electronic device based on the convolutional neural network, the description thereof is omitted here. ..
なお、本明細書において、用語「含む」、「備える」又はそれらの任意の他の変形は、非排他的な包含をカバーするものであることにより、一連の要素を含むプロセス、装置、物品又は方法は、それらの要素を含むだけでなく、明確に例示されていない他の要素をさらに含むか、又はこれらのプロセス、装置、物品又は方法固有の要素をさらに含む。更なる限定がない限り、語句「……を含む」により限定された要素は、該要素を含むプロセス、装置、物品又は方法に別の同一の要素がさらに存在する可能性がある。 It should be noted that, as used herein, the terms "include", "provide" or any other variation thereof by cover a non-exclusive inclusion, such as a process, device, article or a process, apparatus, article containing a set of elements. The method includes not only those elements, but also other elements not explicitly exemplified, or further elements specific to these processes, devices, articles or methods. Unless further limited, an element limited by the phrase "contains ..." may further have another identical element in the process, device, article or method containing the element.
本願の上記実施例の番号は、説明のためのものに過ぎず、実施例の優劣を示すものではない。以上の実施形態の説明により、当業者が明確に理解できるように、上記実施例の方法は、ソフトウェアと必要な汎用ハードウェアプラットフォームを併用した方法で実現でき、当然のことながら、ハードウェアでも実現できるが、多くの場合に前者がより好ましい実施形態である。このような理解に基づいて、本願の技術手段は、本質的又は従来技術に寄与する部分が、ソフトウェア製品の形態で具現化されてよく、該コンピュータソフトウェア製品は、上記記録媒体(例えば、ROM/RAM、磁気ディスク、光ディスク)に記憶されており、1台の端末装置(携帯電話、コンピュータ、サーバ又はネットワーク装置などであってよい)に本願の各実施例に記載の方法を実行させるための複数の命令を含む。 The numbers in the above embodiments of the present application are for illustration purposes only and do not indicate superiority or inferiority of the embodiments. As can be clearly understood by those skilled in the art by the above description of the embodiment, the method of the above embodiment can be realized by a method using both software and a necessary general-purpose hardware platform, and of course, it can also be realized by hardware. Although possible, the former is often the more preferred embodiment. Based on such an understanding, the technical means of the present application may be embodied in the form of a software product in which an essential part or a part contributing to the prior art may be embodied, and the computer software product may be a recording medium (for example, ROM / ROM / A plurality of devices (which may be a mobile phone, a computer, a server, a network device, or the like) stored in a RAM (RAM, magnetic disk, optical disk), for causing one terminal device (which may be a mobile phone, a computer, a server, a network device, etc.) to execute the method described in each embodiment of the present application. Includes instructions for.
以上は、本願の好ましい実施例に過ぎず、本願の保護範囲を限定するものではなく、本願の明細書及び図面の内容を利用してなされた等価構造又は等価フロー変換、又は他の関連する技術分野における直接又は間接運用は、いずれも同様に本願の保護範囲に含まれる。 The above is merely a preferred embodiment of the present application, which does not limit the scope of protection of the present application, and is an equivalent structure or equivalent flow conversion made by utilizing the contents of the specification and drawings of the present application, or other related techniques. Both direct and indirect operations in the field are similarly included in the scope of protection of the present application.
Claims (20)
入力データ、出力データ、入力誤差及び出力誤差を一時的に記憶する記憶空間である一時記憶空間を作成するステップと、
処理対象データのタイプ及び方向に応じて、前記処理対象データに対応する一時記憶空間を呼び出し、前記処理対象データを呼び出された一時記憶空間に読み込むステップと、
前記呼び出された一時記憶空間内で前記処理対象データに対して所定の処理を行うステップと、
処理後のデータのタイプ及び方向に応じて、前記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むステップと、を含むことを特徴とする畳み込みニューラルネットワークに基づく、ビデオメモリ処理方法。 A video memory processing method based on a convolutional neural network applied to electronic devices.
Steps to create a temporary storage space, which is a storage space for temporarily storing input data, output data, input errors, and output errors.
A step of calling a temporary storage space corresponding to the processing target data according to the type and direction of the processing target data and reading the processing target data into the called temporary storage space.
A step of performing predetermined processing on the processing target data in the called temporary storage space, and
Video memory processing based on a convolutional neural network comprising, depending on the type and direction of the processed data, a step of writing the data in the called temporary storage space to a designated external storage space. Method.
前記処理対象データに対して畳み込み処理、重畳処理、乗算処理又は積分演算のうちの少なくとも1つを行うステップを含むことを特徴とする、請求項1に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理方法。 The step of performing a predetermined process on the data to be processed is
The video memory processing method based on a convolutional neural network according to claim 1, further comprising a step of performing at least one of a convolutional process, a superimposition process, a multiplication process, and an integral operation on the data to be processed. ..
設定された書き込み方式で、前記一時記憶空間内の処理後のデータを指定された外部記憶空間内に書き込むステップを含み、前記書き込み方式は、Additionモード及びConcatモードを含むことを特徴とする、請求項1に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理方法。 The step of writing the data in the called temporary storage space into the specified external storage space is
A billing scheme comprising the steps of writing processed data in the temporary storage space into a designated external storage space in a configured write scheme, wherein the write scheme includes an Addition mode and a Concat mode. The video memory processing method based on the convolutional neural network according to Item 1.
Concatモードが設定されている場合、設定されたデータ長情報に基づいて、対応する一時記憶空間内のデータを前記外部記憶空間に間隔をあけて順次書き込むことを特徴とする、請求項8に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理方法。 When the Addition mode is set, the data in the corresponding temporary storage space is cumulatively written to the external storage space.
The eighth aspect of the present invention, wherein when the Concat mode is set, the data in the corresponding temporary storage space is sequentially written to the external storage space at intervals based on the set data length information. Video memory processing method based on convolutional neural network.
前記データの方向は、入力及び出力を含むことを特徴とする、請求項1〜9のいずれか一項に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理方法。 The type of data includes input data, output data, input error and output error.
The video memory processing method based on a convolutional neural network according to any one of claims 1 to 9, wherein the direction of the data includes an input and an output.
処理対象データのタイプ及び方向に応じて、前記処理対象データに対応する一時記憶空間を呼び出し、前記処理対象データを呼び出された一時記憶空間に読み込むデータ呼び出し部と、
前記呼び出された一時記憶空間内で前記処理対象データに対して所定の処理を行う前処理部と、
処理後のデータのタイプ及び方向に応じて、前記呼び出された一時記憶空間内のデータを指定された外部記憶空間に書き込むデータ書き込み部と、を含むことを特徴とする、畳み込みニューラルネットワークに基づくビデオメモリ処理システム。 A space creation unit that creates a temporary storage space, which is a storage space that temporarily stores input data, output data, input errors, and output errors.
A data calling unit that calls a temporary storage space corresponding to the processing target data and reads the processing target data into the called temporary storage space according to the type and direction of the processing target data.
A pre-processing unit that performs predetermined processing on the processing target data in the called temporary storage space, and
A video based on a convolutional neural network, comprising a data writer that writes data in the called temporary storage space to a designated external storage space, depending on the type and direction of the processed data. Memory processing system.
畳み込みの変数が系列x(n)及びh(n)であれば、畳み込み結果は下式に示すとおりであり、
If the variables of the convolution are the series x (n) and h (n), the convolution result is as shown in the following equation.
畳み込みの変数がx(t)とh(t)の2つの関数であれば、畳み込み結果は下式に示すとおりであり、
If the convolution variables are two functions x (t) and h (t), the convolution result is as shown in the following equation.
前記書き込み方式は、Additionモード及びConcatモードを含むことを特徴とする、請求項11に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理システム。 The data writing unit writes the processed data in the temporary storage space to the designated external storage space by the set writing method.
The video memory processing system based on the convolutional neural network according to claim 11, wherein the writing method includes an Addition mode and a Concat mode.
Concatモードが設定されている場合、前記データ書き込み部は、設定されたデータ長情報に基づいて、対応する一時記憶空間内のデータを前記外部記憶空間に間隔をあけて順次書き込むことを特徴とする、請求項11に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理システム。 When the Addition mode is set, the data writing unit cumulatively writes the data in the corresponding temporary storage space to the external storage space.
When the Concat mode is set, the data writing unit is characterized in that data in the corresponding temporary storage space is sequentially written to the external storage space at intervals based on the set data length information. The video memory processing system based on the convolutional neural network according to claim 11.
前記メモリは、前記プロセッサによって実行されると、請求項1〜11のいずれか一項に記載の畳み込みニューラルネットワークに基づくビデオメモリ処理方法のステップを実現する、畳み込みニューラルネットワークに基づくビデオメモリ処理プログラムを含むことを特徴とする、電子装置。 Including memory and processor
The memory is a video memory processing program based on a convolutional neural network that, when executed by the processor, realizes the steps of the video memory processing method based on the convolutional neural network according to any one of claims 1 to 11. An electronic device characterized by including.
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910497396.8A CN110377342B (en) | 2019-06-10 | 2019-06-10 | Video memory processing method and device based on convolutional neural network and storage medium |
CN201910497396.8 | 2019-06-10 | ||
PCT/CN2019/118467 WO2020248499A1 (en) | 2019-06-10 | 2019-11-14 | Convolutional neural network-based video memory processing method, device, and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2021532498A true JP2021532498A (en) | 2021-11-25 |
JP7174831B2 JP7174831B2 (en) | 2022-11-17 |
Family
ID=68249933
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2021506309A Active JP7174831B2 (en) | 2019-06-10 | 2019-11-14 | Video memory processing method, apparatus and recording medium based on convolutional neural network |
Country Status (3)
Country | Link |
---|---|
JP (1) | JP7174831B2 (en) |
CN (1) | CN110377342B (en) |
WO (1) | WO2020248499A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110377342B (en) * | 2019-06-10 | 2022-08-30 | 平安科技(深圳)有限公司 | Video memory processing method and device based on convolutional neural network and storage medium |
CN112957068B (en) * | 2021-01-29 | 2023-07-11 | 青岛海信医疗设备股份有限公司 | Ultrasonic signal processing method and terminal equipment |
CN114330755B (en) * | 2022-03-11 | 2022-06-21 | 深圳鹏行智能研究有限公司 | Data set generation method and device, robot and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018074012A1 (en) * | 2016-10-19 | 2018-04-26 | ソニーセミコンダクタソリューションズ株式会社 | Operation processing circuit and recognition system |
JP2018537788A (en) * | 2015-12-10 | 2018-12-20 | ディープマインド テクノロジーズ リミテッド | Extension of neural network using external memory |
US20190156188A1 (en) * | 2017-11-17 | 2019-05-23 | Kabushiki Kaisha Toshiba | Arithmetic processing device |
Family Cites Families (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7526634B1 (en) * | 2005-12-19 | 2009-04-28 | Nvidia Corporation | Counter-based delay of dependent thread group execution |
CN103136724B (en) * | 2011-11-30 | 2015-11-25 | 北大方正集团有限公司 | screening method and device |
CN103207841B (en) * | 2013-03-06 | 2016-01-20 | 青岛海信传媒网络技术有限公司 | Based on data read-write method and the device of key-value pair buffer memory |
CN104090938A (en) * | 2014-06-26 | 2014-10-08 | 广州金山网络科技有限公司 | Method and device for submitting data |
CN106779057B (en) * | 2016-11-11 | 2020-04-17 | 北京旷视科技有限公司 | Method and device for calculating binary neural network convolution based on GPU |
CN108229687B (en) * | 2016-12-14 | 2021-08-24 | 腾讯科技(深圳)有限公司 | Data processing method, data processing device and electronic equipment |
CN107832839B (en) * | 2017-10-31 | 2020-02-14 | 南京地平线机器人技术有限公司 | Method and apparatus for performing operations in convolutional neural networks |
CN108182469A (en) * | 2017-12-27 | 2018-06-19 | 郑州云海信息技术有限公司 | A kind of neural network model training method, system, device and storage medium |
CN108197705A (en) * | 2017-12-29 | 2018-06-22 | 国民技术股份有限公司 | Convolutional neural networks hardware accelerator and convolutional calculation method and storage medium |
CN109657793B (en) * | 2018-12-26 | 2020-09-22 | 广州小狗机器人技术有限公司 | Model training method and device, storage medium and electronic equipment |
CN110377342B (en) * | 2019-06-10 | 2022-08-30 | 平安科技(深圳)有限公司 | Video memory processing method and device based on convolutional neural network and storage medium |
-
2019
- 2019-06-10 CN CN201910497396.8A patent/CN110377342B/en active Active
- 2019-11-14 WO PCT/CN2019/118467 patent/WO2020248499A1/en active Application Filing
- 2019-11-14 JP JP2021506309A patent/JP7174831B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2018537788A (en) * | 2015-12-10 | 2018-12-20 | ディープマインド テクノロジーズ リミテッド | Extension of neural network using external memory |
WO2018074012A1 (en) * | 2016-10-19 | 2018-04-26 | ソニーセミコンダクタソリューションズ株式会社 | Operation processing circuit and recognition system |
US20190156188A1 (en) * | 2017-11-17 | 2019-05-23 | Kabushiki Kaisha Toshiba | Arithmetic processing device |
JP2019095862A (en) * | 2017-11-17 | 2019-06-20 | 株式会社東芝 | Arithmetic processing device |
Non-Patent Citations (2)
Title |
---|
FENG LIANG, ET AL.: ""Design of 16-bit fixed-point CNN coprocessor based on FPGA"", PROCEEDINGS OF 2018 IEEE 23RD INTERNATIONAL CONFERENCE ON DIGITAL SIGNAL PROCESSING (DSP), JPN6022042906, 21 November 2018 (2018-11-21), pages 5, ISSN: 0004893718 * |
齋藤 修(外3名): "「大規模ニューラルネットワークに対応可能な学習機能内蔵ディジタルニューロチップ」", 電子情報通信学会技術研究報告, vol. 98, no. 24, JPN6022042905, 23 April 1998 (1998-04-23), JP, pages 25 - 32, ISSN: 0004893719 * |
Also Published As
Publication number | Publication date |
---|---|
CN110377342A (en) | 2019-10-25 |
JP7174831B2 (en) | 2022-11-17 |
WO2020248499A1 (en) | 2020-12-17 |
CN110377342B (en) | 2022-08-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2021532498A (en) | Video memory processing methods, devices and recording media based on convolutional neural networks | |
US9824269B2 (en) | Enhanced interpretation of character arrangements | |
EP2438529B1 (en) | Conditional operation in an internal processor of a memory device | |
US20180137414A1 (en) | Convolution operation device and convolution operation method | |
US20120330979A1 (en) | Sorting a dataset of incrementally received data | |
JP2008059438A (en) | Storage system, data rearranging method thereof and data rearrangement program | |
CN101751462A (en) | Network information storage and access methods, equipment and terminals | |
JP5619979B2 (en) | Electronic device including a mind map user interface, and a mind map creation method using the same | |
CN115906720A (en) | Memory design method and device, electronic equipment and storage medium | |
WO2015098707A1 (en) | Memory equipped with information retrieval function, method for using same, device, and information processing method | |
CN117312330B (en) | Vector data aggregation method and device based on note storage and computer equipment | |
CN115730596A (en) | Object recommendation method and device and computer equipment | |
CN105718214B (en) | The access method and device of fingerprint mask image | |
CN105518790B (en) | The method and device of data write-in | |
CN107169313A (en) | The read method and computer-readable recording medium of DNA data files | |
CN104408023B (en) | Method and indicia calculator that a kind of index is calculated | |
CN111931937A (en) | Gradient updating method, device and system of image processing model | |
CN112286579B (en) | Data processing method, device, computer readable storage medium and computer equipment | |
CN107436918A (en) | Database implementation method, device and equipment | |
CN115563445A (en) | Matrix matching search method, device, equipment and storage medium | |
CN111046241B (en) | Graph storage method and device for flow graph processing | |
CN102622318A (en) | Storage controlling circuit and vector data addressing method controlled by same | |
CN114218898A (en) | Online collaborative document editing method and device, computer equipment and storage medium | |
CN110909149B (en) | Data filtering method and device | |
Chen et al. | Improvement Techniques |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20210204 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20220412 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20220627 |
|
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: 20221011 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20221107 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7174831 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |