called from VideoSet:Listener::HandleNewFile or ImageSet::Listener::HandleNewFolder
Definition at line 86 of file ApplyConcepts.h. References Impala::Core::Table::Copy(), Impala::Core::Table::SimilarityTableSet::Exists(), Impala::Core::Feature::ConceptSet::GetConcept(), Impala::CmdOptions::GetInstance(), Impala::Core::Training::ApplyConceptsHelper::GetModelName(), Impala::Core::Feature::Concept::GetModelName(), Impala::Core::Feature::ConceptSet::GetNames(), Impala::Core::Feature::ConceptSet::GetNrConcepts(), ILOG_DEBUG, ILOG_ERROR, ILOG_INFO, Impala::Core::Training::ApplyConceptsHelper::LoadFeatures(), mConceptSet, mHelper, Impala::Core::Training::ApplyConceptsHelper::Predict(), Impala::Util::PrintMemUsage(), Impala::Core::Table::Table::Size(), Impala::Timer::SplitTimeStr(), and Impala::Core::Training::ApplyConceptsHelper::UnloadFeatures(). Referenced by Impala::Core::ImageSet::ApplyConcepts::HandleDoneDir(), and Impala::Core::VideoSet::ApplyConcepts::HandleDoneFile(). 00087 { 00088 if((!CmdOptions::GetInstance().GetBool("override")) && 00089 Table::SimilarityTableSet::Exists(pathCreator)) 00090 { 00091 /* the set already exists and no override: skip it */ 00092 ILOG_INFO("Table already exsists, skipping"); 00093 return; 00094 } 00095 Util::PrintMemUsage("loading features..."); 00096 FeatureTable* features = mHelper->LoadFeatures(pathCreator); 00097 Util::PrintMemUsage("loading features: done"); 00098 std::vector<String> names = mConceptSet->GetNames(); 00099 Util::PrintMemUsage("got names"); 00100 Table::SimilarityTableSet simSet(names, features->Size()); 00101 Core::Table::Copy(simSet.GetQuidTable(), features); // copy Quids only 00102 00103 Timer timerTotal; 00104 for (int i=0 ; i<mConceptSet->GetNrConcepts() ; i++) 00105 { 00106 ILOG_INFO("concept " << i << " of " << mConceptSet->GetNrConcepts()); 00107 Timer timerConcept; 00108 Feature::Concept* concept = mConceptSet->GetConcept(i); 00109 if(!concept) 00110 { 00111 ILOG_ERROR("concept " << i << " of " << 00112 mConceptSet->GetNrConcepts() << " is NULL!"); 00113 } 00114 String modelName = concept->GetModelName(mHelper->GetModelName()); 00115 if (modelName.empty()) 00116 { 00117 ILOG_ERROR("Unable to find model, skipping"); 00118 continue; 00119 } 00120 00121 ILOG_INFO("model " << modelName); 00122 Util::PrintMemUsage("pre-predict"); 00123 ILOG_DEBUG("predicting..."); 00124 ScoreTable* scores = mHelper->Predict(modelName); 00125 ILOG_DEBUG("setting sim table..."); 00126 simSet.SetSimTable(i, scores); 00127 ILOG_DEBUG("deleting..."); 00128 delete scores; 00129 Util::PrintMemUsage("post-predict"); 00130 ILOG_DEBUG("computing rank..."); 00131 simSet.ComputeRank(i, true); 00132 ILOG_INFO("time this concept = " << timerConcept.SplitTimeStr() 00133 << ", total = " << timerTotal.SplitTimeStr()); 00134 } 00135 Util::PrintMemUsage("presave"); 00136 pathCreator->SetFeature(mHelper->GetModelName()); 00137 simSet.Save(pathCreator); 00138 Util::PrintMemUsage("pre-unload"); 00139 mHelper->UnloadFeatures(); 00140 Util::PrintMemUsage("post-unload"); 00141 }
Here is the call graph for this function:
|