Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Core::Table::BayesCondProb::SaveAnnoTableJointGenreAndConcept ( int  nLeastPositiveSamples = 0,
bool  bWriteTable = false 
) [inline]

Definition at line 240 of file BayesCondProb.h.

References Impala::Core::Table::AnnotationTable::AddPositive(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Table::AnnotationTable::GetLabel(), Impala::Core::Table::Bayes::mAnnoTableSize, Impala::Core::Table::Bayes::mAnnoVidSet, Impala::Core::Table::Bayes::mConceptNum, Impala::Core::Table::Bayes::mGenreNum, Impala::Core::Table::Bayes::tabConcept, Impala::Core::Table::Bayes::tabGenre, and Impala::Core::Table::Write().

00241     {
00242         std::cout << std::endl;
00243         std::cout << "Saving Annotation Tables for joint probability: "<< std::endl;
00244         std::cout << "------------------------------------------------"<< std::endl;
00245 
00246         if (nLeastPositiveSamples<0)
00247             nLeastPositiveSamples = 100;
00248 
00249         int nAddTable = 0;
00250         int nSkipTable = 0;
00251 
00252         for (int j=0; j<mGenreNum; j++)
00253         {      
00254             for (int k=0; k<mConceptNum; k++)
00255             {
00256                 //AnnotationTable* annoTab = annoTabSet->GetTable(j);
00257                 Core::Table::AnnotationTable* annoTab = new Core::Table::AnnotationTable;
00258 
00259                 int countJointPos = 0;
00260 
00261                 // loop for all the keyframes
00262                 for (int idx=0; idx<mAnnoTableSize; idx++)
00263                 {
00264                     Quid q= tabGenre[j]->Get1(idx);
00265                     //std::cout << "Quid: " << QuidObj(q).ToString()  << std::endl;
00266 
00267                     if (tabGenre[j]->IsPositive(idx) && tabConcept[k]->IsPositive(idx))
00268                     {
00269                         // both genre and concept are positive
00270                         countJointPos ++;
00271                         annoTab->AddPositive(q);
00272                     }
00273                     else if (tabGenre[j]->IsSkip(idx) || tabConcept[k]->IsSkip(idx))
00274                     {
00275                         // either genre is skipped, or concept is skipped
00276                         annoTab->AddSkip(q);
00277                     }
00278                     else
00279                     {
00280                         // either genre is negative, or concept is negtive
00281                         annoTab->AddNegative(q);
00282                     }
00283                 }
00284 
00285                 String strGenreName = tabGenre[j]->GetLabel();
00286                 String strConceptName = tabConcept[k]->GetLabel();
00287                 String strTabName = strGenreName + "-" + strConceptName + ".tab";
00288 
00289                 if (countJointPos)
00290                 {
00291                     if (countJointPos >= nLeastPositiveSamples)
00292                     {
00293                         std::cout << strTabName << std::endl;
00294                         annoTab->DumpSummary();
00295                     }
00296                     else
00297                     {
00298                         std::cout << strTabName << std::endl;
00299                         std::cout << "[0-" << nLeastPositiveSamples-1 << "]: ";
00300                         annoTab->DumpSummary();
00301 
00302                         nSkipTable++;
00303                     }
00304                                            
00305                 }
00306 
00307                 //std::string fName = mAnnoVidSet->GetFilePathAnnotation("Frame/concepts_joint.txt/",false,false);
00308                 //if (fName == "") std::cout << "Path does not exist: " << fName << std::endl;
00309  
00310                 String OutPath = "Annotations/Frame/concepts_joint_set3.txt/" + strTabName;
00311                             
00312                 if (bWriteTable && (countJointPos >= nLeastPositiveSamples) )
00313                 {
00314                     Core::Table::Write(annoTab, OutPath, mAnnoVidSet->GetDatabase(), true);
00315 
00316                     nAddTable ++;
00317                 }
00318 
00319                 delete annoTab;
00320             }
00321         }
00322 
00323         std::cout << "Done. [ " << nAddTable << " (out of " << mGenreNum << "*" << mConceptNum << ")"; 
00324         std::cout << " *.tab files have been saved! ] " << std::endl;
00325         std::cout << "Skipped: " << nSkipTable << std::endl;
00326 
00327         int x=0;
00328 
00329     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:20:22 2010 for ImpalaSrc by  doxygen 1.5.1