Template Class InvertedIndex

Class Documentation

template<int kDimVectors>
class loop_closure::inverted_index::InvertedIndex

Public Types

typedef Eigen::Matrix<float, kDimVectors, 1> DescriptorType
typedef Eigen::Matrix<float, kDimVectors, Eigen::Dynamic> DescriptorMatrixType
typedef Nabo::NearestNeighbourSearch<float> NNSearch

Public Functions

inline InvertedIndex(const Eigen::MatrixXf &words, 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 DescriptorMatrixType &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 kCollectTouchStatistics = 0
static constexpr unsigned kSearchOptionsDefault = NNSearch::ALLOW_SELF_MATCH | NNSearch::SORT_RESULTS
static constexpr float kSearchNNEpsilon = 0.2
static constexpr int kSearchNNNumNeighborsMultiplier = 2

Protected Types

typedef Aligned<std::vector, DescriptorType> DescriptorBucket

Protected Functions

template<typename DerivedQuery>
inline void FindClosestWords(const Eigen::MatrixBase<DerivedQuery> &query_feature, int num_words, std::vector<int> *closest_words) const

Protected Attributes

Eigen::MatrixXf words_
std::shared_ptr<NNSearch> words_index_
int num_closest_words_for_nn_search_
std::unordered_map<int, int> word_index_map_
Aligned<std::vector, DescriptorBucket> db_descriptors_
std::vector<std::vector<int>> db_descriptor_indices_
int max_db_descriptor_index_

Protected Static Functions

static inline void InsertNeighbor(int index, float distance, int num_neighbors, std::vector<std::pair<float, int>> *const nearest_neighbors)