|
vocabtree
0.0.1
|
Implements a Bag of Words based (BoW) image search using an inverted index. More...
#include <inverted_index.hpp>


Data Structures | |
| struct | MatchResults |
| Subclass of match results base which also returns scores. More... | |
| struct | SearchParams |
| Subclass of train params base which specifies inverted index training parameters. More... | |
| struct | TrainParams |
| Subclass of train params base which specifies inverted index training parameters. More... | |
Public Member Functions | |
| InvertedIndex () | |
| InvertedIndex (const std::string &file_name) | |
| bool | train (Dataset &dataset, const std::shared_ptr< const TrainParamsBase > ¶ms, const std::vector< std::shared_ptr< const Image > > &examples) |
| Given a set of training parameters, list of images, trains. More... | |
| bool | load (const std::string &file_path) |
| Loads a trained search structure from the input filepath. More... | |
| bool | save (const std::string &file_path) const |
| Saves a trained search structure to the input filepath. More... | |
| uint32_t | num_clusters () const |
| Returns the number of clusters used in the inverted index descriptors. More... | |
| std::shared_ptr< MatchResultsBase > | search (Dataset &dataset, const std::shared_ptr< const SearchParamsBase > ¶ms, const std::shared_ptr< const Image > &example) |
| Given a set of search parameters, a query image, searches for matching images and returns the match. More... | |
Public Member Functions inherited from SearchBase | |
| SearchBase () | |
| SearchBase (const std::string &file_path) | |
| virtual | ~SearchBase () |
| std::vector< std::shared_ptr < MatchResultsBase > > | search (Dataset &dataset, const std::shared_ptr< SearchParamsBase > ¶ms, const std::vector< std::shared_ptr< const Image > > &examples) |
| Given a set of search parameters, list of query images, searches for matching images and returns the result matches. More... | |
Protected Attributes | |
| std::vector< std::vector < uint64_t > > | inverted_index |
| std::vector< float > | idf_weights |
| Stores the inverted index, dimension one is the cluster index, dimension two holds a list of ids containing that word. More... | |
Implements a Bag of Words based (BoW) image search using an inverted index.
The inverted index keeps track of a list of images associated with each visual word. The images are represented as an unsigned long long which must then be translated back to an actual image using the appropriate Dataset class implementation.
Definition at line 10 of file inverted_index.hpp.
| InvertedIndex::InvertedIndex | ( | ) |
Definition at line 11 of file inverted_index.cxx.
| InvertedIndex::InvertedIndex | ( | const std::string & | file_name | ) |
|
virtual |
Loads a trained search structure from the input filepath.
Implements SearchBase.
Definition at line 25 of file inverted_index.cxx.
References idf_weights, inverted_index, and num_clusters().
Referenced by InvertedIndex().
| uint32_t InvertedIndex::num_clusters | ( | ) | const |
Returns the number of clusters used in the inverted index descriptors.
Definition at line 158 of file inverted_index.cxx.
References idf_weights.
|
virtual |
Saves a trained search structure to the input filepath.
Implements SearchBase.
Definition at line 47 of file inverted_index.cxx.
References idf_weights, inverted_index, and num_clusters().
|
virtual |
Given a set of search parameters, a query image, searches for matching images and returns the match.
If the match is nullptr, then the search failed (it will fail if the example image has missing features).
Implements SearchBase.
Definition at line 99 of file inverted_index.cxx.
References filesystem::file_exists(), idf_weights, Dataset::image(), inverted_index, filesystem::load_sparse_vector(), Dataset::location(), numerics::min_hist(), and Dataset::num_images().
|
virtual |
Given a set of training parameters, list of images, trains.
Returns true if successful, false if not successful.
Implements SearchBase.
Definition at line 66 of file inverted_index.cxx.
References InvertedIndex::TrainParams::bag_of_words, filesystem::file_exists(), idf_weights, inverted_index, filesystem::load_sparse_vector(), and Dataset::location().
Referenced by main(), and train_index().
|
protected |
Stores the inverted index, dimension one is the cluster index, dimension two holds a list of ids containing that word.
Definition at line 52 of file inverted_index.hpp.
Referenced by load(), num_clusters(), save(), search(), and train().
|
protected |