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

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

Definition at line 243 of file BayesCondProb.h.

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

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

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:48 2011 for ImpalaSrc by  doxygen 1.5.1