mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
speedup random forest getVotes method.
This commit is contained in:
parent
ae4a11b0c0
commit
7d3d2101f9
@ -388,9 +388,10 @@ public:
|
|||||||
results = output.getMat();
|
results = output.getMat();
|
||||||
for( i = 0; i < nsamples; i++ )
|
for( i = 0; i < nsamples; i++ )
|
||||||
{
|
{
|
||||||
|
const Mat sampleRow = samples.row(i);
|
||||||
for( j = 0; j < ntrees; j++ )
|
for( j = 0; j < ntrees; j++ )
|
||||||
{
|
{
|
||||||
float val = predictTrees( Range(j, j+1), samples.row(i), flags);
|
float val = predictTrees( Range(j, j+1), sampleRow, flags);
|
||||||
results.at<float> (i, j) = val;
|
results.at<float> (i, j) = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,9 +409,10 @@ public:
|
|||||||
for( i = 0; i < nsamples; i++ )
|
for( i = 0; i < nsamples; i++ )
|
||||||
{
|
{
|
||||||
votes.clear();
|
votes.clear();
|
||||||
|
const Mat sampleRow = samples.row(i);
|
||||||
for( j = 0; j < ntrees; j++ )
|
for( j = 0; j < ntrees; j++ )
|
||||||
{
|
{
|
||||||
int val = (int)predictTrees( Range(j, j+1), samples.row(i), flags);
|
int val = (int)predictTrees( Range(j, j+1), sampleRow, flags);
|
||||||
votes.push_back(val);
|
votes.push_back(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user