Oxford building dataset数据集计算正确相关图像ground truth的C++代码

#include 
#include 
#include 
#include 
#include 

using namespace std;

vector
load_list(const string& fname)
{
  vector ret;
  ifstream fobj(fname.c_str());
  if (!fobj.good()) { cerr << "File " << fname << " not found!\n"; exit(-1); }
  string line;
  while (getline(fobj, line)) {
    ret.push_back(line);
  }
  return ret;
}

template
set vector_to_set(const vector& vec)
{ return set(vec.begin(), vec.end()); }

float
compute_ap(const set& pos, const set& amb, const vector& ranked_list)
{
  float old_recall = 0.0;
  float old_precision = 1.0;
  float ap = 0.0;
  
  size_t intersect_size = 0;
  size_t i = 0;
  size_t j = 0;
  for ( ; i ranked_list = load_list(argv[2]);
  set good_set = vector_to_set( load_list(gtq + "_good.txt") );
  set ok_set = vector_to_set( load_list(gtq + "_ok.txt") );
  set junk_set = vector_to_set( load_list(gtq + "_junk.txt") );

  set pos_set;
  pos_set.insert(good_set.begin(), good_set.end());
  pos_set.insert(ok_set.begin(), ok_set.end());

  float ap = compute_ap(pos_set, junk_set, ranked_list);
  
  cout << ap << "\n";

  return 0;
}





from: http://www.robots.ox.ac.uk/~vgg/data/oxbuildings/compute_ap.cpp

http://www.robots.ox.ac.uk/~vgg/data/oxbuildings/

你可能感兴趣的:(计算机视觉CV)