Definition at line 1052 of file mainUtil.cpp. References Impala::atol(), Impala::Core::Table::AveragePrecision(), Impala::Core::Table::AveragePrecisionJudged(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetNrArg(), ILOG_ERROR, ILOG_VAR, Impala::Core::Table::SimilarityTableSet::MakeFromFile(), Impala::Core::Database::MakeRawDataSet(), Impala::MakeString(), Impala::QuidClass(), and Impala::Core::Table::Select(). Referenced by mainUtil(). 01053 { 01054 #ifndef REPOSITORY_TODO 01055 typedef Core::Database::RawDataSet RawDataSet; 01056 typedef Core::Table::SimilarityTableSet SimilarityTableSet; 01057 typedef Core::Table::SimilarityTableSet::RankTableType RankTableType; 01058 typedef Core::Table::AnnotationTable AnnotationTable; 01059 using Impala::Core::Table::AveragePrecision; 01060 01061 ILOG_VAR(Impala.Application.Util.DoScoreConceptVideo); 01062 CmdOptions& options = CmdOptions::GetInstance(); 01063 if (options.GetNrArg() < 5) 01064 { 01065 ILOG_ERROR("Need more parameters"); 01066 return; 01067 } 01068 String dataSetName = options.GetArg(1); 01069 String annoSet = options.GetArg(2); 01070 String namesPath = options.GetArg(3); 01071 int vidStart = atol(options.GetArg(4)); 01072 int vidEnd = atol(options.GetArg(5)); 01073 01074 RawDataSet* dataSet = Core::Database::MakeRawDataSet(dataSetName); 01075 Impala::Util::Database* db = dataSet->GetDatabase(); 01076 SimilarityTableSet* simSet = 01077 Core::Table::SimilarityTableSet::MakeFromFile(namesPath, db); 01078 01079 Core::Table::QuidTable* qTable = simSet->GetQuidTable(); 01080 int qClass = QuidClass(qTable->Get1(0)); 01081 Real64 mapJ = 0; 01082 int nrMap = 0; 01083 std::cout << namesPath << ", size = " << simSet->TableSize() << std::endl; 01084 std::vector<int> videos; 01085 std::cout << "videos: "; 01086 for (int i=vidStart ; i<vidEnd ; i++) 01087 { 01088 videos.push_back(i); 01089 std::cout << i << " "; 01090 } 01091 std::cout << std::endl; 01092 for (int c=0 ; c<simSet->NrTables() ; c++) 01093 { 01094 String concept = simSet->GetName(c); 01095 String fName = dataSet->GetFilePathAnnotation(qClass, annoSet, 01096 concept + ".tab", 01097 false, false); 01098 if (fName.empty()) 01099 { 01100 ILOG_ERROR("No groundtruth for " << concept); 01101 continue; 01102 } 01103 AnnotationTable* truth = AnnotationTable::MakeFromFile(concept, fName, 01104 db); 01105 truth->UpdateQuidMap(); 01106 RankTableType* rank = simSet->GetRankTable(c); 01107 if (videos.size() > 0) 01108 { 01109 Core::Table::CriterionQuidObjectInSet<RankTableType> crit(videos); 01110 Core::Table::Select(rank, rank, crit, true); 01111 } 01112 Real64 apJ = AveragePrecisionJudged(rank, truth, false, -1, true); 01113 mapJ += apJ; 01114 std::cout << MakeString(concept, 25) << " " << apJ << std::endl; 01115 nrMap++; 01116 delete truth; 01117 } 01118 std::cout << "mapJudged=" << mapJ/nrMap << std::endl; 01119 std::cout << std::endl; 01120 delete simSet; 01121 delete dataSet; 01122 #endif 01123 }
Here is the call graph for this function:
|