Skip to content

Commit a0896c7

Browse files
committed
tracking: update tresholds in regression tests of the TLD
1 parent 895a914 commit a0896c7

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

modules/tracking/src/multiTracker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ namespace cv
408408
////To fix: Check the paper, probably this cause wrong learning
409409
//
410410
labPatch.isObject = srValue > tld::THETA_NN;
411-
labPatch.shouldBeIntegrated = abs(srValue - tld::THETA_NN) < 0.1;
411+
labPatch.shouldBeIntegrated = abs(srValue - tld::THETA_NN) < tld::CLASSIFIER_MARGIN;
412412
patches[k].push_back(labPatch);
413413
//
414414

modules/tracking/src/tldDetector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ namespace cv
420420
////To fix: Check the paper, probably this cause wrong learning
421421
//
422422
labPatch.isObject = srValue > THETA_NN;
423-
labPatch.shouldBeIntegrated = abs(srValue - THETA_NN) < 0.1;
423+
labPatch.shouldBeIntegrated = abs(srValue - THETA_NN) < CLASSIFIER_MARGIN;
424424
patches.push_back(labPatch);
425425
//
426426

@@ -539,7 +539,7 @@ namespace cv
539539
////To fix: Check the paper, probably this cause wrong learning
540540
//
541541
labPatch.isObject = srValue > THETA_NN;
542-
labPatch.shouldBeIntegrated = abs(srValue - THETA_NN) < 0.1;
542+
labPatch.shouldBeIntegrated = abs(srValue - THETA_NN) < CLASSIFIER_MARGIN;
543543
patches.push_back(labPatch);
544544
//
545545

modules/tracking/src/tldDetector.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ namespace cv
5757
const int MEASURES_PER_CLASSIFIER = 13;
5858
const int GRIDSIZE = 15;
5959
const int DOWNSCALE_MODE = cv::INTER_LINEAR;
60-
const double THETA_NN = 0.50;
60+
const double THETA_NN = 0.5;
6161
const double CORE_THRESHOLD = 0.5;
62+
const double CLASSIFIER_MARGIN = 0.1;
6263
const double SCALE_STEP = 1.2;
6364
const double ENSEMBLE_THRESHOLD = 0.5;
6465
const double VARIANCE_THRESHOLD = 0.5;

modules/tracking/src/tldTracker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ int TrackerTLDImpl::Pexpert::additionalExamples(std::vector<Mat_<uchar> >& examp
262262
TLDDetector::generateScanGrid(img_.rows, img_.cols, initSize_, scanGrid);
263263
getClosestN(scanGrid, Rect2d(resultBox_.x / scale, resultBox_.y / scale, resultBox_.width / scale, resultBox_.height / scale), 10, closest);
264264

265-
for( int i = 0; i < (int)closest.size(); i++ )
265+
for( size_t i = 0; i < closest.size(); i++ )
266266
{
267-
for( int j = 0; j < 10; j++ )
267+
for( size_t j = 0; j < 10; j++ )
268268
{
269269
Point2f center;
270270
Size2f size;

modules/tracking/src/tldUtils.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,11 @@ void getClosestN(std::vector<Rect2d>& scanGrid, Rect2d bBox, int n, std::vector<
151151
double variance(const Mat& img)
152152
{
153153
double p = 0, p2 = 0;
154-
for( int i = 0; i < img.rows; i++ )
155-
{
156-
for( int j = 0; j < img.cols; j++ )
157-
{
158-
p += img.at<uchar>(i, j);
159-
p2 += img.at<uchar>(i, j) * img.at<uchar>(i, j);
160-
}
161-
}
154+
p = sum(img)(0);
155+
p2 = norm(img, NORM_L2SQR);
162156
p /= (img.cols * img.rows);
163157
p2 /= (img.cols * img.rows);
158+
164159
return p2 - p * p;
165160
}
166161

modules/tracking/test/test_trackers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ TEST_P(DistanceAndOverlap, KCF)
461461

462462
TEST_P(DistanceAndOverlap, TLD)
463463
{
464-
TrackerTest test( TrackerTLD::create(), dataset, 60, .4f, NoTransform);
464+
TrackerTest test( TrackerTLD::create(), dataset, 40, .45f, NoTransform);
465465
test.run();
466466
}
467467
/***************************************************************************************/
@@ -492,7 +492,7 @@ TEST_P(DistanceAndOverlap, Shifted_Data_KCF)
492492

493493
TEST_P(DistanceAndOverlap, Shifted_Data_TLD)
494494
{
495-
TrackerTest test( TrackerTLD::create(), dataset, 120, .2f, CenterShiftLeft);
495+
TrackerTest test( TrackerTLD::create(), dataset, 30, .35f, CenterShiftLeft);
496496
test.run();
497497
}
498498
/***************************************************************************************/
@@ -523,7 +523,7 @@ TEST_P(DistanceAndOverlap, Scaled_Data_KCF)
523523

524524
TEST_P(DistanceAndOverlap, Scaled_Data_TLD)
525525
{
526-
TrackerTest test( TrackerTLD::create(), dataset, 120, .45f, Scale_1_1);
526+
TrackerTest test( TrackerTLD::create(), dataset, 30, .45f, Scale_1_1);
527527
test.run();
528528
}
529529

0 commit comments

Comments
 (0)