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