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

std::vector<QuidTable*> Impala::Core::Table::AnnotationTable::MakeEpisodeFolds ( int  foldCount,
int  repetition 
) [inline]

This function creates 'episode contrained' folds from annotation.

This can only be done in VideoSets. As epipsodes are undefined in ImageSets.

Definition at line 406 of file AnnotationTable.h.

References GetAnnotatedQuids(), GetNegative(), GetPositive(), GetQuidClass(), GroupPerVideo(), ILOG_DEBUG, ILOG_ERROR, MakeRandomFolds(), Impala::QUID_CLASS_FRAME, Impala::QUID_CLASS_KEYFRAME, Impala::QUID_CLASS_SHOT, Impala::Core::Table::SelectOneColumn(), and Impala::Core::Table::Table::Size().

Referenced by Impala::Core::Training::TrainDataSrc::MakeFolds(), and Impala::Core::Training::Tester::TestFolds().

00407     {
00408         ILOG_DEBUG("entering MakeEpisodeFolds");
00409 
00410         int quidclass = GetQuidClass();
00411         if(quidclass != QUID_CLASS_SHOT &&
00412            quidclass != QUID_CLASS_KEYFRAME &&
00413            quidclass != QUID_CLASS_FRAME)
00414         {
00415             ILOG_WARNING_ONCE("annotees of wrong quidclass, cannot do episode " <<
00416                               "constrained");
00417             return MakeRandomFolds(foldCount, repetition);
00418         }
00419 
00420         if(foldCount <= 1)
00421         {
00422             ILOG_ERROR("we need at least 2 folds");
00423             return std::vector<QuidTable*>(1, GetAnnotatedQuids());
00424         }
00425 
00426         QuidTable* positive = GetPositive();
00427         QuidTable* negative = GetNegative();
00428         ILOG_DEBUG_NODE("make episode folds: #annotations = " <<
00429                         positive->Size() + negative->Size());
00430 
00431         // group per video
00432         std::vector<int> positiveVideos;
00433         std::vector<int> negativeVideos;
00434         GroupPerVideo(positive, negative, positiveVideos, negativeVideos);
00435         delete positive;
00436         delete negative;
00437 
00438         std::vector<QuidTable*> folds;
00439         for(int i=0 ; i<foldCount ; i++)
00440             folds.push_back(new QuidTable(0));
00441 
00442         // distribute 'positive' videos
00443         int lastFold=0;
00444         Util::QuasiRandomSequenceIterator pos(positiveVideos.size(),repetition);
00445         for(int i=0 ; i<positiveVideos.size() ; ++i)
00446         {
00447             CriterionQuidObjectEquals<AnnotationTable>
00448                 c(positiveVideos[*pos]);
00449             SelectOneColumn(folds[lastFold], this, 1, c, false);
00450             ++pos;
00451             ++lastFold;
00452             if(lastFold >= foldCount)
00453                 lastFold = 0;
00454         }
00455 
00456         // distribute 'negative' videos
00457         Util::QuasiRandomSequenceIterator neg(negativeVideos.size(),repetition);
00458         for(int i=0 ; i<negativeVideos.size() ; ++i)
00459         {
00460             CriterionQuidObjectEquals<AnnotationTable>
00461                 c(negativeVideos[*neg]);
00462             SelectOneColumn(folds[lastFold], this, 1, c, false);
00463             ++neg;
00464             ++lastFold;
00465             if(lastFold >= foldCount)
00466                 lastFold = 0;
00467         }
00468 
00469         ILOG_DEBUG("leaving MakeFolds");
00470         return folds;
00471     }

Here is the call graph for this function:


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