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

void Impala::Samples::MonetTest::InsertOneSimTable ( Connection *  conn,
VideoSet *  vidSet,
String  conceptSet,
String  model,
String  feature,
int  fileIdx,
String  concept,
QuidTable *  quidTab 
)

Definition at line 1262 of file mainMonetTest.cpp.

References Impala::FileNameBase(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Database::RawDataSet::GetFilePathSimilarityData(), Impala::CmdOptions::GetInstance(), GetIntInRange(), Impala::Core::VideoSet::VideoSet::GetQuidVideo(), Impala::Core::Database::RawDataSet::GetSetNameBase(), ILOG_ERROR, ILOG_INFO, ILOG_VAR, Impala::MakeString(), Impala::QUID_CLASS_FRAME, Impala::QuidClass(), Impala::QuidId(), Impala::Core::Table::Read(), and Impala::Timer::SplitTime().

Referenced by DoSimilarities().

01265 {
01266     typedef SimilarityTableSet::SimTableType SimTableType;
01267 
01268     ILOG_VAR(Impala.Samples.MonetTest.InsertOneSimTable);
01269     CmdOptions& options = CmdOptions::GetInstance();
01270 
01271     SimTableType simTable(0);
01272     String path =
01273         vidSet->GetFilePathSimilarityData("Frames", conceptSet, model,
01274                                           feature, fileIdx,
01275                                           concept + "_sim.tab", false, false);
01276     if (path.empty())
01277         return;
01278     Core::Table::Read(&simTable, path, vidSet->GetDatabase());
01279     ILOG_INFO("simTable size = " << simTable.Size());
01280     Quid vidQuid = vidSet->GetQuidVideo(fileIdx, true);
01281 
01282     conn->Query("delete from i_bulk_score;", false, false);
01283     int startScore = GetIntInRange("startScore", 0, simTable.Size(), false);
01284     int numberScores = GetIntInRange("numberScores", startScore,
01285                                      simTable.Size(), true);
01286     int bulkSize = 100000;
01287     Timer timer;
01288     for (int i=startScore ; i<startScore+numberScores ; i+=bulkSize)
01289     {
01290         int left = numberScores - i;
01291         int nr = (left > bulkSize) ? bulkSize : left;
01292         String q = "copy " + MakeString(nr) +
01293                  " records into i_bulk_score from stdin using delimiters ' ';\n";
01294         for (int j=i ; j<i+nr ; j++)
01295         {
01296             Quid frameQuid = quidTab->Get1(j);
01297             if (QuidClass(frameQuid) != QUID_CLASS_FRAME)
01298                 ILOG_ERROR("Quid is not a frame");
01299             int frameNr = QuidId(frameQuid);
01300 
01301             q += MakeString(vidQuid) + " " + MakeString(frameNr) + " "
01302                 + MakeString(simTable.Get1(j)) + "\n";
01303         }
01304         conn->Query(q, false, false);
01305         ILOG_INFO("Did bulk at " << timer.SplitTime());
01306     }
01307 
01308     String vidSetBase = vidSet->GetSetNameBase();
01309     String conceptSetBase = FileNameBase(conceptSet);
01310     conn->Query("insert into score (fragment_id, model_sets_id, file_id, \
01311                                     confidence) \
01312                  select fr.fragment_id, mss.model_sets_id, f.file_id, \
01313                         bs.confidence \
01314                  from video_sets vss, video_set vs, keyword_sets kss, \
01315                       keyword_set ks, keyword k, model_sets_name msn, \
01316                       model_sets mss, model_ref mr, \
01317                       file f, fragment fr, i_bulk_score bs \
01318                  where vss.set_name = '" + vidSetBase + "' and \
01319                        kss.set_name = '" + conceptSetBase + "' and \
01320                        kss.video_sets_id = vss.video_sets_id and \
01321                        msn.set_name = '" + feature + "' and \
01322                        mss.model_sets_name_id = msn.model_sets_name_id and \
01323                        k.keyword_name = '" + concept + "' and \
01324                        ks.keyword_sets_id = kss.keyword_sets_id and \
01325                        ks.keyword_id = k.keyword_id and \
01326                        mr.model_name = '" + model + "' and \
01327                        mr.keyword_set_id = ks.keyword_set_id and \
01328                        mr.model_ref_id = mss.model_ref_id and \
01329                        vs.video_sets_id = vss.video_sets_id and \
01330                        f.file_id = vs.file_id and \
01331                        bs.quid = f.quid and \
01332                        fr.media_id = f.media_id and \
01333                        fr.fragment_start = bs.fragment_start and \
01334                        fr.fragment_length = 1 and \
01335                        fr.keyframe = false \
01336                  order by bs.fragment_start;", false, false);
01337     ILOG_INFO("Did insert select at " << timer.SplitTime());
01338     conn->Query("delete from i_bulk_score;", false, false);
01339     ILOG_INFO("Done in " << timer.SplitTime());
01340 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:38:32 2010 for ImpalaSrc by  doxygen 1.5.1