Definition at line 333 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(). 00334 { 00335 std::cout << std::endl; 00336 std::cout << "Saving Annotation Tables subset concept-in-genre.tab: "<< std::endl; 00337 std::cout << "------------------------------------------------------"<< std::endl; 00338 00339 if (bDumpTestSet) 00340 { 00341 nLeastPositiveSamples = 0; 00342 } 00343 else 00344 { 00345 if (nLeastPositiveSamples<0) 00346 nLeastPositiveSamples = 100; 00347 } 00348 00349 int nAddTable = 0; 00350 int nSkipTable = 0; 00351 00352 for (int j=0; j<mGenreNum; j++) 00353 { 00354 for (int k=0; k<mConceptNum; k++) 00355 { 00356 //AnnotationTable* annoTab = annoTabSet->GetTable(j); 00357 Core::Table::AnnotationTable* annoTab = new Core::Table::AnnotationTable; 00358 00359 int countConceptPositiveInGenre = 0; 00360 00361 // loop for all the keyframes 00362 for (int idx=0; idx<mAnnoTableSize; idx++) 00363 { 00364 Quid q= tabGenre[j]->Get1(idx); 00365 //std::cout << "Quid: " << QuidObj(q).ToString() << std::endl; 00366 00367 if (bDumpTestSet) 00368 { 00369 // processing test set (no subset selection) 00370 // actually the same as SaveAnnoTableJointGenreAndConcept() 00371 if (tabGenre[j]->IsPositive(idx) && tabConcept[k]->IsPositive(idx)) 00372 { 00373 // both genre and concept are positive 00374 countConceptPositiveInGenre ++; 00375 annoTab->AddPositive(q); 00376 } 00377 else if (tabGenre[j]->IsSkip(idx) || tabConcept[k]->IsSkip(idx)) 00378 { 00379 // either genre is skipped, or concept is skipped 00380 annoTab->AddSkip(q); 00381 } 00382 else 00383 { 00384 // either genre is negative, or concept is negtive 00385 annoTab->AddNegative(q); 00386 } 00387 00388 } 00389 else 00390 { 00391 // processing training set, 00392 // Note: only processing a subset, within a specific genre type 00393 if (tabGenre[j]->IsPositive(idx)) 00394 { 00395 //only output the positives samples within a gerne 00396 if (tabConcept[k]->IsPositive(idx)) 00397 { 00398 countConceptPositiveInGenre ++; 00399 annoTab->AddPositive(q); 00400 } 00401 else 00402 { 00403 // genre is positive, but concept is negtive 00404 annoTab->AddNegative(q); 00405 } 00406 } 00407 else 00408 { 00409 //Either negative samples or skipped samples for a genre will be ignored 00410 } 00411 } 00412 00413 } 00414 00415 String strGenreName = tabGenre[j]->GetLabel(); 00416 String strConceptName = tabConcept[k]->GetLabel(); 00417 String strTabName = strGenreName + "-" + strConceptName + ".tab"; 00418 00419 if (countConceptPositiveInGenre) 00420 { 00421 if (countConceptPositiveInGenre >= nLeastPositiveSamples) 00422 { 00423 std::cout << strTabName << std::endl; 00424 annoTab->DumpSummary(); 00425 } 00426 else 00427 { 00428 std::cout << strTabName << std::endl; 00429 std::cout << "[0-" << nLeastPositiveSamples-1 <<"]: "; 00430 annoTab->DumpSummary(); 00431 00432 nSkipTable++; 00433 } 00434 00435 00436 } 00437 00438 //std::string fName = mAnnoVidSet->GetFilePathAnnotation("Frame/concepts_joint.txt/",false,false); 00439 //if (fName == "") std::cout << "Path does not exist: " << fName << std::endl; 00440 00441 String OutPath = "Annotations/Frame/concepts_subset_in_genres.txt/" + strTabName; 00442 00443 if (bWriteTable && (countConceptPositiveInGenre >= nLeastPositiveSamples) ) 00444 { 00445 Core::Table::Write(annoTab, OutPath, mAnnoVidSet->GetDatabase(), true); 00446 00447 nAddTable ++; 00448 } 00449 00450 delete annoTab; 00451 } 00452 } 00453 00454 std::cout << "Done. [ " << nAddTable << " (out of " << mGenreNum << "*" << mConceptNum << ")"; 00455 std::cout << " *.tab files have been saved! ] " << std::endl; 00456 std::cout << "Skipped: " << nSkipTable << std::endl; 00457 00458 int x=0; 00459 00460 }
Here is the call graph for this function:
|