Template Class InvertedMultiProductQuantizationIndex

Class Documentation

template<typename DataType, int kNumComponents, int kNumDimPerComp, int kNumCenters>
class loop_closure::inverted_multi_index::InvertedMultiProductQuantizationIndex

Public Types

typedef Eigen::Matrix<float, kOriginalDescDim, 1> InputDescriptorType
typedef Eigen::Matrix<float, kOriginalDescDim, Eigen::Dynamic> InputDescriptorMatrixType
typedef Eigen::Matrix<float, kOriginalDescDim / 2, 1> HalfInputDescriptorType
typedef Eigen::Matrix<DataType, kNumComponents, 1> StoredDescriptorType
typedef common::InvertedFile<DataType, kNumComponents> InvFile
typedef product_quantization::ProductQuantization<kHalfNumComponents, kNumDimPerComp, kNumCenters, DataType> ProductQuantizer

Public Functions

inline InvertedMultiProductQuantizationIndex(const Eigen::MatrixXf &words_1, const Eigen::MatrixXf &words_2, const Eigen::MatrixXf &quantizer_centers_1, const Eigen::MatrixXf &quantizer_centers_2, int num_closest_words_for_nn_search)
inline void SetNumClosestWordsForNNSearch(int num_closest_words_for_nn_search)
inline int GetNumDescriptorsInIndex() const
inline void Clear()
inline void AddDescriptors(const InputDescriptorMatrixType &descriptors)
template<typename DerivedQuery, typename DerivedIndices, typename DerivedDistances>
inline void GetNNearestNeighbors(const Eigen::MatrixBase<DerivedQuery> &query_feature, int num_neighbors, const Eigen::MatrixBase<DerivedIndices> &out_indices, const Eigen::MatrixBase<DerivedDistances> &out_distances) const

Public Static Attributes

static constexpr int kOriginalDescDim = kNumDimPerComp * kNumComponents
static constexpr int kHalfNumComponents = kNumComponents / 2

Protected Functions

inline void ComputeResidual(const HalfInputDescriptorType &descriptor_half, const Eigen::MatrixXf &words, int word, HalfInputDescriptorType *residual) const

Protected Attributes

Eigen::MatrixXf words_1_
Eigen::MatrixXf words_2_
std::shared_ptr<common::NNSearch> words_1_index_
std::shared_ptr<common::NNSearch> words_2_index_
Aligned<std::vector, ProductQuantizer> quantizers_words_1_
Aligned<std::vector, ProductQuantizer> quantizers_words_2_
int num_closest_words_for_nn_search_
std::unordered_map<int, int> word_index_map_
Aligned<std::vector, InvFile> inverted_files_
int max_db_descriptor_index_