vocabtree  0.0.1
bench_index.cxx File Reference
#include "bench_config.hpp"
#include <utils/filesystem.hpp>
#include <utils/numerics.hpp>
#include <utils/dataset.hpp>
#include <utils/vision.hpp>
#include <utils/logger.hpp>
#include <search/bag_of_words/bag_of_words.hpp>
#include <search/inverted_index/inverted_index.hpp>
#include <iostream>
Include dependency graph for bench_index.cxx:

Go to the source code of this file.

Functions

_INITIALIZE_EASYLOGGINGPP int main (int argc, char *argv[])
 

Function Documentation

_INITIALIZE_EASYLOGGINGPP int main ( int  argc,
char *  argv[] 
)

Definition at line 22 of file bench_index.cxx.

References filesystem::create_file_directory(), Dataset::location(), s_oxford_data_dir, s_oxford_database_location, s_oxford_num_clusters, and InvertedIndex::train().

22  {
23 #if ENABLE_MULTITHREADING && ENABLE_MPI
24  MPI::Init(argc, argv);
25 #endif
26  const uint32_t num_clusters = s_oxford_num_clusters;
27 
29  LINFO << oxford_dataset;
30 
31  std::stringstream vocab_output_file;
32  vocab_output_file << oxford_dataset.location() << "/vocabulary/" << num_clusters << ".vocab";
33 
34  std::shared_ptr<BagOfWords> bow = std::make_shared<BagOfWords>(vocab_output_file.str());
35 
36  InvertedIndex ii;
37  std::shared_ptr<InvertedIndex::TrainParams> train_params = std::make_shared<InvertedIndex::TrainParams>();
38  train_params->bag_of_words = bow;
39  ii.train(oxford_dataset, train_params, oxford_dataset.all_images());
40 
41  std::stringstream index_output_file;
42  index_output_file << oxford_dataset.location() << "/index/" << num_clusters << ".index";
43  filesystem::create_file_directory(index_output_file.str());
44  ii.save(index_output_file.str());
45 
46 #if ENABLE_MULTITHREADING && ENABLE_MPI
47  MPI::Finalize();
48 #endif
49  return 0;
50 }