template<class ArrayT, class SimFuncT>
Compute similarity of example vector set to all (sub)subsets of src unless a filter is given indicating which subsets should be skipped. Similarity is defined by simFunc on two VectorSet<ArrayT>::VectorT. Optionally, comparison of subsets may be based on subsubsets (by specifying a subSubSetSize smaller than subSetSize). In this case, the score for a subset is determined by the indicated activeSubSubSet or, if(activeSubSubSet == -1) the maximum score or the average score of all subsubsets. The number of vectors in example must be either subSetSize or subSubSetSize. In the latter case, the vectors in example are "re-used" for each subsubset. Number of elements in filter as well as dst should be src->Size()/subSetSize. Definition at line 73 of file Similarity.h. References Impala::Core::Vector::VectorTem< ElemT >::Elem(), Max(), Similarity(), and Impala::Core::Vector::VectorSet< ArrayT >::Size(). Referenced by Impala::Core::Feature::VisSem::ComputeRegionSimilarity(), Impala::Application::Table::DoSimFeatureTable(), Impala::Core::Trec::ThreadVisualSimilarity::GetNearestFrameQuid(), Impala::Visualization::FeatureTableSetRank::HandleNewFile(), and Impala::Core::Trec::ThreadVisualSimilarity::SetOrigin(). 00076 { 00077 int nrSubSets = src->Size() / subSetSize; 00078 int nrSubSubSet = 1; 00079 bool reUseEx = false; 00080 if ((subSetSize != subSubSetSize) && (example->Size() == subSubSetSize)) 00081 reUseEx = true; 00082 nrSubSubSet = subSetSize / subSubSetSize; 00083 for (int s=0 ; s<nrSubSets ; s++) 00084 { 00085 if (filter && (!filter[s])) 00086 continue; 00087 Real64 totScore = 0; 00088 int srcBase = s * subSetSize; 00089 int exBase = 0; 00090 for (int ss=0 ; ss<nrSubSubSet ; ss++) 00091 { 00092 Real64 score = Similarity(example, src, exBase, srcBase, 00093 subSubSetSize, simFunc); 00094 srcBase += subSubSetSize; 00095 if (!reUseEx) 00096 exBase += subSubSetSize; 00097 totScore = (doMax) ? Max(totScore, score) : totScore + score; 00098 } 00099 if (!doMax) 00100 totScore /= nrSubSubSet; 00101 dst->Elem(s) = totScore; 00102 } 00103 }
Here is the call graph for this function:
|