Definition at line 610 of file mainUtil.cpp. References Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetInstance(), Impala::Core::Database::RawDataSet::GetLocator(), Impala::CmdOptions::GetNrArg(), ILOG_DEBUG, ILOG_ERROR, ILOG_INFO, ILOG_NDC_POP, ILOG_NDC_PUSH, ILOG_VAR, ILOG_WARN, Impala::Core::VideoSet::MakeVideoSet(), Impala::QUID_CLASS_FRAME, Impala::StringHead(), and Impala::StringTail(). Referenced by mainUtil(). 00611 { 00612 typedef Core::VideoSet::VideoSet VideoSet; 00613 typedef Core::VideoSet::Keyframes Keyframes; 00614 typedef Core::Table::AnnotationTableSet AnnotationTableSet; 00615 typedef Core::Table::AnnotationTable AnnotationTable; 00616 00617 ILOG_VAR(Impala.Application.Util.DoImportAnnoTruth); 00618 CmdOptions& options = CmdOptions::GetInstance(); 00619 if (options.GetNrArg() < 4) 00620 { 00621 ILOG_ERROR("Need more parameters"); 00622 return; 00623 } 00624 String videoSetName = options.GetArg(1); 00625 String conceptSet = options.GetArg(2); 00626 String maskSet = options.GetArg(3); 00627 00628 VideoSet* vidSet = Core::VideoSet::MakeVideoSet(videoSetName); 00629 KeyframesLocator kLoc(vidSet->GetLocator(), "keyframes"); 00630 Keyframes* keyframes = KeyframesRepository().Get(kLoc, vidSet); 00631 Persistency::KeywordListLocator loc(vidSet->GetLocator(), conceptSet); 00632 Core::Table::KeywordList concepts = 00633 *(Persistency::KeywordListRepository().Get(loc)); 00634 00635 typedef Persistency::RepositoryInFileSystem FS; 00636 Persistency::FileLocator mLoc(vidSet->GetLocator(), maskSet); 00637 Persistency::File mFile = FS::GetInstance().GetFile(mLoc, false, false); 00638 std::vector<String> mask; 00639 mFile.ReadStrings(mask); 00640 if (mask.size() == 0) 00641 ILOG_WARN("mask is empty"); 00642 00643 AnnotationTableSet tSet; 00644 for (int c=0 ; c<concepts.size() ; c++) 00645 { 00646 ILOG_INFO("doing concept " << concepts[c]); 00647 ILOG_NDC_PUSH(concepts[c]); 00648 AnnotationTable* tab = new AnnotationTable(concepts[c], 0); 00649 tSet.Add(tab); 00650 00651 String fName = "Annotations/groundtruth/" + conceptSet + "/" + 00652 concepts[c] + ".truth"; 00653 Persistency::FileLocator fLoc(vidSet->GetLocator(), fName); 00654 Persistency::File file = FS::GetInstance().GetFile(fLoc, false, true); 00655 if (!file.Valid()) 00656 { 00657 ILOG_INFO("No truth file for " << concepts[c]); 00658 ILOG_NDC_POP; 00659 continue; 00660 } 00661 00662 std::vector<String> annos; 00663 file.ReadStrings(annos); 00664 for (int i=0 ; i<annos.size() ; i++) 00665 { 00666 if (find(mask.begin(), mask.end(), annos[i]) == mask.end()) 00667 { 00668 ILOG_DEBUG("not in mask, skipping"); 00669 continue; 00670 } 00671 00672 int keyId = keyframes->GetFrameId(annos[i] + ".jpg"); 00673 if (keyId == -1) 00674 { 00675 // In trec2005 some NRKF seem to refer to the same frame as RKF 00676 String h1 = StringHead(annos[i], '_', true); 00677 String t = StringTail(annos[i], '_', false); 00678 String h2 = StringHead(t, '_', true); 00679 String rkf = h1 + h2 + "RKF"; 00680 keyId = keyframes->GetFrameId(rkf + ".jpg"); 00681 } 00682 if (keyId == -1) 00683 { 00684 ILOG_ERROR("Don't know " << annos[i]); 00685 } 00686 else 00687 { 00688 Quid q = keyframes->GetQuidFrame(keyId); 00689 tab->AddPositive(q); 00690 } 00691 } 00692 ILOG_NDC_POP; 00693 } 00694 00695 AnnotationTableSetLocator aLoc(vidSet->GetLocator(), QUID_CLASS_FRAME, 00696 conceptSet); 00697 AnnotationTableSetRepository().Add(aLoc, &tSet); 00698 delete keyframes; 00699 delete vidSet; 00700 }
Here is the call graph for this function: ![]()
|