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
48ea65e6
Commit
48ea65e6
authored
Dec 22, 2011
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed traincascade for ordered features
parent
b4f17ab7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
+19
-11
boost.cpp
modules/ml/src/boost.cpp
+1
-1
tree.cpp
modules/ml/src/tree.cpp
+15
-9
boost.cpp
modules/traincascade/boost.cpp
+0
-0
boost.h
modules/traincascade/boost.h
+3
-1
No files found.
modules/ml/src/boost.cpp
View file @
48ea65e6
...
...
@@ -1066,7 +1066,7 @@ CvBoost::train( const CvMat* _train_data, int _tflag,
if
(
!
tree
->
train
(
data
,
subsample_mask
,
this
)
)
{
delete
tree
;
continue
;
break
;
}
//cvCheckArr( get_weak_response());
cvSeqPush
(
weak
,
&
tree
);
...
...
modules/ml/src/tree.cpp
View file @
48ea65e6
...
...
@@ -718,7 +718,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
// co - array of count/offset pairs (to handle duplicated values in _subsample_idx)
int
*
co
,
cur_ofs
=
0
;
int
vi
,
i
;
int
work
_var_c
ount
=
get_work_var_count
();
int
work
VarC
ount
=
get_work_var_count
();
int
count
=
isubsample_idx
->
rows
+
isubsample_idx
->
cols
-
1
;
root
=
new_node
(
0
,
count
,
1
,
0
);
...
...
@@ -740,7 +740,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
}
cv
::
AutoBuffer
<
uchar
>
inn_buf
(
sample_count
*
(
2
*
sizeof
(
int
)
+
sizeof
(
float
)));
for
(
vi
=
0
;
vi
<
work
_var_c
ount
;
vi
++
)
for
(
vi
=
0
;
vi
<
work
VarC
ount
;
vi
++
)
{
int
ci
=
get_var_type
(
vi
);
...
...
@@ -841,14 +841,14 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
if
(
is_buf_16u
)
{
unsigned
short
*
sample_idx_dst
=
(
unsigned
short
*
)(
buf
->
data
.
s
+
root
->
buf_idx
*
buf
->
cols
+
get_work_var_count
()
*
sample_count
+
root
->
offset
);
workVarCount
*
sample_count
+
root
->
offset
);
for
(
i
=
0
;
i
<
count
;
i
++
)
sample_idx_dst
[
i
]
=
(
unsigned
short
)
sample_idx_src
[
sidx
[
i
]];
}
else
{
int
*
sample_idx_dst
=
buf
->
data
.
i
+
root
->
buf_idx
*
buf
->
cols
+
get_work_var_count
()
*
sample_count
+
root
->
offset
;
workVarCount
*
sample_count
+
root
->
offset
;
for
(
i
=
0
;
i
<
count
;
i
++
)
sample_idx_dst
[
i
]
=
sample_idx_src
[
sidx
[
i
]];
}
...
...
@@ -1622,13 +1622,19 @@ bool CvDTree::do_train( const CvMat* _subsample_idx )
CV_CALL
(
try_split_node
(
root
));
if
(
data
->
params
.
cv_folds
>
0
)
CV_CALL
(
prune_cv
()
);
if
(
root
->
split
)
{
CV_Assert
(
root
->
left
);
CV_Assert
(
root
->
right
);
if
(
data
->
params
.
cv_folds
>
0
)
CV_CALL
(
prune_cv
()
);
if
(
!
data
->
shared
)
data
->
free_train_data
();
if
(
!
data
->
shared
)
data
->
free_train_data
();
result
=
true
;
result
=
true
;
}
__END__
;
...
...
modules/traincascade/boost.cpp
View file @
48ea65e6
This diff is collapsed.
Click to expand it.
modules/traincascade/boost.h
View file @
48ea65e6
...
...
@@ -32,6 +32,8 @@ struct CvCascadeBoostTrainData : CvDTreeTrainData
const
CvDTreeParams
&
_params
=
CvDTreeParams
()
);
void
precalculate
();
virtual
CvDTreeNode
*
subsample_data
(
const
CvMat
*
_subsample_idx
);
virtual
const
int
*
get_class_labels
(
CvDTreeNode
*
n
,
int
*
labelsBuf
);
virtual
const
int
*
get_cv_labels
(
CvDTreeNode
*
n
,
int
*
labelsBuf
);
virtual
const
int
*
get_sample_indices
(
CvDTreeNode
*
n
,
int
*
indicesBuf
);
...
...
@@ -67,7 +69,7 @@ public:
const
CvCascadeBoostParams
&
_params
=
CvCascadeBoostParams
()
);
virtual
float
predict
(
int
sampleIdx
,
bool
returnSum
=
false
)
const
;
float
getThreshold
()
const
{
return
threshold
;
}
;
float
getThreshold
()
const
{
return
threshold
;
}
void
write
(
FileStorage
&
fs
,
const
Mat
&
featureMap
)
const
;
bool
read
(
const
FileNode
&
node
,
const
CvFeatureEvaluator
*
_featureEvaluator
,
const
CvCascadeBoostParams
&
_params
);
...
...
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