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
15f7918e
Commit
15f7918e
authored
May 11, 2011
by
P. Druzhkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
problem with the supported data matrices types is fixed
minor fixes in CvGBTrees, its test and sample
parent
6a03be26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
ml.hpp
modules/ml/include/opencv2/ml/ml.hpp
+1
-0
gbt.cpp
modules/ml/src/gbt.cpp
+0
-0
test_gbttest.cpp
modules/ml/test/test_gbttest.cpp
+21
-3
points_classifier.cpp
samples/cpp/points_classifier.cpp
+2
-3
No files found.
modules/ml/include/opencv2/ml/ml.hpp
View file @
15f7918e
...
@@ -1832,6 +1832,7 @@ protected:
...
@@ -1832,6 +1832,7 @@ protected:
// RESULT
// RESULT
*/
*/
virtual
void
read_params
(
CvFileStorage
*
fs
,
CvFileNode
*
fnode
);
virtual
void
read_params
(
CvFileStorage
*
fs
,
CvFileNode
*
fnode
);
int
get_len
(
const
CvMat
*
mat
)
const
;
CvDTreeTrainData
*
data
;
CvDTreeTrainData
*
data
;
...
...
modules/ml/src/gbt.cpp
View file @
15f7918e
This diff is collapsed.
Click to expand it.
modules/ml/test/test_gbttest.cpp
View file @
15f7918e
...
@@ -25,6 +25,7 @@ protected:
...
@@ -25,6 +25,7 @@ protected:
string
model_file_name1
;
string
model_file_name1
;
string
model_file_name2
;
string
model_file_name2
;
string
*
datasets
;
string
*
datasets
;
string
data_path
;
string
data_path
;
...
@@ -33,6 +34,8 @@ protected:
...
@@ -33,6 +34,8 @@ protected:
vector
<
float
>
test_resps1
;
vector
<
float
>
test_resps1
;
vector
<
float
>
test_resps2
;
vector
<
float
>
test_resps2
;
int64
initSeed
;
};
};
...
@@ -44,6 +47,18 @@ int _get_len(const CvMat* mat)
...
@@ -44,6 +47,18 @@ int _get_len(const CvMat* mat)
CV_GBTreesTest
::
CV_GBTreesTest
()
CV_GBTreesTest
::
CV_GBTreesTest
()
{
{
int64
seeds
[]
=
{
CV_BIG_INT
(
0x00009fff4f9c8d52
),
CV_BIG_INT
(
0x0000a17166072c7c
),
CV_BIG_INT
(
0x0201b32115cd1f9a
),
CV_BIG_INT
(
0x0513cb37abcd1234
),
CV_BIG_INT
(
0x0001a2b3c4d5f678
)
};
int
seedCount
=
sizeof
(
seeds
)
/
sizeof
(
seeds
[
0
]);
cv
::
RNG
&
rng
=
cv
::
theRNG
();
initSeed
=
rng
.
state
;
rng
.
state
=
seeds
[
rng
(
seedCount
)];
datasets
=
0
;
datasets
=
0
;
data
=
0
;
data
=
0
;
gtb
=
0
;
gtb
=
0
;
...
@@ -54,6 +69,7 @@ CV_GBTreesTest::~CV_GBTreesTest()
...
@@ -54,6 +69,7 @@ CV_GBTreesTest::~CV_GBTreesTest()
if
(
data
)
if
(
data
)
delete
data
;
delete
data
;
delete
[]
datasets
;
delete
[]
datasets
;
cv
::
theRNG
().
state
=
initSeed
;
}
}
...
@@ -65,7 +81,7 @@ int CV_GBTreesTest::TestTrainPredict(int test_num)
...
@@ -65,7 +81,7 @@ int CV_GBTreesTest::TestTrainPredict(int test_num)
float
shrinkage
=
0.1
f
;
float
shrinkage
=
0.1
f
;
float
subsample_portion
=
0.5
f
;
float
subsample_portion
=
0.5
f
;
int
max_depth
=
5
;
int
max_depth
=
5
;
bool
use_surrogates
=
tru
e
;
bool
use_surrogates
=
fals
e
;
int
loss_function_type
=
0
;
int
loss_function_type
=
0
;
switch
(
test_num
)
switch
(
test_num
)
{
{
...
@@ -137,8 +153,10 @@ int CV_GBTreesTest::checkPredictError(int test_num)
...
@@ -137,8 +153,10 @@ int CV_GBTreesTest::checkPredictError(int test_num)
if
(
!
gtb
)
if
(
!
gtb
)
return
cvtest
::
TS
::
FAIL_GENERIC
;
return
cvtest
::
TS
::
FAIL_GENERIC
;
float
mean
[]
=
{
5.430247
f
,
13.5654
f
,
12.6569
f
,
13.1661
f
};
//float mean[] = {5.430247f, 13.5654f, 12.6569f, 13.1661f};
float
sigma
[]
=
{
0.4162694
f
,
3.21161
f
,
3.43297
f
,
3.00624
f
};
//float sigma[] = {0.4162694f, 3.21161f, 3.43297f, 3.00624f};
float
mean
[]
=
{
5.80226
f
,
12.68689
f
,
13.49095
f
,
13.19628
f
};
float
sigma
[]
=
{
0.4764534
f
,
3.166919
f
,
3.022405
f
,
2.868722
f
};
float
current_error
=
gtb
->
calc_error
(
data
,
CV_TEST_ERROR
);
float
current_error
=
gtb
->
calc_error
(
data
,
CV_TEST_ERROR
);
...
...
samples/cpp/points_classifier.cpp
View file @
15f7918e
...
@@ -22,9 +22,9 @@ vector<Scalar> classColors;
...
@@ -22,9 +22,9 @@ vector<Scalar> classColors;
#define NBC 0 // normal Bayessian classifier
#define NBC 0 // normal Bayessian classifier
#define KNN 0 // k nearest neighbors classifier
#define KNN 0 // k nearest neighbors classifier
#define SVM 0 // support vectors machine
#define SVM 0 // support vectors machine
#define DT
1
// decision tree
#define DT
0
// decision tree
#define BT 0 // ADA Boost
#define BT 0 // ADA Boost
#define GBT
0
// gradient boosted trees
#define GBT
1
// gradient boosted trees
#define RF 0 // random forest
#define RF 0 // random forest
#define ERT 0 // extremely randomized trees
#define ERT 0 // extremely randomized trees
#define ANN 0 // artificial neural networks
#define ANN 0 // artificial neural networks
...
@@ -272,7 +272,6 @@ void find_decision_boundary_GBT()
...
@@ -272,7 +272,6 @@ void find_decision_boundary_GBT()
Mat
trainSamples
,
trainClasses
;
Mat
trainSamples
,
trainClasses
;
prepare_train_data
(
trainSamples
,
trainClasses
);
prepare_train_data
(
trainSamples
,
trainClasses
);
trainClasses
.
convertTo
(
trainClasses
,
CV_32FC1
);
// learn classifier
// learn classifier
CvGBTrees
gbtrees
;
CvGBTrees
gbtrees
;
...
...
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