Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
048f40dc
Commit
048f40dc
authored
7 years ago
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
3f8eeccb
deccc99c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
103 additions
and
44 deletions
+103
-44
CMakeLists.txt
dlib/CMakeLists.txt
+4
-4
object_detector_abstract.h
dlib/image_processing/object_detector_abstract.h
+1
-1
statistics.h
dlib/statistics/statistics.h
+14
-14
statistics_abstract.h
dlib/statistics/statistics_abstract.h
+8
-8
statistics.cpp
dlib/test/statistics.cpp
+72
-6
howto_contribute.xml
docs/docs/howto_contribute.xml
+3
-10
setup.py
setup.py
+1
-1
No files found.
dlib/CMakeLists.txt
View file @
048f40dc
...
...
@@ -816,10 +816,10 @@ if (MSVC)
# what happens since, at the very least, the filenames will indicate what
# visual studio runtime they go with.
math
(
EXPR numbits
${
CMAKE_SIZEOF_VOID_P
}
*8
)
set_target_properties
(
dlib PROPERTIES DEBUG_POSTFIX
"_debug_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES RELEASE_POSTFIX
"_release_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES MINSIZEREL_POSTFIX
"_minsizerel_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES RELWITHDEBINFO_POSTFIX
"_relwithdebinfo_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES DEBUG_POSTFIX
"
${
VERSION
}
_debug_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES RELEASE_POSTFIX
"
${
VERSION
}
_release_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES MINSIZEREL_POSTFIX
"
${
VERSION
}
_minsizerel_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
set_target_properties
(
dlib PROPERTIES RELWITHDEBINFO_POSTFIX
"
${
VERSION
}
_relwithdebinfo_
${
numbits
}
bit_msvc
${
MSVC_VERSION
}
"
)
endif
()
add_library
(
dlib::dlib ALIAS dlib
)
This diff is collapsed.
Click to expand it.
dlib/image_processing/object_detector_abstract.h
View file @
048f40dc
...
...
@@ -185,7 +185,7 @@ namespace dlib
)
const
;
/*!
requires
- idx < num_detectors
- idx < num_detectors
()
ensures
- returns the idx-th weight vector loaded into this object. All the weight vectors
have the same dimension and logically each represents a different detector.
...
...
This diff is collapsed.
Click to expand it.
dlib/statistics/statistics.h
View file @
048f40dc
...
...
@@ -499,7 +499,7 @@ namespace dlib
sum_x
=
sum_x
*
forget
+
x
;
sum_y
=
sum_y
*
forget
+
y
;
n
=
n
*
forget
+
forget
;
n
=
n
*
forget
+
1
;
}
T
current_n
(
...
...
@@ -530,20 +530,20 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_scalar_covariance_decayed::covariance()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
);
return
1
/
n
*
(
sum_xy
-
sum_y
*
sum_x
/
n
);
return
1
/
(
n
-
1
)
*
(
sum_xy
-
sum_y
*
sum_x
/
n
);
}
T
correlation
(
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_scalar_covariance_decayed::correlation()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
...
...
@@ -560,13 +560,13 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_scalar_covariance_decayed::variance_x()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
);
T
temp
=
1
/
n
*
(
sum_xx
-
sum_x
*
sum_x
/
n
);
T
temp
=
1
/
(
n
-
1
)
*
(
sum_xx
-
sum_x
*
sum_x
/
n
);
// make sure the variance is never negative. This might
// happen due to numerical errors.
if
(
temp
>=
0
)
...
...
@@ -579,13 +579,13 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_scalar_covariance_decayed::variance_y()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
);
T
temp
=
1
/
n
*
(
sum_yy
-
sum_y
*
sum_y
/
n
);
T
temp
=
1
/
(
n
-
1
)
*
(
sum_yy
-
sum_y
*
sum_y
/
n
);
// make sure the variance is never negative. This might
// happen due to numerical errors.
if
(
temp
>=
0
)
...
...
@@ -598,7 +598,7 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_scalar_covariance_decayed::stddev_x()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
...
...
@@ -611,7 +611,7 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_scalar_covariance_decayed::stddev_y()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
...
...
@@ -673,7 +673,7 @@ namespace dlib
sum_x
=
sum_x
*
forget
+
x
;
n
=
n
*
forget
+
forget
;
n
=
n
*
forget
+
1
;
}
T
current_n
(
...
...
@@ -695,13 +695,13 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_stats_decayed::variance()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
);
T
temp
=
1
/
n
*
(
sum_xx
-
sum_x
*
sum_x
/
n
);
T
temp
=
1
/
(
n
-
1
)
*
(
sum_xx
-
sum_x
*
sum_x
/
n
);
// make sure the variance is never negative. This might
// happen due to numerical errors.
if
(
temp
>=
0
)
...
...
@@ -714,7 +714,7 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_n
()
>
0
,
DLIB_ASSERT
(
current_n
()
>
1
,
"
\t
T running_stats_decayed::stddev()"
<<
"
\n\t
you have to add some numbers to this object first"
<<
"
\n\t
this: "
<<
this
...
...
This diff is collapsed.
Click to expand it.
dlib/statistics/statistics_abstract.h
View file @
048f40dc
...
...
@@ -570,7 +570,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the covariance between all the x and y samples presented
to this object via add()
...
...
@@ -580,7 +580,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the correlation coefficient between all the x and y samples
presented to this object via add()
...
...
@@ -590,7 +590,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the sample variance value of all x samples presented
to this object via add().
...
...
@@ -600,7 +600,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the sample variance value of all y samples presented
to this object via add().
...
...
@@ -610,7 +610,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the sample standard deviation of all x samples
presented to this object via add().
...
...
@@ -620,7 +620,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the sample standard deviation of all y samples
presented to this object via add().
...
...
@@ -703,7 +703,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the sample variance value of all x samples presented to this
object via add().
...
...
@@ -713,7 +713,7 @@ namespace dlib
)
const
;
/*!
requires
- current_n() >
0
- current_n() >
1
ensures
- returns the sample standard deviation of all x samples presented to this
object via add().
...
...
This diff is collapsed.
Click to expand it.
dlib/test/statistics.cpp
View file @
048f40dc
...
...
@@ -340,14 +340,12 @@ namespace
DLIB_TEST
(
std
::
abs
(
rsc2
.
correlation
()
-
0
)
<
1e-10
);
const
double
s
=
99
/
100.0
;
const
double
ss
=
std
::
sqrt
(
s
);;
DLIB_TEST_MSG
(
std
::
abs
(
rs
.
mean
()
-
rscd1
.
mean_x
())
<
1e-2
,
std
::
abs
(
rs
.
mean
()
-
rscd1
.
mean_x
())
<<
" "
<<
rscd1
.
mean_x
());
DLIB_TEST
(
std
::
abs
(
rs
.
mean
()
-
rscd1
.
mean_y
())
<
1e-2
);
DLIB_TEST_MSG
(
std
::
abs
(
ss
*
rs
.
stddev
()
-
rscd1
.
stddev_x
())
<
1e-2
,
std
::
abs
(
ss
*
rs
.
stddev
()
-
rscd1
.
stddev_x
()));
DLIB_TEST
(
std
::
abs
(
ss
*
rs
.
stddev
()
-
rscd1
.
stddev_y
())
<
1e-2
);
DLIB_TEST_MSG
(
std
::
abs
(
s
*
rs
.
variance
()
-
rscd1
.
variance_x
())
<
1e-2
,
std
::
abs
(
s
*
rs
.
variance
()
-
rscd1
.
variance_x
()));
DLIB_TEST
(
std
::
abs
(
s
*
rs
.
variance
()
-
rscd1
.
variance_y
())
<
1e-2
);
DLIB_TEST_MSG
(
std
::
abs
(
rs
.
stddev
()
-
rscd1
.
stddev_x
())
<
1e-2
,
std
::
abs
(
rs
.
stddev
()
-
rscd1
.
stddev_x
()));
DLIB_TEST
(
std
::
abs
(
rs
.
stddev
()
-
rscd1
.
stddev_y
())
<
1e-2
);
DLIB_TEST_MSG
(
std
::
abs
(
rs
.
variance
()
-
rscd1
.
variance_x
())
<
1e-2
,
std
::
abs
(
rs
.
variance
()
-
rscd1
.
variance_x
()));
DLIB_TEST
(
std
::
abs
(
rs
.
variance
()
-
rscd1
.
variance_y
())
<
1e-2
);
DLIB_TEST
(
std
::
abs
(
rscd1
.
correlation
()
-
1
)
<
1e-2
);
DLIB_TEST
(
std
::
abs
(
rscd2
.
correlation
()
-
0
)
<
1e-2
);
...
...
@@ -803,6 +801,72 @@ namespace
DLIB_TEST
(
equal_error_rate
(
vals2
,
vals1
).
first
==
1
);
}
void
test_running_stats_decayed
()
{
print_spinner
();
std
::
vector
<
double
>
tmp
(
300
);
std
::
vector
<
double
>
tmp_var
(
tmp
.
size
());
dlib
::
rand
rnd
;
const
int
num_rounds
=
100000
;
for
(
int
rounds
=
0
;
rounds
<
num_rounds
;
++
rounds
)
{
running_stats_decayed
<
double
>
rs
(
100
);
for
(
size_t
i
=
0
;
i
<
tmp
.
size
();
++
i
)
{
rs
.
add
(
rnd
.
get_random_gaussian
()
+
1
);
tmp
[
i
]
+=
rs
.
mean
();
if
(
i
>
0
)
tmp_var
[
i
]
+=
rs
.
variance
();
}
}
// should print all 1s basically since the mean and variance should always be 1.
for
(
size_t
i
=
0
;
i
<
tmp
.
size
();
++
i
)
{
DLIB_TEST
(
std
::
abs
(
1
-
tmp
[
i
]
/
num_rounds
)
<
0.001
);
if
(
i
>
1
)
DLIB_TEST
(
std
::
abs
(
1
-
tmp_var
[
i
]
/
num_rounds
)
<
0.01
);
}
}
void
test_running_scalar_covariance_decayed
()
{
print_spinner
();
std
::
vector
<
double
>
tmp
(
300
);
std
::
vector
<
double
>
tmp_var
(
tmp
.
size
());
std
::
vector
<
double
>
tmp_covar
(
tmp
.
size
());
dlib
::
rand
rnd
;
const
int
num_rounds
=
500000
;
for
(
int
rounds
=
0
;
rounds
<
num_rounds
;
++
rounds
)
{
running_scalar_covariance_decayed
<
double
>
rs
(
100
);
for
(
size_t
i
=
0
;
i
<
tmp
.
size
();
++
i
)
{
rs
.
add
(
rnd
.
get_random_gaussian
()
+
1
,
rnd
.
get_random_gaussian
()
+
1
);
tmp
[
i
]
+=
(
rs
.
mean_y
()
+
rs
.
mean_x
())
/
2
;
if
(
i
>
0
)
{
tmp_var
[
i
]
+=
(
rs
.
variance_y
()
+
rs
.
variance_x
())
/
2
;
tmp_covar
[
i
]
+=
rs
.
covariance
();
}
}
}
// should print all 1s basically since the mean and variance should always be 1.
for
(
size_t
i
=
0
;
i
<
tmp
.
size
();
++
i
)
{
DLIB_TEST
(
std
::
abs
(
1
-
tmp
[
i
]
/
num_rounds
)
<
0.001
);
if
(
i
>
1
)
{
DLIB_TEST
(
std
::
abs
(
1
-
tmp_var
[
i
]
/
num_rounds
)
<
0.01
);
DLIB_TEST
(
std
::
abs
(
tmp_covar
[
i
]
/
num_rounds
)
<
0.001
);
}
}
}
void
test_event_corr
()
{
print_spinner
();
...
...
@@ -841,6 +905,8 @@ namespace
test_average_precision
();
test_lda
();
test_event_corr
();
test_running_stats_decayed
();
test_running_scalar_covariance_decayed
();
}
}
a
;
...
...
This diff is collapsed.
Click to expand it.
docs/docs/howto_contribute.xml
View file @
048f40dc
...
...
@@ -13,17 +13,10 @@
<!-- **************************** EASY CONTRIBUTIONS **************************** -->
There are some simple ways to contribute to dlib:
<h2>
Contributing Money
</h2>
<ul>
<li>
Find confusing or incorrect documentation
</li>
<li>
Help make the web page prettier
</li>
<li>
Link to dlib from your web page
</li>
<li>
Add yourself or your project to the list of
<a
href=
"http://sourceforge.net/p/dclib/wiki/Known_users/"
>
dlib users
</a>
</li>
<li>
Try to run the dlib regression test suite on any platforms you
have access to
</li>
</ul>
The simplest way to contribute is to donate money via Zelle or PayPal
to davis@dlib.net. Any amount is appreciated :)
<!-- **************************** CODE CONTRIBUTIONS **************************** -->
<h2>
Contributing Code
</h2>
...
...
This diff is collapsed.
Click to expand it.
setup.py
View file @
048f40dc
...
...
@@ -185,7 +185,7 @@ class PyTest(TestCommand):
def
initialize_options
(
self
):
TestCommand
.
initialize_options
(
self
)
self
.
pytest_args
=
''
self
.
pytest_args
=
'
--ignore docs --ignore dlib
'
def
run_tests
(
self
):
import
shlex
...
...
This diff is collapsed.
Click to expand it.
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