mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #26382 from kaingwade:annoy_build_parallel
Build Annoy index in parallel #26382 #26287 raised the C++ standard, and Annoy's multi-threaded index building can be enabled now.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#define ANNOYLIB_MULTITHREADED_BUILD
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "../3rdparty/annoy/annoylib.h"
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
@@ -48,7 +50,7 @@ class ANNIndexImpl : public ANNIndex
|
||||
public:
|
||||
ANNIndexImpl(int dimension) : dim(dimension)
|
||||
{
|
||||
index = makePtr<::cvannoy::AnnoyIndex<int, DataType, DistanceType, Random, ::cvannoy::AnnoyIndexSingleThreadedBuildPolicy>>(dimension);
|
||||
index = makePtr<::cvannoy::AnnoyIndex<int, DataType, DistanceType, Random, ::cvannoy::AnnoyIndexMultiThreadedBuildPolicy>>(dimension);
|
||||
}
|
||||
|
||||
void addItems(InputArray _dataset) CV_OVERRIDE
|
||||
@@ -234,7 +236,7 @@ public:
|
||||
|
||||
private:
|
||||
int dim;
|
||||
Ptr<::cvannoy::AnnoyIndex<int, DataType, DistanceType, Random, ::cvannoy::AnnoyIndexSingleThreadedBuildPolicy>> index;
|
||||
Ptr<::cvannoy::AnnoyIndex<int, DataType, DistanceType, Random, ::cvannoy::AnnoyIndexMultiThreadedBuildPolicy>> index;
|
||||
};
|
||||
|
||||
Ptr<ANNIndex> ANNIndex::create(int dim, ANNIndex::Distance distType)
|
||||
|
||||
Reference in New Issue
Block a user