Parallel version of Latent SVM.

This commit is contained in:
Valentina Kustikova
2011-02-08 07:34:25 +00:00
parent 7539b7de65
commit d03b89f163
11 changed files with 662 additions and 49 deletions

View File

@@ -271,17 +271,30 @@ int searchObjectThreshold(const CvLSVMFeaturePyramid *H,
int maxXBorder, int maxYBorder,
float scoreThreshold,
CvPoint **points, int **levels, int *kPoints,
float **score, CvPoint ***partsDisplacement)
float **score, CvPoint ***partsDisplacement,
int numThreads)
{
int opResult;
// Matching
#ifdef HAVE_TBB
if (numThreads <= 0)
{
opResult = LATENT_SVM_TBB_NUMTHREADS_NOT_CORRECT;
return opResult;
}
opResult = tbbThresholdFunctionalScore(all_F, n, H, b, maxXBorder, maxYBorder,
scoreThreshold, numThreads, score,
points, levels, kPoints,
partsDisplacement);
#else
opResult = thresholdFunctionalScore(all_F, n, H, b,
maxXBorder, maxYBorder,
scoreThreshold,
score, points, levels,
kPoints, partsDisplacement);
#endif
if (opResult != LATENT_SVM_OK)
{
return LATENT_SVM_SEARCH_OBJECT_FAILED;
@@ -537,7 +550,8 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
int kComponents, const int *kPartFilters,
const float *b, float scoreThreshold,
CvPoint **points, CvPoint **oppPoints,
float **score, int *kPoints)
float **score, int *kPoints,
int numThreads)
{
int error = 0;
int i, j, s, f, componentIndex;
@@ -561,10 +575,17 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
// For each component perform searching
for (i = 0; i < kComponents; i++)
{
#ifdef HAVE_TBB
searchObjectThreshold(H, &(filters[componentIndex]), kPartFilters[i],
b[i], maxXBorder, maxYBorder, scoreThreshold,
&(pointsArr[i]), &(levelsArr[i]), &(kPointsArr[i]),
&(scoreArr[i]), &(partsDisplacementArr[i]), numThreads);
#else
searchObjectThreshold(H, &(filters[componentIndex]), kPartFilters[i],
b[i], maxXBorder, maxYBorder, scoreThreshold,
&(pointsArr[i]), &(levelsArr[i]), &(kPointsArr[i]),
&(scoreArr[i]), &(partsDisplacementArr[i]));
#endif
estimateBoxes(pointsArr[i], levelsArr[i], kPointsArr[i],
filters[componentIndex]->sizeX, filters[componentIndex]->sizeY, &(oppPointsArr[i]));
componentIndex += (kPartFilters[i] + 1);