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
3e9d361f
Commit
3e9d361f
authored
Nov 20, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes to avoid bugs in some compilers.
parent
9ff91169
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
24 deletions
+24
-24
decision_functions.cpp
tools/python/src/decision_functions.cpp
+1
-1
face_recognition.cpp
tools/python/src/face_recognition.cpp
+5
-5
global_optimization.cpp
tools/python/src/global_optimization.cpp
+7
-7
gui.cpp
tools/python/src/gui.cpp
+1
-1
image2.cpp
tools/python/src/image2.cpp
+2
-2
image4.cpp
tools/python/src/image4.cpp
+1
-1
image_dataset_metadata.cpp
tools/python/src/image_dataset_metadata.cpp
+4
-4
numpy_returns.cpp
tools/python/src/numpy_returns.cpp
+2
-2
shape_predictor.cpp
tools/python/src/shape_predictor.cpp
+1
-1
No files found.
tools/python/src/decision_functions.cpp
View file @
3e9d361f
...
...
@@ -122,7 +122,7 @@ std::vector<double> normalized_predict_vec (
{
std
::
vector
<
double
>
out
;
out
.
reserve
(
samps
.
size
());
for
(
auto
&
x
:
samps
)
for
(
const
auto
&
x
:
samps
)
out
.
push_back
(
normalized_predict
(
df
,
x
));
return
out
;
}
...
...
tools/python/src/face_recognition.cpp
View file @
3e9d361f
...
...
@@ -64,10 +64,10 @@ public:
throw
dlib
::
error
(
"The array of images and the array of array of locations must be of the same size"
);
int
total_chips
=
0
;
for
(
auto
&
faces
:
batch_faces
)
for
(
const
auto
&
faces
:
batch_faces
)
{
total_chips
+=
faces
.
size
();
for
(
auto
&
f
:
faces
)
for
(
const
auto
&
f
:
faces
)
{
if
(
f
.
num_parts
()
!=
68
&&
f
.
num_parts
()
!=
5
)
throw
dlib
::
error
(
"The full_object_detection must use the iBUG 300W 68 point face landmark style or dlib's 5 point style."
);
...
...
@@ -82,7 +82,7 @@ public:
auto
&
img
=
batch_imgs
[
i
];
std
::
vector
<
chip_details
>
dets
;
for
(
auto
&
f
:
faces
)
for
(
const
auto
&
f
:
faces
)
dets
.
push_back
(
get_face_chip_details
(
f
,
150
,
0.25
));
dlib
::
array
<
matrix
<
rgb_pixel
>>
this_img_face_chips
;
extract_image_chips
(
img
,
dets
,
this_img_face_chips
);
...
...
@@ -214,12 +214,12 @@ void save_face_chips (
int
num_faces
=
faces
.
size
();
std
::
vector
<
chip_details
>
dets
;
for
(
auto
&
f
:
faces
)
for
(
const
auto
&
f
:
faces
)
dets
.
push_back
(
get_face_chip_details
(
f
,
size
,
padding
));
dlib
::
array
<
matrix
<
rgb_pixel
>>
face_chips
;
extract_image_chips
(
numpy_image
<
rgb_pixel
>
(
img
),
dets
,
face_chips
);
int
i
=
0
;
for
(
auto
&
chip
:
face_chips
)
for
(
const
auto
&
chip
:
face_chips
)
{
i
++
;
if
(
num_faces
>
1
)
...
...
tools/python/src/global_optimization.cpp
View file @
3e9d361f
...
...
@@ -203,7 +203,7 @@ std::shared_ptr<global_function_search> py_global_function_search1 (
)
{
std
::
vector
<
function_spec
>
tmp
;
for
(
auto
i
:
functions
)
for
(
const
auto
&
i
:
functions
)
tmp
.
emplace_back
(
i
.
cast
<
function_spec
>
());
return
std
::
make_shared
<
global_function_search
>
(
tmp
);
...
...
@@ -216,14 +216,14 @@ std::shared_ptr<global_function_search> py_global_function_search2 (
)
{
std
::
vector
<
function_spec
>
specs
;
for
(
auto
i
:
functions
)
for
(
const
auto
&
i
:
functions
)
specs
.
emplace_back
(
i
.
cast
<
function_spec
>
());
std
::
vector
<
std
::
vector
<
function_evaluation
>>
func_evals
;
for
(
auto
i
:
initial_function_evals
)
for
(
const
auto
&
i
:
initial_function_evals
)
{
std
::
vector
<
function_evaluation
>
evals
;
for
(
auto
j
:
i
)
for
(
const
auto
&
j
:
i
)
{
evals
.
emplace_back
(
j
.
cast
<
function_evaluation
>
());
}
...
...
@@ -410,12 +410,12 @@ simply a struct that records x and the scalar value F(x). )RAW")
std
::
vector
<
std
::
vector
<
function_evaluation
>>
function_evals
;
self
.
get_function_evaluations
(
specs
,
function_evals
);
py
::
list
py_specs
,
py_func_evals
;
for
(
auto
&
s
:
specs
)
for
(
const
auto
&
s
:
specs
)
py_specs
.
append
(
s
);
for
(
auto
&
i
:
function_evals
)
for
(
const
auto
&
i
:
function_evals
)
{
py
::
list
tmp
;
for
(
auto
&
j
:
i
)
for
(
const
auto
&
j
:
i
)
tmp
.
append
(
j
);
py_func_evals
.
append
(
tmp
);
}
...
...
tools/python/src/gui.cpp
View file @
3e9d361f
...
...
@@ -97,7 +97,7 @@ void add_overlay_pylist (
)
{
std
::
vector
<
rectangle
>
rects
;
for
(
auto
&
obj
:
objs
)
for
(
const
auto
&
obj
:
objs
)
{
try
{
rects
.
push_back
(
obj
.
cast
<
rectangle
>
());
continue
;
}
catch
(
py
::
cast_error
&
)
{
}
try
{
rects
.
push_back
(
obj
.
cast
<
drectangle
>
());
continue
;
}
catch
(
py
::
cast_error
&
)
{
}
...
...
tools/python/src/image2.cpp
View file @
3e9d361f
...
...
@@ -65,7 +65,7 @@ std::vector<point> py_remove_incoherent_edge_pixels (
DLIB_CASSERT
(
num_rows
(
horz_gradient
)
==
num_rows
(
vert_gradient
));
DLIB_CASSERT
(
num_columns
(
horz_gradient
)
==
num_columns
(
vert_gradient
));
DLIB_CASSERT
(
angle_threshold
>=
0
);
for
(
auto
&
p
:
line
)
for
(
const
auto
&
p
:
line
)
DLIB_CASSERT
(
get_rect
(
horz_gradient
).
contains
(
p
),
"All line points must be inside the given images."
);
return
remove_incoherent_edge_pixels
(
line
,
horz_gradient
,
vert_gradient
,
angle_threshold
);
...
...
@@ -152,7 +152,7 @@ py::list py_extract_image_chips (
dlib
::
array
<
numpy_image
<
T
>>
out
;
extract_image_chips
(
img
,
python_list_to_vector
<
chip_details
>
(
chip_locations
),
out
);
py
::
list
ret
;
for
(
auto
&
i
:
out
)
for
(
const
auto
&
i
:
out
)
ret
.
append
(
i
);
return
ret
;
}
...
...
tools/python/src/image4.cpp
View file @
3e9d361f
...
...
@@ -511,7 +511,7 @@ py::list py_extract_image_chips (
dlib
::
array
<
numpy_image
<
T
>>
out
;
extract_image_chips
(
img
,
python_list_to_vector
<
chip_details
>
(
chip_locations
),
out
);
py
::
list
ret
;
for
(
auto
&
i
:
out
)
for
(
const
auto
&
i
:
out
)
ret
.
append
(
i
);
return
ret
;
}
...
...
tools/python/src/image_dataset_metadata.cpp
View file @
3e9d361f
...
...
@@ -97,7 +97,7 @@ dataset py_load_image_dataset_metadata(
std
::
shared_ptr
<
std
::
map
<
std
::
string
,
point
>>
map_from_object
(
py
::
dict
obj
)
{
auto
ret
=
std
::
make_shared
<
std
::
map
<
std
::
string
,
point
>>
();
for
(
auto
&
v
:
obj
)
for
(
const
auto
&
v
:
obj
)
{
(
*
ret
)[
v
.
first
.
cast
<
std
::
string
>
()]
=
v
.
second
.
cast
<
point
>
();
}
...
...
@@ -121,7 +121,7 @@ image_dataset_metadata::dataset py_make_bounding_box_regression_training_data (
// otherwise, detections should be a list of std::vectors.
py
::
list
dets
(
detections
);
std
::
vector
<
std
::
vector
<
rectangle
>>
temp
;
for
(
auto
&
d
:
dets
)
for
(
const
auto
&
d
:
dets
)
temp
.
emplace_back
(
d
.
cast
<
const
std
::
vector
<
rectangle
>&>
());
return
make_bounding_box_regression_training_data
(
truth
,
temp
);
}
...
...
@@ -174,7 +174,7 @@ void bind_image_dataset_metadata(py::module &m_)
auto
partsstr
=
[](
const
std
::
map
<
std
::
string
,
point
>&
item
)
{
std
::
ostringstream
sout
;
sout
<<
"{"
;
for
(
auto
&
v
:
item
)
for
(
const
auto
&
v
:
item
)
sout
<<
"'"
<<
v
.
first
<<
"': "
<<
v
.
second
<<
", "
;
sout
<<
"}"
;
return
sout
.
str
();
...
...
@@ -182,7 +182,7 @@ void bind_image_dataset_metadata(py::module &m_)
auto
partsrepr
=
[](
const
std
::
map
<
std
::
string
,
point
>&
item
)
{
std
::
ostringstream
sout
;
sout
<<
"dlib.image_dataset_metadata.parts({
\n
"
;
for
(
auto
&
v
:
item
)
for
(
const
auto
&
v
:
item
)
sout
<<
"'"
<<
v
.
first
<<
"': dlib.point"
<<
v
.
second
<<
",
\n
"
;
sout
<<
"})"
;
return
sout
.
str
();
...
...
tools/python/src/numpy_returns.cpp
View file @
3e9d361f
...
...
@@ -97,12 +97,12 @@ py::list get_face_chips (
py
::
list
chips_list
;
std
::
vector
<
chip_details
>
dets
;
for
(
auto
&
f
:
faces
)
for
(
const
auto
&
f
:
faces
)
dets
.
push_back
(
get_face_chip_details
(
f
,
size
,
padding
));
dlib
::
array
<
numpy_image
<
rgb_pixel
>>
face_chips
;
extract_image_chips
(
img
,
dets
,
face_chips
);
for
(
auto
&
chip
:
face_chips
)
for
(
const
auto
&
chip
:
face_chips
)
{
// Append image to chips list
chips_list
.
append
(
chip
);
...
...
tools/python/src/shape_predictor.cpp
View file @
3e9d361f
...
...
@@ -72,7 +72,7 @@ std::shared_ptr<full_object_detection> full_obj_det_init(const rectangle& rect,
{
const
unsigned
long
num_parts
=
py
::
len
(
pyparts
);
std
::
vector
<
point
>
parts
;
for
(
auto
&
item
:
pyparts
)
for
(
const
auto
&
item
:
pyparts
)
parts
.
push_back
(
item
.
cast
<
point
>
());
return
std
::
make_shared
<
full_object_detection
>
(
rect
,
parts
);
...
...
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