Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
62cb7109
Commit
62cb7109
authored
Dec 02, 2010
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed traincascade (#554)
parent
07e68eb0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
boost.cpp
modules/traincascade/boost.cpp
+25
-11
No files found.
modules/traincascade/boost.cpp
View file @
62cb7109
...
...
@@ -139,7 +139,7 @@ bool CvCascadeBoostParams::scanAttr( const String prmName, const String val)
{
weight_trim_rate
=
(
float
)
atof
(
val
.
c_str
()
);
}
else
if
(
!
prmName
.
compare
(
"-maxDepth"
)
)
else
if
(
!
prmName
.
compare
(
"-max
Tree
Depth"
)
)
{
max_depth
=
atoi
(
val
.
c_str
()
);
}
...
...
@@ -240,9 +240,11 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
if
(
sample_count
<
65536
)
is_buf_16u
=
true
;
numPrecalcVal
=
min
(
(
_precalcValBufSize
*
1048576
)
/
int
(
sizeof
(
float
)
*
sample_count
),
var_count
);
numPrecalcIdx
=
min
(
(
_precalcIdxBufSize
*
1048576
)
/
int
((
is_buf_16u
?
sizeof
(
unsigned
short
)
:
sizeof
(
int
))
*
sample_count
),
var_count
);
numPrecalcVal
=
min
(
cvRound
((
double
)
_precalcValBufSize
*
1048576.
/
(
sizeof
(
float
)
*
sample_count
)),
var_count
);
numPrecalcIdx
=
min
(
cvRound
((
double
)
_precalcIdxBufSize
*
1048576.
/
((
is_buf_16u
?
sizeof
(
unsigned
short
)
:
sizeof
(
int
))
*
sample_count
)),
var_count
);
assert
(
numPrecalcIdx
>=
0
&&
numPrecalcVal
>=
0
);
valCache
.
create
(
numPrecalcVal
,
sample_count
,
CV_32FC1
);
var_type
=
cvCreateMat
(
1
,
var_count
+
2
,
CV_32SC1
);
...
...
@@ -394,7 +396,7 @@ void CvCascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* o
}
else
{
for
(
int
i
=
0
;
i
<
nodeSampleCount
;
i
++
)
for
(
int
i
=
0
;
i
<
nodeSampleCount
;
i
++
)
{
int
idx
=
(
*
sortedIndices
)[
i
];
idx
=
sampleIndices
[
idx
];
...
...
@@ -404,13 +406,26 @@ void CvCascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* o
}
else
// vi >= numPrecalcIdx
{
// use sample_indices as temporary buffer for values
vector
<
float
>
sampleValuesBuf
;
float
*
sampleValues
=
0
;
if
(
sizeof
(
float
)
==
sizeof
(
int
)
)
{
// use sampleIndices as temporary buffer for values
sampleValues
=
(
float
*
)
sampleIndices
;
}
else
{
sampleValuesBuf
.
resize
(
nodeSampleCount
);
sampleValues
=
&
sampleValuesBuf
[
0
];
}
if
(
vi
<
numPrecalcVal
)
{
for
(
int
i
=
0
;
i
<
nodeSampleCount
;
i
++
)
{
sortedIndicesBuf
[
i
]
=
i
;
((
float
*
)
sampleIndices
)
[
i
]
=
valCache
.
at
<
float
>
(
vi
,
sampleIndices
[
i
]
);
sampleValues
[
i
]
=
valCache
.
at
<
float
>
(
vi
,
sampleIndices
[
i
]
);
}
}
else
...
...
@@ -418,12 +433,12 @@ void CvCascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* o
for
(
int
i
=
0
;
i
<
nodeSampleCount
;
i
++
)
{
sortedIndicesBuf
[
i
]
=
i
;
((
float
*
)
sampleIndices
)
[
i
]
=
(
*
featureEvaluator
)(
vi
,
sampleIndices
[
i
]);
sampleValues
[
i
]
=
(
*
featureEvaluator
)(
vi
,
sampleIndices
[
i
]);
}
}
icvSortIntAux
(
sortedIndicesBuf
,
sample_count
,
(
float
*
)
sampleIndices
);
icvSortIntAux
(
sortedIndicesBuf
,
nodeSampleCount
,
&
sampleValues
[
0
]
);
for
(
int
i
=
0
;
i
<
nodeSampleCount
;
i
++
)
ordValuesBuf
[
i
]
=
(
(
float
*
)
sampleIndices
)[
sortedIndicesBuf
[
i
]];
ordValuesBuf
[
i
]
=
(
&
sampleValues
[
0
]
)[
sortedIndicesBuf
[
i
]];
*
sortedIndices
=
sortedIndicesBuf
;
}
...
...
@@ -553,7 +568,6 @@ struct FeatureValOnlyPrecalc
void
CvCascadeBoostTrainData
::
precalculate
()
{
int
minNum
=
MIN
(
numPrecalcVal
,
numPrecalcIdx
);
CV_DbgAssert
(
!
valCache
.
empty
()
);
double
proctime
=
-
TIME
(
0
);
parallel_for
(
BlockedRange
(
numPrecalcVal
,
numPrecalcIdx
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment