Commit 11e30e272138ae38211d984e71b0b4f6b4cda239
1 parent
5f6ac8ad
Minor boosting tweaks
Showing
1 changed file
with
4 additions
and
6 deletions
openbr/core/boost.cpp
| @@ -582,11 +582,9 @@ void CascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* ord | @@ -582,11 +582,9 @@ void CascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* ord | ||
| 582 | 582 | ||
| 583 | // For this feature, have we precalculated all of the feature responses? | 583 | // For this feature, have we precalculated all of the feature responses? |
| 584 | if (vi < numPrecalcVal) { | 584 | if (vi < numPrecalcVal) { |
| 585 | - for (int i = 0; i < nodeSampleCount; i++) { | ||
| 586 | - int idx = (*sortedIndices)[i]; | ||
| 587 | - idx = sampleIndices[idx]; | ||
| 588 | - ordValuesBuf[i] = valCache.at<float>(vi, idx); | ||
| 589 | - } | 585 | + float *p = valCache.ptr<float>(vi); |
| 586 | + for (int i = 0; i < nodeSampleCount; i++) | ||
| 587 | + ordValuesBuf[i] = p[sampleIndices[(*sortedIndices)[i]]]; | ||
| 590 | } else { | 588 | } else { |
| 591 | for (int i = 0; i < nodeSampleCount; i++) { | 589 | for (int i = 0; i < nodeSampleCount; i++) { |
| 592 | int idx = (*sortedIndices)[i]; | 590 | int idx = (*sortedIndices)[i]; |
| @@ -762,7 +760,7 @@ void CascadeBoostTrainData::precalculate() | @@ -762,7 +760,7 @@ void CascadeBoostTrainData::precalculate() | ||
| 762 | parallel_for_(Range(minPrecalc, numPrecalcVal), | 760 | parallel_for_(Range(minPrecalc, numPrecalcVal), |
| 763 | FeaturePrecalc(featureEvaluator, &valCache, sample_count)); | 761 | FeaturePrecalc(featureEvaluator, &valCache, sample_count)); |
| 764 | 762 | ||
| 765 | - cout << "Precalculation time (ms): " << time.elapsed() << endl; | 763 | + cout << "Precalculation time (min): " << time.elapsed()/1000/60. << endl; |
| 766 | } | 764 | } |
| 767 | 765 | ||
| 768 | //-------------------------------- CascadeBoostTree ---------------------------------------- | 766 | //-------------------------------- CascadeBoostTree ---------------------------------------- |