Definition at line 116 of file FeatureTableRepositoryInMonet.h. References Impala::Util::Bin2Hex(), Impala::FileNameBase(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get2(), Impala::Persistency::RepositoryInMonetDB::GetConnection(), Impala::Persistency::FeatureLocator::GetContainer(), Impala::Core::Vector::VectorTem< ElemT >::GetData(), Impala::Persistency::Locator::GetDataSet(), Impala::Persistency::FeatureLocator::GetFeatureString(), Impala::Persistency::FeatureLocator::GetIsIndex(), Impala::Persistency::FeatureLocator::GetWalkType(), ILOG_ERROR, ILOG_INFO, Impala::MakeString(), Impala::QUID_CLASS_FRAME, Impala::QuidClass(), Impala::QuidId(), RepMonet(), Impala::Core::Vector::VectorTem< ElemT >::Size(), Impala::Core::Table::Table::Size(), and Impala::Timer::SplitTime(). 00117 { 00118 if (loc.GetIsIndex()) 00119 { 00120 ILOG_ERROR("Index not implemented (yet)"); 00121 return; 00122 } 00123 if (loc.GetWalkType() != "Frames") 00124 { 00125 ILOG_ERROR("Only implemented for Frames"); 00126 return; 00127 } 00128 00129 Connection* conn = RepMonet().GetConnection(loc); 00130 00131 String vidSetBase = FileNameBase(loc.GetDataSet()); 00132 Core::VideoSet::VideoSet* vidSet = VideoSetRepository().Get(loc); 00133 int fileIdx = vidSet->GetFileId(loc.GetContainer()); 00134 Quid vidQuid = vidSet->GetQuidVideo(fileIdx, true); 00135 00136 String q = "select i_add_feature('" + loc.GetFeatureString() + "');"; 00137 conn->Query(q, false, false); 00138 00139 conn->Query("delete from i_bulk_feature_vector;", false, false); 00140 int totalSize = tab->Size(); 00141 int bulkSize = 2000; 00142 Timer timer; 00143 for (int i=0 ; i<totalSize ; i+=bulkSize) 00144 { 00145 int left = totalSize - i; 00146 int nr = (left > bulkSize) ? bulkSize : left; 00147 String q = "copy " + MakeString(nr) + 00148 " records into i_bulk_feature_vector from stdin" + 00149 " using delimiters ' ';\n"; 00150 for (int j=i ; j<i+nr ; j++) 00151 { 00152 Quid frameQuid = tab->Get1(j); 00153 if (QuidClass(frameQuid) != QUID_CLASS_FRAME) 00154 ILOG_ERROR("Quid is not a frame"); 00155 int frameNr = QuidId(frameQuid); 00156 FeatureTable::VectorReal64 v = tab->Get2(j); 00157 size_t dataSize = v.Size() * sizeof(Real64); 00158 UInt8* data = (UInt8*) v.GetData(); 00159 String hexData = Util::Bin2Hex(data, dataSize); 00160 00161 q += MakeString(vidQuid) + " " + MakeString(frameNr) + " " 00162 + hexData + "\n"; 00163 } 00164 conn->Query(q, false, false); 00165 ILOG_INFO("Did bulk " << i << " at " << timer.SplitTime()); 00166 00167 conn->Query("insert into feature_vector (fragment_id, file_id, \ 00168 feature_id, vector) \ 00169 select fr.fragment_id, f.file_id, fe.feature_id, \ 00170 bfv.vector \ 00171 from i_bulk_feature_vector bfv, file f, \ 00172 fragment fr, feature fe \ 00173 where bfv.quid = f.quid and \ 00174 f.media_id = fr.media_id and \ 00175 fr.fragment_start = bfv.fragment_start and \ 00176 fr.fragment_length = 1 and \ 00177 fr.keyframe = false and \ 00178 fe.feature_name = '" + loc.GetFeatureString() + "' \ 00179 order by bfv.fragment_start;", false, false); 00180 ILOG_INFO("Did insert select at " << timer.SplitTime()); 00181 conn->Query("delete from i_bulk_feature_vector;", false, false); 00182 } 00183 }
Here is the call graph for this function: ![]()
|