Home || Visual Search || Applications || Architecture || 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 487 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().

00488     {
00489         ILOG_DEBUG("entering MakeEpisodeFolds");
00490 
00491         int quidclass = GetQuidClass();
00492         if(quidclass != QUID_CLASS_SHOT &&
00493            quidclass != QUID_CLASS_KEYFRAME &&
00494            quidclass != QUID_CLASS_FRAME)
00495         {
00496             ILOG_WARNING_HEADNODE("annotees of wrong quidclass, cannot do episode " <<
00497                               "constrained");
00498             return MakeRandomFolds(foldCount, repetition);
00499         }
00500 
00501         if(foldCount <= 1)
00502         {
00503             ILOG_ERROR("we need at least 2 folds");
00504             return std::vector<QuidTable*>(1, GetAnnotatedQuids());
00505         }
00506 
00507         QuidTable* positive = GetPositive();
00508         QuidTable* negative = GetNegative();
00509         ILOG_DEBUG_NODE("make episode folds: #annotations = " <<
00510                         positive->Size() + negative->Size());
00511 
00512         // group per video
00513         std::vector<int> positiveVideos;
00514         std::vector<int> negativeVideos;
00515         GroupPerVideo(positive, negative, positiveVideos, negativeVideos);
00516         delete positive;
00517         delete negative;
00518 
00519         std::vector<QuidTable*> folds;
00520         for(int i=0 ; i<foldCount ; i++)
00521             folds.push_back(new QuidTable(0));
00522 
00523         // distribute 'positive' videos
00524         int lastFold=0;
00525         Util::QuasiRandomSequenceIterator pos(positiveVideos.size(),repetition);
00526         for(int i=0 ; i<positiveVideos.size() ; ++i)
00527         {
00528             CriterionQuidObjectEquals<AnnotationTable>
00529                 c(positiveVideos[*pos]);
00530             SelectOneColumn(folds[lastFold], this, 1, c, false);
00531             ++pos;
00532             ++lastFold;
00533             if(lastFold >= foldCount)
00534                 lastFold = 0;
00535         }
00536 
00537         // distribute 'negative' videos
00538         Util::QuasiRandomSequenceIterator neg(negativeVideos.size(),repetition);
00539         for(int i=0 ; i<negativeVideos.size() ; ++i)
00540         {
00541             CriterionQuidObjectEquals<AnnotationTable>
00542                 c(negativeVideos[*neg]);
00543             SelectOneColumn(folds[lastFold], this, 1, c, false);
00544             ++neg;
00545             ++lastFold;
00546             if(lastFold >= foldCount)
00547                 lastFold = 0;
00548         }
00549 
00550         ILOG_DEBUG("leaving MakeFolds");
00551         return folds;
00552     }

Here is the call graph for this function:


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