JP2014074959A - Adjacent search processing device, method and program - Google Patents
Adjacent search processing device, method and program Download PDFInfo
- Publication number
- JP2014074959A JP2014074959A JP2012220719A JP2012220719A JP2014074959A JP 2014074959 A JP2014074959 A JP 2014074959A JP 2012220719 A JP2012220719 A JP 2012220719A JP 2012220719 A JP2012220719 A JP 2012220719A JP 2014074959 A JP2014074959 A JP 2014074959A
- Authority
- JP
- Japan
- Prior art keywords
- vector
- node
- distance
- query
- shortest distance
- 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.)
- Pending
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、近傍探索処理装置及び方法及びプログラムに係り、特に、ベクトルの次元数が高次元な場合に、クエリのベクトルと、大規模なベクトルデータベースの近傍探索処理を、GPU(Graphics Processing Unit)デバイスに代表されるメニーコア演算器の並列演算能力の高さに着目し、kNN(k-Nearest Neighbor)グラフを用いて実現するための近傍探索処理装置及び方法及びプログラムに関する。 The present invention relates to a neighborhood search processing apparatus, method, and program, and in particular, when a vector has a high number of dimensions, a query vector and neighborhood search processing of a large-scale vector database are performed by a GPU (Graphics Processing Unit). The present invention relates to a neighborhood search processing apparatus, method, and program for realizing using a kNN (k-Nearest Neighbor) graph, focusing on the high parallel computing capability of a many-core computing unit represented by a device.
ベクトルの次元数が高次元な場合に、クエリのベクトルと大規模なベクトルDBとの近傍探索処理をGPUデバイスに代表されるメニーコア演算器の並列演算能力の高さに着目し、高精度かつ高速な探索処理をkNNグラフを用いて行う方法として以下のような方法がある。ここで、kNNグラフとは、最近傍検索のためのアルゴリズムであり、各ノードが最も近いk個のノードと辺で結ぶ。グラフが無向グラフである場合、各ノードの次数はkである。 When the number of vector dimensions is high, pay attention to the high parallel processing capability of many-core computing units represented by GPU devices for the neighborhood search processing of query vectors and large-scale vector DBs. As a method for performing a simple search process using a kNN graph, there are the following methods. Here, the kNN graph is an algorithm for nearest neighbor search, and each node is connected to the nearest k nodes by edges. If the graph is an undirected graph, the degree of each node is k.
[従来技術1]
ホストコンピュータのみで、kNNグラフを用いた近傍探索がある(例えば、非特許文献1参照)。
[Prior art 1]
There is a neighborhood search using a kNN graph only by a host computer (for example, see Non-Patent Document 1).
従来技術1の処理のフローチャートを図1に示す。
FIG. 1 shows a flowchart of the processing of the
当該技術の近傍探索では、kNNグラフを構築した時の枝数をグラフ探索に利用する。クエリは、現ノードとの距離計算とその枝ノード群との距離計算を繰り返して行い(ステップ4〜7)、クエリから最短距離のノードを選択する(ステップ8)。そして、最短距離ノードが、現ノードであれば、そのノード最近傍として出力する(ステップ10)。一方、最短距離ノードが、現ノード以外であれば、最短距離ノードにホップして(ステップ9)、ホップ先ノードを現ノードにして、グラフ探索を再開する(ステップ4〜9)。
In the neighborhood search of the technology, the number of branches when the kNN graph is constructed is used for the graph search. The query repeats the distance calculation with the current node and the distance calculation with the branch node group (
この探索では、枝数をパラメータとして、速度と精度を調整することができるが、速度を重視すると、枝数を減らす必要があるため、精度が低下してしまう問題がある。 In this search, the speed and accuracy can be adjusted using the number of branches as a parameter. However, if the speed is emphasized, the number of branches needs to be reduced, and there is a problem that the accuracy is lowered.
[従来技術2]
さらに、kNNグラフをホップする際の条件判定をするために行うベクトル間の距離計算をGPUデイバスで並列化した方法がある。
[Prior art 2]
Furthermore, there is a method in which distance calculation between vectors performed for determining a condition when hopping a kNN graph is parallelized using a GPU device.
従来技術2の処理を図2に示す。
FIG. 2 shows the processing of the
この方法は、ホストコンピュータとGPUデバイスを利用して、kNNグラフを用いた近傍探索を行う。当該近傍探索では、kNNグラフを構築したときの枝数をグラフ探索に利用する。クエリは、GPUデバイスにて、現ノードとその枝ノード群との並列距離計算をして、計算結果をホストコンピュータに転送する(ステップ16)。ホストコンピュータでは、クエリから最短距離のノードを選択してホストコンピュータに転送する(ステップ17,18)。そして、ホストコンピュータ側では最短距離ノードが、現ノードであれば、そのノードを最近傍として出力する(ステップ19,21)。一方、最短距離ノードが、現ノード以外であれば、最短距離ノードにホップして(ステップ20)、ホップ先ノードを現ノードにして、グラフ探索を再開する(ステップ16〜20)。
This method uses a host computer and a GPU device to perform a neighborhood search using a kNN graph. In the neighborhood search, the number of branches when the kNN graph is constructed is used for the graph search. The query calculates the parallel distance between the current node and its branch node group in the GPU device, and transfers the calculation result to the host computer (step 16). The host computer selects the node with the shortest distance from the query and transfers it to the host computer (
このグラフ探索では、枝数をパラメータとして、速度と精度を調整することができるが、速度を重視すると、枝数を減らす必要があるため、精度が低下してしまう。距離計算をGPUデバイスで並列処理を行うことにより、精度向上のために枝数を増やしても距離計算速度を高速化することが可能になる。しかし、ホップする度に現ノードとその枝ノード群のベクトルデータをGPUデバイスに転送する処理が発生するために、転送処理による速度低下が問題となる。 In this graph search, the speed and accuracy can be adjusted using the number of branches as a parameter. However, if importance is placed on the speed, the number of branches needs to be reduced, and the accuracy is lowered. By performing distance calculation in parallel with GPU devices, the distance calculation speed can be increased even if the number of branches is increased to improve accuracy. However, since a process of transferring vector data of the current node and its branch node group to the GPU device occurs every time a hop occurs, a decrease in speed due to the transfer process becomes a problem.
[従来技術3]
また、クエリのベクトルが全ベクトルDBとGPUを用いて並列距離計算する方法がある。これは、GPUを用いたユークリッド距離計算を並列化した全探索が挙げられる。全探索はクエリのベクトルとDB側の距離計算を1つずつ行い、計算結果から最小の値を求めるので、厳密な探索処理が可能となる。さらに、GPUで並列化処理をしているので、CPUの逐次処理に対しては高速な処理が可能となる。
[Prior art 3]
In addition, there is a method of calculating a parallel distance by using all vectors DB and GPU for query vectors. This is a full search in which Euclidean distance calculation using GPU is parallelized. In the full search, the query vector and the distance calculation on the DB side are performed one by one, and the minimum value is obtained from the calculation result, so that a strict search process is possible. Furthermore, since parallel processing is performed on the GPU, high-speed processing is possible for sequential CPU processing.
しかし、全探索では、1つずつ距離計算を行っていくため、例えば、GPUを用いて並列処理をしたとしても、従来技術1,2と比較すると処理速度が遅いという問題がある。
However, since the distance search is performed one by one in the full search, for example, even if parallel processing is performed using a GPU, there is a problem that the processing speed is slower than in the
上記のように、大規模な高次元ベクトル群の高速な最近傍探索方法としては、kNNグラフ構築時の枝数で近似最近傍探索処理を用いる技術は存在したが、従来技術1のようにホストのみを用いた探索では、枝数が少ない場合、高速な探索が可能となるが、精度を確保するには枝数を増やす必要があり、そうなると速度が低下するという問題がある。
As mentioned above, as a fast nearest neighbor search method for large-scale high-dimensional vectors, there is a technique that uses approximate nearest neighbor search processing based on the number of branches at the time of kNN graph construction, but as in
また、従来技術2のように、距離計算をGPUデバイスで並列化した場合でも、GPUデバイスによる並列距離計算で多数の枝を高速に距離計算でき、精度を上げることができるが、ホップ度にホスト−GPUデバイス間の転送が発生するので、処理速度が低下する。
In addition, even when the distance calculation is parallelized with the GPU device as in the
本発明は、上記の点に鑑みなされたもので、ベクトルの次元数が高次元な場合に、クエリのベクトルと大規模なベクトルDBとの近傍探索処理を、GPUデバイスに代表されるメニーコア演算器の並列演算能力の高さに着目し、kNNグラフを用いて高精度かつ高速な探索処理を実現することが可能な近傍探索処理装置及び方法及びプログラムを提供することを目的とする。 The present invention has been made in view of the above points, and when a vector has a high number of dimensions, a proximity search process between a query vector and a large-scale vector DB is performed by a many-core arithmetic unit represented by a GPU device. Focusing on the high parallel computing capability, the object is to provide a neighborhood search processing apparatus, method and program capable of realizing high-precision and high-speed search processing using a kNN graph.
上記の課題を解決するため、本発明(請求項1)は、kNN(k-Nearest Neighbor)グラフ構造を用いてベクトル群の近傍探索を行う近傍探索処理装置であって、
枝数N本の前記kNNグラフを構築し、グラフ探索開始ノードを現ノードとする事前処理手段と、
前記現ノードの枝N本のうち、該現ノードから距離が近いM本を選択して、該現ノードと該M本のノードとの距離を計算する距離計算手段と、
前記距離計算手段で得られた距離計算結果から、入力されたクエリから最短距離のノードを選択する最短距離ノード選択手段と、
選択された前記最短距離のノードが前記現ノードと等しくない場合は、該最短距離のノードにホップし、前記距離計算手段及び前記最短距離ノード選択手段を実行するグラフ探索手段と、
前記選択された前記最短距離のノードが等しい場合は、該現ノードから距離が遠いN−M個の枝ノードに対応するベクトルIDを選択し、該N−M個の枝ノードに対応するベクトル群と前記クエリのベクトルの並列距離計算を行い、該現ノード及び該N−M個の枝ノードと前記クエリ間の距離のN−M+1個の計算結果より、該クエリから最短距離のノードを選択する最近傍ベクトル抽出手段と、を有する。
In order to solve the above problems, the present invention (Claim 1) is a neighborhood search processing apparatus that performs neighborhood search of a vector group using a kNN (k-Nearest Neighbor) graph structure,
Pre-processing means for constructing the kNN graph of N branches and having the graph search start node as the current node;
A distance calculation means for selecting M branches near the current node from N branches of the current node and calculating a distance between the current node and the M nodes;
From the distance calculation result obtained by the distance calculation means, the shortest distance node selection means for selecting the shortest distance node from the input query,
If the selected shortest distance node is not equal to the current node, hop to the shortest distance node and execute the distance calculation means and the shortest distance node selection means;
If the selected nodes of the shortest distance are equal, a vector ID corresponding to NM branch nodes that are far from the current node is selected, and a vector group corresponding to the NM branch nodes is selected. And the parallel distance calculation of the vector of the query, and from the N−M + 1 calculation results of the distance between the current node and the N−M branch nodes and the query, the node with the shortest distance from the query is calculated. And nearest neighbor vector extraction means for selecting.
また、本発明(請求項2)は、ベクトル群を格納したベクトル記憶手段と、GPUデバイスと、前記ベクトル記憶手段の前記ベクトル群のデータを、前記GPUデバイスに転送する手段と、を更に有し、
前記最近傍ベクトル抽出手段は、
選択した前記ベクトルIDを前記GPUデバイスに転送し、前記N−M個の枝ノードに対応するベクトル群と前記クエリのベクトルの並列距離計算結果を該GPUデバイスから取得する手段を含み、
前記GPUデバイスは、
前記ベクトルIDに基づいて前記ベクトル群のデータを参照して、該ベクトルIDに対応するベクトル群と前記クエリのベクトルの並列距離計算を行う並列距離計算手段を含む。
The present invention (Claim 2) further comprises vector storage means storing vector groups, a GPU device, and means for transferring the data of the vector groups of the vector storage means to the GPU device. ,
The nearest neighbor vector extracting means includes:
Means for transferring the selected vector ID to the GPU device, and obtaining from the GPU device a parallel distance calculation result of a vector group corresponding to the NM branch nodes and a vector of the query;
The GPU device is
Parallel distance calculation means for referring to the data of the vector group based on the vector ID and calculating a parallel distance between the vector group corresponding to the vector ID and the vector of the query is included.
また、本発明(請求項3)は、メニーコア演算器を更に有し、
前記最近傍ベクトル抽出手段は、
前記選択された前記最短距離のノードが等しい場合は、前記メニーコア演算器に対して
前記現ノードから距離が遠いN−M個の枝ノードに対応するベクトル群と前記クエリベクトルの並列距離計算を指示し、計算結果を取得する並列距離計算指示手段を含み、
前記メニーコア演算器は、
前記現ノードから距離が遠いN−M個の枝ノードに対応するベクトル群と前記クエリベクトルの並列距離計算を行う手段を含む。
The present invention (Claim 3) further includes a many-core computing unit,
The nearest neighbor vector extracting means includes:
If the selected shortest distance nodes are equal, the many-core computing unit is instructed to calculate a parallel distance between the vector group corresponding to N-M branch nodes far from the current node and the query vector. And a parallel distance calculation instruction means for obtaining the calculation result,
The many-core computing unit is:
Means for calculating a parallel distance between a vector group corresponding to NM branch nodes far from the current node and the query vector;
上記のように本発明によれば、kNNグラフ構築時に探索用近傍ベクトルと、距離計算用近傍ベクトルを別に設けることで、従来のkNNより高速かつ高精度な近傍探索処理が可能になる。 As described above, according to the present invention, when a kNN graph is constructed, a search neighborhood vector and a distance calculation neighborhood vector are separately provided, so that neighborhood search processing that is faster and more accurate than conventional kNN becomes possible.
これにより、処理のコストの大きな大規模な高次元ベクトル群の近傍探索処理でも、kNNグラフを構築し、グラフ探索用の近傍ベクトル数とグラフ探索後の距離計算用の近傍ベクトル数を分けてグラフ探索後に多数のベクトルと距離計算することで、高精度な探索が可能になる。 As a result, even in the neighborhood search processing of large-scale high-dimensional vector groups with large processing costs, a kNN graph is constructed, and the graph is divided into the number of neighborhood vectors for graph search and the number of neighborhood vectors for distance calculation after the graph search. A high-precision search is possible by calculating distances with a large number of vectors after the search.
さらに、グラフ探索後の距離計算にGPUデバイス等のメニーコア演算器を用いて並列化することで高速な探索が可能になる。 Furthermore, a high-speed search becomes possible by parallelizing the distance calculation after the graph search using a many-core arithmetic unit such as a GPU device.
上記により、高次元なベクトルを取り扱う物体認識処理システムにおいて、処理時間を短縮することが可能となる。 As described above, in the object recognition processing system that handles high-dimensional vectors, it is possible to shorten the processing time.
以下、図面と共に本発明の実施の形態を説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[第1の実施の形態]
本実施の形態では、グラフ探索用と距離計算用の近傍ベクトル数を異なる数にする方法について説明する。
[First embodiment]
In the present embodiment, a method for setting different numbers of neighboring vectors for graph search and distance calculation will be described.
図3は、本発明の第1の実施の形態におけるホストコンピュータを有する並列化近傍探索処理装置の構成例である。 FIG. 3 is a configuration example of a parallel neighborhood search processing apparatus having a host computer according to the first embodiment of the present invention.
並列化近傍探索処理装置11は、ホストコンピュータ12を有し、ホストコンピュータ12は、メインメモリ13とCPU14を有する。なお、ホストコンピュータ12には、任意の台数の他のデバイスを接続することが可能である。
The parallel neighborhood
メインメモリ13は、外部から入力されるクエリのベクトルデータ及び、CPU14における計算結果等を保持する。
The
CPU14は、枝数N本のkNNグラフを構築する機能、グラフ探索開始ノードを現ノードとする機能、現ノードの枝N本から距離が近いM本を選択して、該現ノードと該M本のノードとの距離を計算する機能、距離計算結果から、入力されたクエリから最短距離のノードを選択する機能、選択された最短距離のノードが現ノードと等しいか否かを判定する機能、kNNグラフの探索を行う機能、グラフ探索後に、現ノード及びN−M個の枝ノードとクエリ間の距離のN−M+1個の計算結果より、該クエリから最短距離のノードを選択する機能、最短距離のノードのベクトルID、最短距離ノードとクエリ間の距離を出力する機能を有する。
The
上記の構成における動作を説明する。 The operation in the above configuration will be described.
図4は、本発明の第1の実施の形態における並列化近傍探索処理装置の処理のフローチャートである。 FIG. 4 is a flowchart of the process of the parallelization neighborhood search processing apparatus in the first embodiment of the present invention.
以下では、枝数N本でkNNグラフがホストコンピュータ12内のメインメモリ13上に構築されていることを前提とする。
In the following, it is assumed that a kNN graph with N branches is constructed on the
ステップ101) 予め、ホストコンピュータ12のCPU14は、グラフ探索開始ノードを決定し、メインメモリ13に格納する。
Step 101) The
ステップ102) ホストコンピュータ12は、外部からのクエリのベクトルデータの入力を受け付け、メインメモリ13に格納する。
Step 102) The
ステップ103) CPU14は、入力されたベクトルデータに対して、グラフ探索開始ノードを現ノードとする。
Step 103) The
ステップ104) CPU14は、現ノードの枝N本のうち、現ノードから距離が近い枝M本(N>M)を選択する。
Step 104) The
ステップ105) CPU14において、クエリが、現ノードとその枝M本のノード群との距離を計算し、メインメモリ13に格納する。
Step 105) In the
ステップ106) メインメモリ13に格納されている計算結果から、クエリからの最短距離のノードを選択する。
Step 106) From the calculation results stored in the
ステップ107) もし、クエリから最短距離のノードが現ノードと等しくないならば、ステップ108に移行し、等しい場合はステップ109に移行する。
Step 107) If the node at the shortest distance from the query is not equal to the current node, go to
ステップ108) CPU14は、最短距離の枝ノードにホップし、ステップ104に移行して、ホップ先のノードを現ノードとしてグラフ探索する。
Step 108) The
ステップ109) CPU14は、現ノードから距離が遠いN−M個の枝ノードに対応するベクトルIDを選択する。
Step 109) The
ステップ110) CPU14は、現ノード及び選択されたN−M個の枝ノードとクエリ間の距離を計算し、メインメモリ13に格納する。
Step 110) The
ステップ111) CPU14は、メインメモリ13に格納されている計算結果N−M+1個より、クエリから最短距離にあるノードを選択する。
Step 111) The
ステップ112) CPU14は、メインメモリ13から最短距離のノードのベクトルIDと、最短距離ノードとクエリ間の距離を読み出して出力する。
Step 112) The
[第2の実施の形態]
次に、図3の構成に並列距離計算を行うためのGPUデバイスを用いる例について説明する。
[Second Embodiment]
Next, an example of using a GPU device for performing parallel distance calculation in the configuration of FIG. 3 will be described.
図5は、本発明の第2の実施の形態におけるGPUを有する並列化近傍探索処理装置の構成の例を示す。 FIG. 5 shows an example of the configuration of a parallelized neighborhood search processing apparatus having a GPU according to the second embodiment of the present invention.
同図に示す並列化近傍探索処理装置21は、図3のホストコンピュータ12に加えて、ベクトルDB25とGPUデバイス26を付加した構成である。GPUデバイス26は、GPUグローバルメモリ27、GPU28を有する。
The parallelized neighborhood
図5に示すCPU24は、ベクトルDB25のベクトルデータをGPUデバイス24に転送する機能、及び、第1の実施の形態における、N−M個の枝ノードに対応するベクトル群とクエリのベクトルの並列距離計算を、GPUデバイス24に対して指示し、計算結果を取得する機能を有する。その他の機能は第1の実施の形態と同様である。
The
GPU28は、CPU24から並列距離計算の指示を受けると、N−M個の枝ノードに対応するベクトル群とクエリのベクトルの並列距離計算を行い、その結果をCPU24に返却する機能を有する。
Upon receiving an instruction for parallel distance calculation from the
以下に、上記の構成における動作を説明する。 The operation in the above configuration will be described below.
図6は、本発明の第2の実施の形態における並列化近傍探索処理装置の処理のフローチャートである。 FIG. 6 is a flowchart of the processing of the parallelized neighborhood search processing device in the second embodiment of the present invention.
以下では、枝数N本でkNNグラフがホストコンピュータ22のメインメモリ23に構築されていることを前提とする。
In the following, it is assumed that a kNN graph with N branches is constructed in the
ステップ201)予めホストコンピュータ22は、ベクトルDB25をGPUデバイス26に転送する。
Step 201) The
ステップ202) CPU24は、グラフ探索開始ノードを決定する。
Step 202) The
ステップ203) CPU24は、外部からのクエリのベクトルデータの入力を受け付け、メインメモリ23に格納する。
Step 203) The
ステップ204) CPU24は、入力されたベクトルデータに対してグラフ探索開始ノードを現ノードとする。
Step 204) The
ステップ205) CPU24は、現ノードの枝N本のうち、現ノードから距離が近い枝M本(N>M)を選択し、メインメモリ23に格納する。
Step 205) The
ステップ206) CPU24において、クエリが現ノードとその枝M本のノード群との距離を計算し、メインメモリ23に格納する。
Step 206) In the
ステップ207) CPU24は、メインメモリ23に格納されている計算結果より、クエリから最短距離のノードを選択する。
Step 207) The
ステップ208) CPU24は、もし、クエリから最短距離のノードが現ノードと等しくないならば、ステップ209に移行する。等しい場合はステップ210に移行する。
Step 208) The
ステップ209) CPU24は、最短距離の枝ノードにホップし、ステップ205の処理に戻り、ホップ先のノードを現ノードとしてグラフ探索を続ける。
Step 209) The
ステップ210) CPU24は、クエリから最短距離のノードが現ノードに等しい場合は、現ノードから距離が遠いN−M個の枝ノードに対応するベクトルIDを選択する。
Step 210) If the node with the shortest distance from the query is equal to the current node, the
ステップ211) CPU24は、クエリのベクトルデータ及び、ステップ210で選択されたN−M個のベクトルIDをGPUデバイス26に転送する。
Step 211) The
ステップ212) GPUデバイス26は、N−M個のノードに対応するベクトル群とクエリのベクトルの並列距離計算を行う。
Step 212) The
ステップ213) GPUデバイス26は、ステップ212で計算されたN−M個の距離計算結果をホストコンピュータ22に転送する。
Step 213) The
ステップ214) CPU24は、GPUデバイス26から取得した距離計算結果をメインメモリ23に格納し、現ノード及び選択されたN−M個の枝ノードとクエリ間の距離計算結果N−M+1個より、クエリから最短距離のノードを選択する。
Step 214) The
ステップ215) CPU24は、最短距離ノードのベクトルIDと、最短距離ノードとクエリ間の距離を出力する。
Step 215) The
[第3の実施の形態]
本実施の形態では、第2の実施の形態におけるGPUデバイス26がメニーコア演算器であった場合について説明する。
[Third Embodiment]
In the present embodiment, a case where the
図7は、本発明の第3の実施の形態におけるメニーコア演算器を有する並列化近傍探索処理装置の構成例を示す。 FIG. 7 shows a configuration example of a parallel neighborhood search processing apparatus having a many-core arithmetic unit according to the third embodiment of the present invention.
同図に示す並列化近傍探索処理装置31は、図5のGPUデバイス26としてメニーコア演算器36がホストコンピュータ32に接続されている。メニーコア演算器36はホストコンピュータ32に複数接続することが可能である。
In the parallelized neighborhood
図7に示すCPU34は、第1の実施の形態における、N−M個の枝ノードに対応するベクトル群とクエリのベクトルの並列距離計算を、メニーコア演算器36に対して指示し、計算結果を取得する機能を有する。その他の機能は第1の実施の形態と同様である。
The
メニーコア演算器36は、CPU34から並列距離計算の指示を受けると、N−M個の枝ノードに対応するベクトル群とクエリのベクトルの並列距離計算を行い、その結果をCPU34に返却する機能を有する。
When receiving a parallel distance calculation instruction from the
図8は、本発明の第3の実施の形態における並列化近傍探索処理装置の処理のフローチャートである。 FIG. 8 is a flowchart of the process of the parallel neighborhood search processing apparatus in the third embodiment of the present invention.
ステップ301) ホストコンピュータ32は、グラフ探索開始ノードを決定する。
Step 301) The
ステップ302) ホストコンピュータ32は、外部からのクエリのベクトルデータの入力を受け付け、メインメモリ33に格納する。
Step 302) The
ステップ303) CPU34は、入力されたベクトルデータに対してグラフ探索開始ノードを現ノードに決定する。
Step 303) The
ステップ304) CPU34は、現ノードの枝N本のうち、現ノードから距離が近い枝M本(N>M)を選択する。
Step 304) The
ステップ305) CPU34において、クエリが現ノードとその枝M本のノード群との距離を計算する。
Step 305) In the
ステップ306) CPU34は、ステップ305の計算結果より、クエリから最短距離のノードを選択する。
Step 306) The
ステップ307) もし、クエリから最短距離のノードが現ノードと等しいならば、ステップ309に移行し、等しくないならばステップ308に移行する。
Step 307) If the node with the shortest distance from the query is equal to the current node, go to
ステップ308) 最短距離の枝ノードにホップし、ステップ304の処理に戻り、ホップ先のノードを現ノードとしてグラフ探索を続ける。 Step 308) Hop to the branch node with the shortest distance, and return to the processing of Step 304 to continue the graph search with the hop destination node as the current node.
ステップ309) CPU34は、メニーコア演算器36に対して並列距離計算を指示し、メニーコア演算器36において、現ノードから距離が遠いN−M個の枝ノードに対応するベクトル群とクエリのベクトルの並列距離を計算し、計算結果をCPU34に転送する。
Step 309) The
ステップ310) CPU34は、メニーコア演算気36の距離計算結果をメインメモリ33に格納し、現ノード及び選択されたN−M個の枝ノードとクエリ間の距離計算結果N−M+1個よりクエリから最願距離のノードを選択する。
Step 310) The
ステップ311) CPU34は、最短距離ノードのベクトルIDと最短距離ノードとクエリ間の距離を出力する。
Step 311) The
なお、本発明では、ホスト及びその内部の装置(メインメモリやCPU)、ベクトルDBが保存されている記憶装置、GPUデバイス、メニーコア演算器は複数搭載されていても適用可能である。 Note that the present invention is applicable even if a host and its internal devices (main memory and CPU), a storage device storing a vector DB, a GPU device, and a plurality of many-core computing units are mounted.
また、本発明では、kNNグラフのノードの1つがベクトルDB中のベクトル1に対応しているものとする。
In the present invention, it is assumed that one of the nodes of the kNN graph corresponds to the
以下に、上記の実施の形態における実施例を説明する。 Examples of the above embodiment will be described below.
[実施例1]
本実施例では、前述の第2の実施の形態の具体的な例を示す。
[Example 1]
In this example, a specific example of the above-described second embodiment is shown.
事前処理として、ベクトルDB26に保存されている画像群に対して、画像認識プログラムであるSURFアルゴリズムにより、128次元ベクトル群が合計10,000,000ベクトル抽出され、ハードディスク側(ベクトルDB25)に保存されている。
As pre-processing, a total of 10,000,000 vectors of 128-dimensional vector groups are extracted from the image groups stored in the
SURFアルゴリズムにより抽出されるベクトルの具体例を以下示す。
(0.00771829,0.00876939,-0.00164389,0.00242805,0.00591626,0.0059704,-0.000699053,0.0010269,-0.0402349,0.0478606,-0.00675006,0.008548,0.0079681,0.00937274,0.0254017,0.0303479,0.0105966,0.0781956,0.0237573,0.0313011,-0.0058261,0.00972548,0.00640149,0.00890163,0.00202366,0.005785,0.0008189,0.00261104,0.00168162,0.00313512,0.000645605,0.00187556,0.0156556,0.0198709,0.043964,0.0491846,-0.0457624,0.0519745,0.00104955,0.00352257,-0.0473678,0.0676495,-0.290302,0.372653,-0.105448,0.125615,-0.165742,0.227193,0.00130149,0.33567,0.171501,0.368598,-0.0482353,0.108972,0.0130523,0.0544993,-0.00404431,0.0100914,0.0318822,0.05294,-0.00937941,0.0154139,-0.000685246,0.00858936,0.00154014,0.0031448,0.00700949,0.00804435,-0.00668938,0.00847851,0.000471806,0.00180168,0.0882967,0.18727,0.0836585,0.0885382,-0.00612456,0.128606,0.0955226,0.0993798,-0.122265,0.198727,0.124402,0.35299,-0.0196364,0.0753894,0.0210032,0.155274,-0.00605615,0.0433227,-0.0162856,0.0611591,-0.0026333,0.00693902,1.00823e-005,0.00847174,0.00122396,0.00126437,-4.30777e-005,4.30777e-005,0.000536311,0.000536311,-2.0572e-005,2.79183e-005,0.0566939,0.0566939,-0.00197521,0.00197521,0.0473506,0.0473506,-0.00099733,0.00099733,-0.0350208,0.0410233,-0.00671439,0.0295273,0.00189219,0.003061,0.0154454,0.0282393,0.00100916,0.00239708,-0.00259997,0.00458948,0.00259418,0.00365359,0.000663469,0.00140468)
並列化近傍探索処理装置のCPU24は、ベクトルDB25の各ベクトルにおいて、探索用の近傍ベクトル数を10、距離計算用の近傍ベクトル数を512としてkNNグラフを構築する。
Specific examples of vectors extracted by the SURF algorithm are shown below.
(0.00771829, 0.00876939, -0.00164389, 0.00242805, 0.00591626, 0.0059704, -0.000699053, 0.0010269, -0.0402349, 0.0478606, -0.00675006, 0.008548, 0.0079681, 0.00937274, 0.0254017, 0.0303479, 0.0105966, 0.0781956, 0.0237573, 0.0313011, -54858261 0.00640149, 0.00890163, 0.00202366, 0.005785, 0.0008189, 0.00261104, 0.00168162, 0.00313512, 0.000645605, 0.00187556, 0.0156556, 0.0198709, 0.043964, 0.0491846, -0.0457624, 0.0519745, 0.00104955, 0.00352257, -0.0473678, 0.0676495, -0.290302, 0.372653, -0.105448 0.125615, -0.165742, 0.227193, 0.00130149, 0.33567, 0.171501, 0.368598, -0.0482353, 0.108972, 0.0130523, 0.0544993, -0.00404431, 0.0100914, 0.0318822, 0.05294, -0.00937941, 0.0154139, -0.000685246, 0.00858936, 0.00154014, 0.0031448, 0.00700949, 0.00804435 , -0.00668938, 0.00847851, 0.000471806, 0.00180168, 0.0882967, 0.18727, 0.0836585, 0.0885382, -0.00612456, 0.128606, 0.0955226, 0.0993798, -0.1 22265, 0.198727, 0.124402, 0.35299, -0.0196364, 0.0753894, 0.0210032, 0.155274, -0.00605615, 0.0433227, -0.0162856, 0.0611591, -0.0026333, 0.00693902, 1.00823e-005, 0.00847174, 0.00122396, 0.00126437, -4.330777e-005, 4.30777 e-005,0.000536311,0.000536311, -2.0572e-005,2.79183e-005,0.0566939,0.0566939, -0.00197521,0.00197521,0.0473506,0.0473506, -0.00099733,0.00099733, -0.0350208,0.0410233, -0.00671439,0.0295273,0.00189219,0.003061 , 0.0154454, 0.0282393, 0.00100916, 0.00239708, -0.00259997, 0.00458948, 0.00259418, 0.00365359, 0.000663469, 0.00140468)
The
ユーザが認識したい画像を撮影し、撮影画像からSURFアルゴリズムにより128次元のベクトル群が1,000ベクトル抽出されたものとして、各クエリのベクトルに対して以下の処理を行う。 An image that the user wants to recognize is captured, and the following processing is performed on the vectors of each query, assuming that 1,000 vectors of 128-dimensional vector groups are extracted from the captured image by the SURF algorithm.
以下、第2の実施の形態におけるホストコンピュータ22とGPUデバイス26からなる並列化近傍探索処理装置21において、枝数512本でkNNグラフが構築されている場合における処理を説明する。以下では、図6に示すフローチャートに沿って説明する。
Hereinafter, processing in the case where a kNN graph is constructed with 512 branches in the parallelized neighborhood
予めホストコンピュータ22のCPU24は、ベクトルDB25のベクトルをGPUデバイス26に転送し(ステップ201)、探索開始ノードを5点決定し(ステップ202)、外部から入力されたクエリのベクトルデータを取得し(ステップ203)、探索開始ノードを現ノードに設定する(ステップ204)。現ノードの枝512本が、例えば、図9のリストで示されていると、このリスト内で現ノードから距離が近い枝10本を選択する(ステップ205)。その結果図10に示すような表となる。
The
クエリが現ノードとその枝10本のノード群との距離を計算し(ステップ206)、計算結果よりクエリから最短距離のノードを選択し(ステップ207)、もし、クエリから最短距離のノードが現ノードと等しくないならば(ステップ208、No)、最短距離の枝ノードにホップして(ステップ209)、ホップ先のノードを現ノードとして探索を続ける(ステップ205〜208)。もし、クエリから最短距離のノードが現ノードと等しいならば(ステップ208、Yes)、クエリのベクトルデータ及び、現ノードから距離が遠い枝502本のノードに対応するベクトルのIDをGPUデバイス26に転送する(ステップ210,211)。
The query calculates the distance between the current node and the 10 nodes in the branch (step 206), selects the node with the shortest distance from the query based on the calculation result (step 207), and if the node with the shortest distance from the query is If it is not equal to the node (step 208, No), hop to the branch node with the shortest distance (step 209), and continue the search with the hop-destination node as the current node (steps 205-208). If the node with the shortest distance from the query is equal to the current node (step 208, Yes), the vector data of the query and the ID of the vector corresponding to the 502 nodes that are far from the current node are sent to the
GPUデバイス26は、枝502本のノードとベクトルの並列距離計算を行い(ステップ212)、計算結果をホストコンピュータ22に転送する(ステップ213)。
The
CPU24は、現ノードとGPUデバイス26で計算された枝ノード502個の計算結果より、クエリから最短距離のノードを選択し(ステップ214)、最短距離のノードのDBベクトルIDと、クエリとそのノードの最短距離値を出力する(ステップ215)。
The
探索開始ノードは5点なので、図11に示すように、最近傍ベクトル候補が5つ出てくるため、図11に示すリストの中からクエリのベクトルから最短距離のベクトルID:172818と距離値:0.061359を出力する。 Since there are five search start nodes, five nearest neighbor vector candidates appear as shown in FIG. 11. Therefore, the vector ID of the shortest distance from the query vector in the list shown in FIG. 0.061359 is output.
この結果、各クエリのベクトルに対して、ベクトルDB25内で距離が近似的に最近傍であるベクトルを求めることができる。
As a result, for each query vector, a vector whose distance is approximately the nearest in the
このように、SURFアルゴリズムから抽出される高次元ベクトル群に対して、本発明を適用することで、高精度かつ高速な近傍探索処理が可能になる。 As described above, by applying the present invention to the high-dimensional vector group extracted from the SURF algorithm, high-precision and high-speed neighborhood search processing can be performed.
この他にも、音声や文書、位置データなどから抽出されたベクトルの近傍探索にも本発明を適用することが可能である。 In addition to this, the present invention can also be applied to the neighborhood search of vectors extracted from speech, documents, position data, and the like.
[実施例2]
本実施例では、前述の第3の実施の形態における具体的な例を示す。
[Example 2]
In this example, a specific example in the third embodiment will be described.
並列化近傍探索処理装置31は、ホストコンピュータ32とメニーコア演算器36を有する。
The parallelization neighborhood
事前処理として、DB側に保存されている画像群に対して、局所領域を抽出するPCA-SIFTアルゴリズムにより、36次元のベクトル群が5,000,000ベクトル抽出され、ハードディスク側(ベクトルDB35)に保存されている。 As pre-processing, 5,000,000 vectors of 36-dimensional vector groups are extracted from the image groups stored on the DB side by the PCA-SIFT algorithm that extracts local regions, and stored on the hard disk side (vector DB 35). .
PCA-SIFTアルゴリズムにより抽出されるベクトルの具体例を以下に挙げる。
(1573,-1611,1546,-1450,-11,-322,-384,-385,-652,-459,0,377,-619,-969,-858,-591,1138,-535,-2471,-2174,2022,-257,-248,-1820,537,1224,-1272,279,512,-1340,1124,1955,95,-623,1181,-2839)
ベクトルDB35の各DBベクトルにおいて、探索用の近傍ベクトル数を8、距離計算用の近傍ベクトル数を1024として、kNNグラフを構築する。
Specific examples of vectors extracted by the PCA-SIFT algorithm are given below.
(1573, -1611,1546, -1450, -11, -322, -384, -385, -652, -459,0,377, -619, -969, -858, -591,1138, -535, -2471, -2174, 2022, -257, -248, -1820, 537, 1224, -1272, 279, 512, -1340, 1124, 1955, 95, -623, 1181, -2839)
In each DB vector of the
ユーザが認識したい画像を撮影し、撮影画像からSURFアルゴリズムにより36次元のベクトル群が500ベクトル抽出されたとして、各クエリのベクトルに対して以下の処理を行う。 An image that the user wants to recognize is photographed, and 500 vectors of 36-dimensional vectors are extracted from the photographed image by the SURF algorithm, and the following processing is performed on each query vector.
枝数1024本でkNNグラフが構築されている場合において、ホストコンピュータ32のCPU34は、探索開始ノードを10点決定し(ステップ301)、クエリのベクトルデータが入力されると(ステップ302)、クエリが各探索開始ノードから探索し(ステップ303)、現ノードの枝1024本が、例えば図12のリストで示されていると、このリスト中で、現ノードから距離が近い枝8本を選択する(ステップ304)。その例を図13に示す。
In the case where the kNN graph is constructed with 1024 branches, the
クエリが、現ノードとその枝8本のノード群と距離計算し(ステップ305)、計算結果より、クエリから最短距離のノードを選択し(ステップ306)、もし、クエリから最短距離のノードが現ノード以外ならば(ステップ307,No)、最短距離の枝ノードにホップし、ホップ先のノードを現ノードとして探索を続ける(ステップ304〜307)。クエリから最短距離のノードが現ノードの場合(ステップ307,Yes)、メニーコア演算器36において、現ノードから距離が遠い枝1016本のノード群に対応ベクトルとクエリのベクトルの並列距離計算を行い、ホストコンピュータ32に転送する(ステップ309)。
The query calculates the distance between the current node and the group of eight branches (step 305), and selects the node with the shortest distance from the query based on the calculation result (step 306). If it is not a node (
ホストコンピュータ32のCPU34は、現ノードとメニーコア演算器36で計算された1016個の枝ノードの距離計算結果より、クエリから最願距離のノードを選択し(ステップ310)、最短距離ノードのベクトルIDと最短距離ノードとクエリ間の距離値を出力する(ステップ311)。
The
探索開始ノードは10点なので、図14に示すように、最近傍ベクトル候補が10でてくるので、図14のリストの中から最短距離のベクトルID:27990と距離値:432507を出力する。 Since the search start node is 10 points, the nearest neighbor vector candidate is 10 as shown in FIG. 14. Therefore, the shortest distance vector ID: 27990 and the distance value: 432507 are output from the list of FIG.
この結果、各クエリベクトルに対して、ベクトルDB35内で距離が近似的に最近傍なベクトルを求めることができる。
As a result, for each query vector, a vector whose distance is approximately the nearest in the
このように、PCA-SIFTアルゴリズムから抽出される高次元ベクトル群に対して、本発明を適用することで、高精度かつ高速な近傍探索処理が可能となる。 Thus, by applying the present invention to a high-dimensional vector group extracted from the PCA-SIFT algorithm, high-precision and high-speed neighborhood search processing can be performed.
この他にも、音声や文書、位置データなどから抽出されたベクトルの近傍探索にも本発明を適用することが可能である。 In addition to this, the present invention can also be applied to the neighborhood search of vectors extracted from speech, documents, position data, and the like.
以下に、従来技術と本発明の差分を説明する。 The difference between the prior art and the present invention will be described below.
従来技術1のホストのみを利用したkNNグラフを用いた探索は、グラフ探索後、到達したノードのベクトルを出力する。しかし、図15に示すように、到達したノードが必ずしも最近傍ではない可能性もある。これに対し、本発明は、グラフ探索後、到達したノードのベクトルとその近傍のベクトル群の複数個と距離計算し、その中で最短距離のベクトルを最近傍ベクトルとして出力する。従来技術と比較すると、グラフ探索後に到達したノードとその周辺のノードともう一度距離計算して、到達したノード以外に最近傍がないかを再確認していることにより、従来技術より精度の向上が見込める。
The search using the kNN graph using only the host of
図16は、本発明により真の最近傍が探索可能となる例であり、到達ノードの周囲とグラフ探索時より広範囲に、もう一度距離計算することで従来技術では到達し得なかった真の最近傍が探索可能となる例を示している。例えば、枝数100(N=100)(Aの枝(点線)+Bの枝(細い実線))でkNNグラフを構築し、グラフ探索時は、枝数3(M=3)(Aの枝)で探索し、グラフ探索後に、枝数97(N−M)(Bの枝)で到達ノード近傍のノードと距離計算を行う。なお、計算コストの上昇はGPUデバイスによる並列化を行うことで抑制できる。 FIG. 16 is an example in which the true nearest neighbor can be searched according to the present invention, and the true nearest neighbor that could not be reached by the prior art by calculating the distance again around the reaching node and in a wider range than during the graph search. Shows an example in which search is possible. For example, a kNN graph is constructed with the number of branches 100 (N = 100) (the branch of A (dotted line) + the branch of B (thin solid line)), and when searching for a graph, the number of branches 3 (M = 3) (the branch of A) After the graph search, distance calculation is performed with nodes near the reaching node with the number of branches 97 (NM) (B branches). The increase in calculation cost can be suppressed by parallelization using GPU devices.
従来技術においてもN=100でグラフ探索しても、真の最近傍に到達可能であるが、グラフ探索時の距離計算回数が増加して探索速度が低下する。 Even in the prior art, even if the graph search is performed with N = 100, the true nearest neighbor can be reached, but the number of distance calculations during the graph search increases and the search speed decreases.
また、ホストとGPUデバイスを利用した従来技術2は、グラフを探索時に、ノードヲホップする度に、その距離計算をGPUデバイスで行うために、ホスト−GPUデバイス間の転送が多発し、探索速度が低下するが、本発明では、グラフ探索後にGPUデバイスによる並列距離計算を行うため、ホスト−GPUデバイス間の速度低下を抑えることができる。
Also, in the
上記の並列化近傍探索処理装置の図4、図6、図8に示す各構成要素の動作をプログラムとして構築し、並列化近傍探索装置として利用されるコンピュータにインストールして実行させる、または、ネットワークを介して流通させることが可能である。 The operation of each component shown in FIG. 4, FIG. 6, FIG. 8 of the above parallel neighborhood search processing device is constructed as a program and installed in a computer used as a parallel neighborhood search device for execution, or a network It is possible to circulate through.
なお、本発明は、上記の実施の形態に限定されることなく、特許請求の範囲内において、種々変更・応用が可能である。 The present invention is not limited to the above-described embodiment, and various modifications and applications can be made within the scope of the claims.
11,21,31 並列化近傍探索処理装置
12,22,32 ホストコンピュータ
13,23,33 メインメモリ
14,24,34 CPU
25 ベクトルDB
26 GPUデバイス
27 GPUグローバルメモリ
28 GPU
35 ベクトルDB
36 メニーコア演算器
11, 21, 31 Parallelized neighborhood
25 Vector DB
26
35 Vector DB
36 Many-core computing unit
Claims (7)
枝数N本の前記kNNグラフを構築し、グラフ探索開始ノードを現ノードとする事前処理手段と、
前記現ノードの枝N本のうち、該現ノードから距離が近いM本を選択して、該現ノードと該M本のノードとの距離を計算する距離計算手段と、
前記距離計算手段で得られた距離計算結果から、入力されたクエリから最短距離のノードを選択する最短距離ノード選択手段と、
選択された前記最短距離のノードが前記現ノードと等しくない場合は、該最短距離のノードにホップし、前記距離計算手段及び前記最短距離ノード選択手段を実行するグラフ探索手段と、
前記選択された前記最短距離のノードが等しい場合は、該現ノードから距離が遠いN−M個の枝ノードに対応するベクトルIDを選択し、該N−M個の枝ノードに対応するベクトル群と前記クエリのベクトルの並列距離計算を行い、該現ノード及び該N−M個の枝ノードと前記クエリ間の距離のN−M+1個の計算結果より、該クエリから最短距離のノードを選択する最近傍ベクトル抽出手段と、
を有することを特徴とする近傍探索処理装置。 A neighborhood search processing device that performs a neighborhood search of a vector group using a kNN (k-Nearest Neighbor) graph structure,
Pre-processing means for constructing the kNN graph of N branches and having the graph search start node as the current node;
A distance calculation means for selecting M branches near the current node from N branches of the current node and calculating a distance between the current node and the M nodes;
From the distance calculation result obtained by the distance calculation means, the shortest distance node selection means for selecting the shortest distance node from the input query,
If the selected shortest distance node is not equal to the current node, hop to the shortest distance node and execute the distance calculation means and the shortest distance node selection means;
If the selected nodes of the shortest distance are equal, a vector ID corresponding to NM branch nodes that are far from the current node is selected, and a vector group corresponding to the NM branch nodes is selected. And the parallel distance calculation of the vector of the query, and from the N−M + 1 calculation results of the distance between the current node and the N−M branch nodes and the query, the node with the shortest distance from the query is calculated. Nearest neighbor vector extraction means to select;
A neighborhood search processing device characterized by comprising:
GPUデバイスと、
前記ベクトル記憶手段の前記ベクトル群のデータを、前記GPUデバイスに転送する手段と、
を更に有し、
前記最近傍ベクトル抽出手段は、
選択した前記ベクトルIDを前記GPUデバイスに転送し、前記N−M個の枝ノードに対応するベクトル群と前記クエリのベクトルの並列距離計算結果を該GPUデバイスから取得する手段を含み、
前記GPUデバイスは、
前記ベクトルIDに基づいて前記ベクトル群のデータを参照して、該ベクトルIDに対応するベクトル群と前記クエリのベクトルの並列距離計算を行う並列距離計算手段を含む
請求項1記載の近傍探索処理装置。 Vector storage means for storing vector groups;
A GPU device,
Means for transferring the vector group data of the vector storage means to the GPU device;
Further comprising
The nearest neighbor vector extracting means includes:
Means for transferring the selected vector ID to the GPU device, and obtaining from the GPU device a parallel distance calculation result of a vector group corresponding to the NM branch nodes and a vector of the query;
The GPU device is
The neighborhood search processing apparatus according to claim 1, further comprising: a parallel distance calculation unit that refers to the data of the vector group based on the vector ID and calculates a parallel distance between the vector group corresponding to the vector ID and the vector of the query. .
前記最近傍ベクトル抽出手段は、
前記選択された前記最短距離のノードが等しい場合は、前記メニーコア演算器に対して
前記現ノードから距離が遠いN−M個の枝ノードに対応するベクトル群と前記クエリベクトルの並列距離計算を指示し、計算結果を取得する並列距離計算指示手段を含み、
前記メニーコア演算器は、
前記現ノードから距離が遠いN−M個の枝ノードに対応するベクトル群と前記クエリベクトルの並列距離計算を行う手段を含む
請求項1記載の近傍探索処理装置。 It further has a many-core computing unit,
The nearest neighbor vector extracting means includes:
If the selected shortest distance nodes are equal, the many-core computing unit is instructed to calculate a parallel distance between the vector group corresponding to N-M branch nodes far from the current node and the query vector. And a parallel distance calculation instruction means for obtaining the calculation result,
The many-core computing unit is:
2. The neighborhood search processing apparatus according to claim 1, further comprising means for calculating a parallel distance between a vector group corresponding to NM branch nodes far from the current node and the query vector.
事前処理手段、距離計算手段、最短距離ノード選択手段、グラフ探索手段、最近傍ベクトル抽出手段を有する装置において、
前記事前処理手段が、枝数N本の前記kNNグラフを構築し、グラフ探索開始ノードを現ノードとする事前処理ステップと、
前記距離計算手段が、前記現ノードの枝N本のうち、該現ノードから距離が近いM(N>M)本を選択して、該現ノードと該M本のノードとの距離を計算する距離計算ステップと、
前記最短距離ノード選択手段が、前記距離計算ステップで得られた距離計算結果から、入力されたクエリから最短距離のノードを選択する最短距離ノード選択ステップと、
前記グラフ探索手段が、前記最短距離ノード選択ステップで選択された前記最短距離のノードが前記現ノードと等しくない場合は、該最短距離のノードにホップし、前記距離計算ステップ及び前記最短距離ノード選択ステップを行うグラフ探索ステップと、
前記最近傍ベクトル抽出手段が、前記グラフ探索ステップで前記選択された前記最短距離のノードが等しい場合は、該現ノードから距離が遠いN−M個の枝ノードに対応するベクトルIDを選択し、該N−M個の枝ノードに対応するベクトル群と前記クエリのベクトルの並列距離計算を行い、該現ノード及び該N−M個の枝ノードと前記クエリ間の距離のN−M+1個の計算結果より、該クエリから最短距離のノードを選択する最近傍ベクトル抽出ステップと、
を行うことを特徴とする近傍探索処理方法。 A neighborhood search processing method that performs neighborhood search of a vector group using a kNN (k-Nearest Neighbor) graph structure,
In an apparatus having pre-processing means, distance calculation means, shortest distance node selection means, graph search means, and nearest neighbor vector extraction means,
The preprocessing means constructs the kNN graph of N branches and a preprocessing step in which the graph search start node is a current node;
The distance calculating means selects M (N> M) of the N branches of the current node that are close to the current node, and calculates the distance between the current node and the M nodes. A distance calculation step;
The shortest distance node selection means, from the distance calculation result obtained in the distance calculation step, the shortest distance node selection step of selecting the node of the shortest distance from the input query;
If the shortest distance node selected in the shortest distance node selection step is not equal to the current node, the graph search means hops to the shortest distance node, and the distance calculation step and the shortest distance node selection A graph search step for performing steps;
The nearest neighbor vector extracting means, when the nodes of the shortest distance selected in the graph search step are equal, select vector IDs corresponding to N−M branch nodes far from the current node; A parallel distance calculation of the vector group corresponding to the NM branch nodes and the vector of the query is performed, and NM + 1 distances between the current node and the NM branch nodes and the query are calculated. From the calculation result of, the nearest neighbor vector extraction step of selecting the node with the shortest distance from the query,
The neighborhood search processing method characterized by performing.
GPUデバイスと、
を更に有する装置において、
前記ベクトル記憶手段のベクトル群のデータを前記GPUデバイスに転送するステップを更に行い、
前記最近傍ベクトル抽出ステップにおいて、
選択した前記ベクトルIDを前記GPUデバイスに転送し、
前記GPUデバイスにおいて、
前記ベクトルIDに基づいて前記ベクトル群のデータを参照して、該ベクトルIDに対応するベクトル群と前記クエリのベクトルの並列距離計算を行う
請求項4記載の近傍探索処理方法。 Vector storage means for storing vector groups;
A GPU device,
Further comprising:
Further transferring the vector group data of the vector storage means to the GPU device;
In the nearest neighbor vector extraction step,
Transfer the selected vector ID to the GPU device,
In the GPU device,
5. The neighborhood search processing method according to claim 4, wherein parallel distance calculation between the vector group corresponding to the vector ID and the vector of the query is performed by referring to the data of the vector group based on the vector ID.
前記最近傍ベクトル抽出ステップにおいて、
前記選択された前記最短距離のノードが等しい場合は、前記メニーコア演算器が、前記現ノードから距離が遠いN−M個の枝ノードに対応するベクトル群と前記クエリベクトルの並列距離計算を行う
請求項4記載の近傍探索処理方法。 In an apparatus further comprising a many-core computing unit,
In the nearest neighbor vector extraction step,
When the selected shortest distance nodes are equal, the many-core computing unit performs parallel distance calculation of a vector group corresponding to N-M branch nodes far from the current node and the query vector. Item 5. The neighborhood search processing method according to item 4.
請求項1乃至3のいずれか1項に記載の近傍探索処理装置の各手段として機能させるための近傍探索処理プログラム。 Computer
The neighborhood search processing program for functioning as each means of the neighborhood search processing apparatus of any one of Claims 1 thru | or 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012220719A JP2014074959A (en) | 2012-10-02 | 2012-10-02 | Adjacent search processing device, method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012220719A JP2014074959A (en) | 2012-10-02 | 2012-10-02 | Adjacent search processing device, method and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2014074959A true JP2014074959A (en) | 2014-04-24 |
Family
ID=50749090
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012220719A Pending JP2014074959A (en) | 2012-10-02 | 2012-10-02 | Adjacent search processing device, method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2014074959A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104866286A (en) * | 2015-06-02 | 2015-08-26 | 电子科技大学 | OpenCL and SoC-FPGA-Based K neighbor sorting accelerating method |
JP2023013863A (en) * | 2021-07-16 | 2023-01-26 | ヤフー株式会社 | Information processing device, information processing method, and information processing program |
-
2012
- 2012-10-02 JP JP2012220719A patent/JP2014074959A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104866286A (en) * | 2015-06-02 | 2015-08-26 | 电子科技大学 | OpenCL and SoC-FPGA-Based K neighbor sorting accelerating method |
JP2023013863A (en) * | 2021-07-16 | 2023-01-26 | ヤフー株式会社 | Information processing device, information processing method, and information processing program |
JP7353330B2 (en) | 2021-07-16 | 2023-09-29 | ヤフー株式会社 | Information processing device, information processing method, and information processing program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5183392B2 (en) | Image processing apparatus, image processing method, and program | |
US8706711B2 (en) | Descriptor storage and searches of k-dimensional trees | |
US11599578B2 (en) | Building a graph index and searching a corresponding dataset | |
WO2019216346A1 (en) | Graph update device, graph update method, and program | |
US9817845B2 (en) | Three-dimensional image file searching method and three-dimensional image file searching system | |
EP3012803A1 (en) | Image processing method, image processing device, and image processing program | |
JP2010040032A5 (en) | ||
US20150308851A1 (en) | Route extraction method, and route graph generation method | |
JP6434162B2 (en) | Data management system, data management method and program | |
JP6311000B1 (en) | Generating device, generating method, and generating program | |
JP6705764B2 (en) | Generation device, generation method, and generation program | |
JP2014074959A (en) | Adjacent search processing device, method and program | |
JP2020086662A (en) | Information processing apparatus, information processing method, and information processing program | |
JP2013242675A (en) | Dispersion information control device, dispersion information search method, data dispersion arrangement method and program | |
JP6293335B1 (en) | Generating device, generating method, and generating program | |
KR102074734B1 (en) | Method and apparatus for pattern discoverty in sequence data | |
JP2019144780A (en) | Generating device, generating method, and generating program | |
JP6012814B1 (en) | Sequential clustering apparatus, method, and program | |
JP7121706B2 (en) | Information processing device, information processing method, and information processing program | |
JP2019125124A (en) | Extraction device, extraction method and extraction program | |
JP6005583B2 (en) | SEARCH DEVICE, SEARCH METHOD, AND SEARCH PROGRAM | |
JP6498266B2 (en) | Generating device, generating method, and generating program | |
JP5537644B1 (en) | Vocabulary search device, vocabulary search method, and vocabulary search program | |
JP5856888B2 (en) | Corresponding point search method, corresponding point search device, and corresponding point search program | |
Wang et al. | Processing multiple-user location-based keyword queries |