Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
5e4350ca
Commit
5e4350ca
authored
Feb 05, 2016
by
Davis King
Browse files
merged
parents
12448595
a3dad7ac
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
5 deletions
+120
-5
dlib/CMakeLists.txt
dlib/CMakeLists.txt
+1
-0
dlib/geometry/drectangle.h
dlib/geometry/drectangle.h
+13
-0
dlib/geometry/drectangle_abstract.h
dlib/geometry/drectangle_abstract.h
+19
-0
dlib/smart_pointers/shared_ptr.h
dlib/smart_pointers/shared_ptr.h
+2
-2
dlib/smart_pointers/shared_ptr_thread_safe.h
dlib/smart_pointers/shared_ptr_thread_safe.h
+2
-2
tools/python/CMakeLists.txt
tools/python/CMakeLists.txt
+2
-0
tools/python/src/dlib.cpp
tools/python/src/dlib.cpp
+5
-0
tools/python/src/rectangles.cpp
tools/python/src/rectangles.cpp
+4
-0
tools/python/src/shape_predictor.cpp
tools/python/src/shape_predictor.cpp
+3
-1
tools/python/src/shape_predictor.h
tools/python/src/shape_predictor.h
+69
-0
No files found.
dlib/CMakeLists.txt
View file @
5e4350ca
...
...
@@ -16,6 +16,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "18")
set
(
CPACK_PACKAGE_VERSION_MINOR
"18"
)
set
(
CPACK_PACKAGE_VERSION_PATCH
"99"
)
set
(
VERSION
${
CPACK_PACKAGE_VERSION_MAJOR
}
.
${
CPACK_PACKAGE_VERSION_MINOR
}
.
${
CPACK_PACKAGE_VERSION_PATCH
}
)
set
(
DLIB_VERSION
${
VERSION
}
PARENT_SCOPE
)
set
(
CMAKE_LEGACY_CYGWIN_WIN32 0
)
# Remove when CMake >= 2.8.4 is required
# Suppress cmake warnings about changes in new versions.
...
...
dlib/geometry/drectangle.h
View file @
5e4350ca
...
...
@@ -195,6 +195,19 @@ namespace dlib
return
*
this
;
}
bool
operator
==
(
const
drectangle
&
rect
)
const
{
return
(
l
==
rect
.
l
)
&&
(
t
==
rect
.
t
)
&&
(
r
==
rect
.
r
)
&&
(
b
==
rect
.
b
);
}
bool
operator
!=
(
const
drectangle
&
rect
)
const
{
return
!
(
*
this
==
rect
);
}
private:
double
l
;
...
...
dlib/geometry/drectangle_abstract.h
View file @
5e4350ca
...
...
@@ -319,6 +319,25 @@ namespace dlib
- returns #*this
!*/
bool
operator
==
(
const
drectangle
&
rect
)
const
;
/*!
ensures
- if (top() == rect.top() && left() == rect.left() &&
right() == rect.right() && bottom() == rect.bottom()) then
- returns true
- else
- returns false
!*/
bool
operator
!=
(
const
drectangle
&
rect
)
const
;
/*!
ensures
- returns !(*this == rect)
!*/
};
// ----------------------------------------------------------------------------------------
...
...
dlib/smart_pointers/shared_ptr.h
View file @
5e4350ca
...
...
@@ -12,7 +12,7 @@
// Don't warn about the use of std::auto_ptr in this file. There is a pragma at the end of
// this file that re-enables the warning.
#ifdef
__GNUC__
#if
def
ined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
...
...
@@ -527,7 +527,7 @@ namespace dlib
}
#ifdef
__GNUC__
#if
def
ined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
#pragma GCC diagnostic pop
#endif
...
...
dlib/smart_pointers/shared_ptr_thread_safe.h
View file @
5e4350ca
...
...
@@ -13,7 +13,7 @@
// Don't warn about the use of std::auto_ptr in this file. There is a pragma at the end of
// this file that re-enables the warning.
#ifdef
__GNUC__
#if
def
ined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
...
...
@@ -497,7 +497,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
#ifdef
__GNUC__
#if
def
ined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
#pragma GCC diagnostic pop
#endif
...
...
tools/python/CMakeLists.txt
View file @
5e4350ca
...
...
@@ -5,6 +5,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
set
(
USE_SSE4_INSTRUCTIONS ON CACHE BOOL
"Use SSE4 instructions"
)
include
(
../../dlib/add_python_module
)
add_definitions
(
-DDLIB_VERSION=
${
DLIB_VERSION
}
)
# Tell cmake to compile all these cpp files into a dlib python module.
set
(
python_srcs
src/dlib.cpp
...
...
tools/python/src/dlib.cpp
View file @
5e4350ca
...
...
@@ -29,6 +29,11 @@ BOOST_PYTHON_MODULE(dlib)
// since it is full of huge amounts of template clutter.
boost
::
python
::
docstring_options
options
(
true
,
true
,
false
);
#define DLIB_QUOTE_STRING(x) DLIB_QUOTE_STRING2(x)
#define DLIB_QUOTE_STRING2(x) #x
boost
::
python
::
scope
().
attr
(
"__version__"
)
=
DLIB_QUOTE_STRING
(
DLIB_VERSION
);
bind_matrix
();
bind_vector
();
bind_svm_c_trainer
();
...
...
tools/python/src/rectangles.cpp
View file @
5e4350ca
...
...
@@ -90,6 +90,8 @@ void bind_rectangles()
.
def
(
"intersect"
,
&::
intersect
<
type
>
,
(
arg
(
"rectangle"
)))
.
def
(
"__str__"
,
&::
print_rectangle_str
<
type
>
)
.
def
(
"__repr__"
,
&::
print_rectangle_repr
<
type
>
)
.
def
(
self
==
self
)
.
def
(
self
!=
self
)
.
def_pickle
(
serialize_pickle
<
type
>
());
}
{
...
...
@@ -112,6 +114,8 @@ void bind_rectangles()
.
def
(
"intersect"
,
&::
intersect
<
type
>
,
(
arg
(
"rectangle"
)))
.
def
(
"__str__"
,
&::
print_rectangle_str
<
type
>
)
.
def
(
"__repr__"
,
&::
print_rectangle_repr
<
type
>
)
.
def
(
self
==
self
)
.
def
(
self
!=
self
)
.
def_pickle
(
serialize_pickle
<
type
>
());
}
{
...
...
tools/python/src/shape_predictor.cpp
View file @
5e4350ca
...
...
@@ -210,7 +210,9 @@ void bind_shape_predictors()
e.g a padding of 0.5 would cause the algorithm to sample pixels from a box that was 2x2 pixels"
)
.
add_property
(
"random_seed"
,
&
type
::
random_seed
,
&
type
::
random_seed
,
"The random seed used by the internal random number generator"
);
"The random seed used by the internal random number generator"
)
.
def
(
"__str__"
,
&::
print_shape_predictor_training_options
)
.
def_pickle
(
serialize_pickle
<
type
>
());
}
{
typedef
shape_predictor
type
;
...
...
tools/python/src/shape_predictor.h
View file @
5e4350ca
...
...
@@ -45,6 +45,75 @@ namespace dlib
std
::
string
random_seed
;
};
inline
void
serialize
(
const
shape_predictor_training_options
&
item
,
std
::
ostream
&
out
)
{
try
{
serialize
(
item
.
be_verbose
,
out
);
serialize
(
item
.
cascade_depth
,
out
);
serialize
(
item
.
tree_depth
,
out
);
serialize
(
item
.
num_trees_per_cascade_level
,
out
);
serialize
(
item
.
nu
,
out
);
serialize
(
item
.
oversampling_amount
,
out
);
serialize
(
item
.
feature_pool_size
,
out
);
serialize
(
item
.
lambda_param
,
out
);
serialize
(
item
.
num_test_splits
,
out
);
serialize
(
item
.
feature_pool_region_padding
,
out
);
serialize
(
item
.
random_seed
,
out
);
}
catch
(
serialization_error
&
e
)
{
throw
serialization_error
(
e
.
info
+
"
\n
while serializing an object of type shape_predictor_training_options"
);
}
}
inline
void
deserialize
(
shape_predictor_training_options
&
item
,
std
::
istream
&
in
)
{
try
{
deserialize
(
item
.
be_verbose
,
in
);
deserialize
(
item
.
cascade_depth
,
in
);
deserialize
(
item
.
tree_depth
,
in
);
deserialize
(
item
.
num_trees_per_cascade_level
,
in
);
deserialize
(
item
.
nu
,
in
);
deserialize
(
item
.
oversampling_amount
,
in
);
deserialize
(
item
.
feature_pool_size
,
in
);
deserialize
(
item
.
lambda_param
,
in
);
deserialize
(
item
.
num_test_splits
,
in
);
deserialize
(
item
.
feature_pool_region_padding
,
in
);
deserialize
(
item
.
random_seed
,
in
);
}
catch
(
serialization_error
&
e
)
{
throw
serialization_error
(
e
.
info
+
"
\n
while deserializing an object of type shape_predictor_training_options"
);
}
}
string
print_shape_predictor_training_options
(
const
shape_predictor_training_options
&
o
)
{
std
::
ostringstream
sout
;
sout
<<
"shape_predictor_training_options("
<<
"be_verbose="
<<
o
.
be_verbose
<<
","
<<
"cascade_depth="
<<
o
.
cascade_depth
<<
","
<<
"tree_depth="
<<
o
.
tree_depth
<<
","
<<
"num_trees_per_cascade_level="
<<
o
.
num_trees_per_cascade_level
<<
","
<<
"nu="
<<
o
.
nu
<<
","
<<
"oversampling_amount="
<<
o
.
oversampling_amount
<<
","
<<
"feature_pool_size="
<<
o
.
feature_pool_size
<<
","
<<
"lambda_param="
<<
o
.
lambda_param
<<
","
<<
"num_test_splits="
<<
o
.
num_test_splits
<<
","
<<
"feature_pool_region_padding="
<<
o
.
feature_pool_region_padding
<<
","
<<
"random_seed="
<<
o
.
random_seed
<<
")"
;
return
sout
.
str
();
}
// ----------------------------------------------------------------------------------------
namespace
impl
...
...
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