vocabtree  0.0.1
SearchBase Class Referenceabstract

Abstract class from which all search structures and methods derive from. More...

#include <search_base.hpp>

Inheritance diagram for SearchBase:

Public Member Functions

 SearchBase ()
 
 SearchBase (const std::string &file_path)
 
virtual ~SearchBase ()
 
virtual bool train (Dataset &dataset, const std::shared_ptr< const TrainParamsBase > &params, const std::vector< std::shared_ptr< const Image > > &examples)=0
 Given a set of training parameters, list of images, trains. More...
 
std::vector< std::shared_ptr
< MatchResultsBase > > 
search (Dataset &dataset, const std::shared_ptr< SearchParamsBase > &params, 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...
 
virtual bool load (const std::string &file_path)=0
 Loads a trained search structure from the input filepath. More...
 
virtual bool save (const std::string &file_path) const =0
 Saves a trained search structure to the input filepath. More...
 

Protected Member Functions

virtual std::shared_ptr
< MatchResultsBase
search (Dataset &dataset, const std::shared_ptr< const SearchParamsBase > &params, const std::shared_ptr< const Image > &example)=0
 Given a set of search parameters, a query images, searches for matching images and returns the match. More...
 

Detailed Description

Abstract class from which all search structures and methods derive from.

Each search method must implement train, search, load and save.

Definition at line 29 of file search_base.hpp.

Constructor & Destructor Documentation

SearchBase::SearchBase ( )

Definition at line 3 of file search_base.cxx.

3 { }
SearchBase::SearchBase ( const std::string &  file_path)

Definition at line 4 of file search_base.cxx.

4 { }
SearchBase::~SearchBase ( )
virtual

Definition at line 6 of file search_base.cxx.

6 { }

Member Function Documentation

virtual bool SearchBase::load ( const std::string &  file_path)
pure virtual

Loads a trained search structure from the input filepath.

Implemented in BagOfWords, InvertedIndex, and VocabTree.

virtual bool SearchBase::save ( const std::string &  file_path) const
pure virtual

Saves a trained search structure to the input filepath.

Implemented in BagOfWords, InvertedIndex, and VocabTree.

std::vector< std::shared_ptr< MatchResultsBase > > SearchBase::search ( Dataset dataset,
const std::shared_ptr< SearchParamsBase > &  params,
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.

Definition at line 8 of file search_base.cxx.

9  {
10  std::vector< std::shared_ptr<MatchResultsBase> > all_matches;
11  for(size_t i=0; i<examples.size(); i++) {
12  all_matches.push_back(search(dataset, params, examples[i]));
13  }
14  return all_matches;
15 }
virtual std::shared_ptr<MatchResultsBase> SearchBase::search ( Dataset dataset,
const std::shared_ptr< const SearchParamsBase > &  params,
const std::shared_ptr< const Image > &  example 
)
protectedpure virtual

Given a set of search parameters, a query images, searches for matching images and returns the match.

Implemented in InvertedIndex, BagOfWords, and VocabTree.

virtual bool SearchBase::train ( Dataset dataset,
const std::shared_ptr< const TrainParamsBase > &  params,
const std::vector< std::shared_ptr< const Image > > &  examples 
)
pure virtual

Given a set of training parameters, list of images, trains.

Returns true if successful, false if not successful.

Implemented in BagOfWords, InvertedIndex, and VocabTree.


The documentation for this class was generated from the following files: