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
ed934ed6
Commit
ed934ed6
authored
Dec 06, 2010
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed GBTrees build on NetBSD & Android; fixed GPU brute force matcher test build on MacOSX
parent
652fb121
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
23 deletions
+20
-23
gbt.cpp
modules/ml/src/gbt.cpp
+11
-15
brute_force_matcher.cpp
tests/gpu/src/brute_force_matcher.cpp
+9
-8
No files found.
modules/ml/src/gbt.cpp
View file @
ed934ed6
...
...
@@ -11,10 +11,6 @@ using namespace std;
#define CV_CMP_FLOAT(a,b) ((a) < (b))
static
CV_IMPLEMENT_QSORT_EX
(
icvSortFloat
,
float
,
CV_CMP_FLOAT
,
float
)
#if ANDROID
#define expl(x) exp(x)
#endif
//===========================================================================
string
ToString
(
int
i
)
{
...
...
@@ -461,17 +457,17 @@ void CvGBTrees::find_gradient(const int k)
{
for
(
int
i
=
0
;
i
<
get_len
(
subsample_train
);
++
i
)
{
long
double
exp_fk
=
0
;
long
double
exp_sfi
=
0
;
double
exp_fk
=
0
;
double
exp_sfi
=
0
;
int
s_step
=
(
sample_idx
->
cols
>
sample_idx
->
rows
)
?
1
:
sample_idx
->
step
/
CV_ELEM_SIZE
(
sample_idx
->
type
);
int
idx
=
*
(
sample_data
+
subsample_data
[
i
]
*
s_step
);
for
(
int
j
=
0
;
j
<
class_count
;
++
j
)
{
long
double
res
;
double
res
;
res
=
current_data
[
idx
+
j
*
sum_response
->
cols
];
res
=
exp
l
(
res
);
res
=
exp
(
res
);
if
(
j
==
k
)
exp_fk
=
res
;
exp_sfi
+=
res
;
}
...
...
@@ -625,7 +621,7 @@ void CvGBTrees::change_values(CvDTree* tree, const int _k)
float
CvGBTrees
::
find_optimal_value
(
const
CvMat
*
_Idx
)
{
long
double
gamma
=
(
long
double
)
0.0
;
double
gamma
=
(
double
)
0.0
;
int
*
idx
=
_Idx
->
data
.
i
;
float
*
resp_data
=
orig_response
->
data
.
fl
;
...
...
@@ -639,7 +635,7 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx )
{
for
(
int
i
=
0
;
i
<
n
;
++
i
)
gamma
+=
resp_data
[
idx
[
i
]]
-
cur_data
[
idx
[
i
]];
gamma
/=
(
long
double
)
n
;
gamma
/=
(
double
)
n
;
};
break
;
case
ABSOLUTE_LOSS
:
...
...
@@ -671,7 +667,7 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx )
float
dif
=
residuals
[
i
]
-
r_median
;
gamma
+=
(
delta
<
fabs
(
dif
))
?
Sign
(
dif
)
*
delta
:
dif
;
}
gamma
/=
(
long
double
)
n
;
gamma
/=
(
double
)
n
;
gamma
+=
r_median
;
delete
[]
residuals
;
...
...
@@ -680,9 +676,9 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx )
case
DEVIANCE_LOSS
:
{
float
*
grad_data
=
data
->
responses
->
data
.
fl
;
long
double
tmp1
=
0
;
long
double
tmp2
=
0
;
long
double
tmp
=
0
;
double
tmp1
=
0
;
double
tmp2
=
0
;
double
tmp
=
0
;
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
tmp
=
grad_data
[
idx
[
i
]];
...
...
@@ -694,7 +690,7 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx )
tmp2
=
1
;
}
gamma
=
((
long
double
)(
class_count
-
1
))
/
(
long
double
)
class_count
*
(
tmp1
/
tmp2
);
gamma
=
((
double
)(
class_count
-
1
))
/
(
double
)
class_count
*
(
tmp1
/
tmp2
);
};
break
;
default
:
break
;
...
...
tests/gpu/src/brute_force_matcher.cpp
View file @
ed934ed6
...
...
@@ -40,6 +40,7 @@
//M*/
#include "gputest.hpp"
#include <algorithm>
using
namespace
cv
;
using
namespace
cv
::
gpu
;
...
...
@@ -149,19 +150,19 @@ private:
copy
(
knnMatches
[
i
].
begin
(),
knnMatches
[
i
].
end
(),
back_inserter
(
matches
));
}
struct
DMatchEqual
:
public
binary_function
<
DMatch
,
DMatch
,
bool
>
{
bool
operator
()(
const
DMatch
&
m1
,
const
DMatch
&
m2
)
const
{
return
m1
.
imgIdx
==
m2
.
imgIdx
&&
m1
.
queryIdx
==
m2
.
queryIdx
&&
m1
.
trainIdx
==
m2
.
trainIdx
;
}
};
static
bool
compareMatches
(
const
vector
<
DMatch
>&
matches1
,
const
vector
<
DMatch
>&
matches2
)
{
if
(
matches1
.
size
()
!=
matches2
.
size
())
return
false
;
struct
DMatchEqual
:
public
binary_function
<
DMatch
,
DMatch
,
bool
>
{
bool
operator
()(
const
DMatch
&
m1
,
const
DMatch
&
m2
)
{
return
m1
.
imgIdx
==
m2
.
imgIdx
&&
m1
.
queryIdx
==
m2
.
queryIdx
&&
m1
.
trainIdx
==
m2
.
trainIdx
;
}
};
return
equal
(
matches1
.
begin
(),
matches1
.
end
(),
matches2
.
begin
(),
DMatchEqual
());
}
...
...
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