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
aa93c8f8
Commit
aa93c8f8
authored
Oct 25, 2017
by
Davis King
Browse files
Updated python code to use the new dlib::jitter_image() instead of hacking it
out of the random_cropper.
parent
e338bf02
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
18 deletions
+2
-18
tools/python/src/face_recognition.cpp
tools/python/src/face_recognition.cpp
+2
-18
No files found.
tools/python/src/face_recognition.cpp
View file @
aa93c8f8
...
@@ -28,15 +28,6 @@ public:
...
@@ -28,15 +28,6 @@ public:
face_recognition_model_v1
(
const
std
::
string
&
model_filename
)
face_recognition_model_v1
(
const
std
::
string
&
model_filename
)
{
{
deserialize
(
model_filename
)
>>
net
;
deserialize
(
model_filename
)
>>
net
;
cropper
=
make_shared
<
random_cropper
>
();
cropper
->
set_chip_dims
(
150
,
150
);
cropper
->
set_randomly_flip
(
true
);
cropper
->
set_max_object_size
(
0.99999
);
cropper
->
set_background_crops_fraction
(
0
);
cropper
->
set_min_object_size
(
0.97
);
cropper
->
set_translate_amount
(
0.02
);
cropper
->
set_max_rotation_degrees
(
3
);
}
}
matrix
<
double
,
0
,
1
>
compute_face_descriptor
(
matrix
<
double
,
0
,
1
>
compute_face_descriptor
(
...
@@ -91,23 +82,16 @@ public:
...
@@ -91,23 +82,16 @@ public:
private:
private:
std
::
shared_ptr
<
random_cropper
>
cropper
;
dlib
::
rand
rnd
;
std
::
vector
<
matrix
<
rgb_pixel
>>
jitter_image
(
std
::
vector
<
matrix
<
rgb_pixel
>>
jitter_image
(
const
matrix
<
rgb_pixel
>&
img
,
const
matrix
<
rgb_pixel
>&
img
,
const
int
num_jitters
const
int
num_jitters
)
)
{
{
std
::
vector
<
mmod_rect
>
raw_boxes
(
1
),
ignored_crop_boxes
;
raw_boxes
[
0
]
=
shrink_rect
(
get_rect
(
img
),
3
);
std
::
vector
<
matrix
<
rgb_pixel
>>
crops
;
std
::
vector
<
matrix
<
rgb_pixel
>>
crops
;
matrix
<
rgb_pixel
>
temp
;
for
(
int
i
=
0
;
i
<
num_jitters
;
++
i
)
for
(
int
i
=
0
;
i
<
num_jitters
;
++
i
)
{
crops
.
push_back
(
dlib
::
jitter_image
(
img
,
rnd
));
(
*
cropper
)(
img
,
raw_boxes
,
temp
,
ignored_crop_boxes
);
crops
.
push_back
(
move
(
temp
));
}
return
crops
;
return
crops
;
}
}
...
...
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