Definition at line 1414 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::Database::MakeRawDataSet(), Impala::MakeString(), Impala::QuidClass(), and Impala::Core::Table::Select(). Referenced by mainUtil(). 01415 { 01416 typedef Core::Database::RawDataSet RawDataSet; 01417 typedef Core::Table::SimilarityTableSet SimilarityTableSet; 01418 typedef Core::Table::SimilarityTableSet::RankTableType RankTableType; 01419 typedef Core::Table::AnnotationTable AnnotationTable; 01420 using Impala::Core::Table::AveragePrecision; 01421 01422 ILOG_VAR(Impala.Application.Util.DoScoreConceptVideo); 01423 CmdOptions& options = CmdOptions::GetInstance(); 01424 if (options.GetNrArg() < 5) 01425 { 01426 ILOG_ERROR("Need more parameters"); 01427 return; 01428 } 01429 String dataSetName = options.GetArg(1); 01430 String conceptSet = options.GetArg(2); 01431 String model = options.GetArg(3); 01432 String feature = options.GetArg(4); 01433 int vidStart = atol(options.GetArg(5)); 01434 int vidEnd = atol(options.GetArg(6)); 01435 01436 RawDataSet* dataSet = Core::Database::MakeRawDataSet(dataSetName); 01437 SimilarityTableSetLocator simLoc(dataSet->GetLocator(), true, "", 01438 conceptSet, model, feature, ""); 01439 SimilarityTableSet* simSet = SimilarityTableSetRepository().Get(simLoc); 01440 01441 Core::Table::QuidTable* qTable = simSet->GetQuidTable(); 01442 int qClass = QuidClass(qTable->Get1(0)); 01443 Real64 mapJ = 0; 01444 int nrMap = 0; 01445 std::cout << simLoc << ", size = " << simSet->TableSize() << std::endl; 01446 std::vector<int> videos; 01447 std::cout << "videos: "; 01448 for (int i=vidStart ; i<vidEnd ; i++) 01449 { 01450 videos.push_back(i); 01451 std::cout << i << " "; 01452 } 01453 std::cout << std::endl; 01454 for (int c=0 ; c<simSet->NrTables() ; c++) 01455 { 01456 String concept = simSet->GetName(c); 01457 AnnotationTableLocator annoLoc(dataSet->GetLocator(), qClass, 01458 conceptSet, concept); 01459 if (!AnnotationTableRepository().Exists(annoLoc)) 01460 { 01461 ILOG_ERROR("No groundtruth for " << concept); 01462 continue; 01463 } 01464 AnnotationTable* truth = AnnotationTableRepository().Get(annoLoc); 01465 truth->UpdateQuidMap(); 01466 RankTableType* rank = simSet->GetRankTable(c); 01467 if (videos.size() > 0) 01468 { 01469 Core::Table::CriterionQuidObjectInSet<RankTableType> crit(videos); 01470 Core::Table::Select(rank, rank, crit, true); 01471 } 01472 Real64 apJ = AveragePrecisionJudged(rank, truth, false, -1, true); 01473 mapJ += apJ; 01474 std::cout << MakeString(concept, 25) << " " << apJ << std::endl; 01475 nrMap++; 01476 delete truth; 01477 } 01478 std::cout << "mapJudged=" << mapJ/nrMap << std::endl; 01479 std::cout << std::endl; 01480 delete simSet; 01481 delete dataSet; 01482 }
Here is the call graph for this function: ![]()
|