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
1c664eea
"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "154f6f45d4acd4ea1f2e35cac3b90eb6faeea6bd"
Commit
1c664eea
authored
Oct 24, 2017
by
Davis King
Browse files
Made the metric learning example do image jittering.
parent
369f2b32
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
examples/dnn_face_recognition_ex.cpp
examples/dnn_face_recognition_ex.cpp
+2
-3
examples/dnn_metric_learning_on_images_ex.cpp
examples/dnn_metric_learning_on_images_ex.cpp
+5
-0
No files found.
examples/dnn_face_recognition_ex.cpp
View file @
1c664eea
...
@@ -40,9 +40,8 @@ using namespace std;
...
@@ -40,9 +40,8 @@ using namespace std;
// The dlib_face_recognition_resnet_model_v1 model used by this example was trained using
// The dlib_face_recognition_resnet_model_v1 model used by this example was trained using
// essentially the code shown in dnn_metric_learning_on_images_ex.cpp except the
// essentially the code shown in dnn_metric_learning_on_images_ex.cpp except the
// mini-batches were made larger (35x15 instead of 5x5), the iterations without progress
// mini-batches were made larger (35x15 instead of 5x5), the iterations without progress
// was set to 10000, dlib::jitter_image() was used during training, and the training
// was set to 10000, and the training dataset consisted of about 3 million images instead of
// dataset consisted of about 3 million images instead of 55. Also, the input layer was
// 55. Also, the input layer was locked to images of size 150.
// locked to images of size 150.
template
<
template
<
int
,
template
<
typename
>
class
,
int
,
typename
>
class
block
,
int
N
,
template
<
typename
>
class
BN
,
typename
SUBNET
>
template
<
template
<
int
,
template
<
typename
>
class
,
int
,
typename
>
class
block
,
int
N
,
template
<
typename
>
class
BN
,
typename
SUBNET
>
using
residual
=
add_prev1
<
block
<
N
,
BN
,
1
,
tag1
<
SUBNET
>>>
;
using
residual
=
add_prev1
<
block
<
N
,
BN
,
1
,
tag1
<
SUBNET
>>>
;
...
...
examples/dnn_metric_learning_on_images_ex.cpp
View file @
1c664eea
...
@@ -116,7 +116,12 @@ void load_mini_batch (
...
@@ -116,7 +116,12 @@ void load_mini_batch (
// You might want to do some data augmentation at this point. Here we do some simple
// You might want to do some data augmentation at this point. Here we do some simple
// color augmentation.
// color augmentation.
for
(
auto
&&
crop
:
images
)
for
(
auto
&&
crop
:
images
)
{
disturb_colors
(
crop
,
rnd
);
disturb_colors
(
crop
,
rnd
);
// Jitter most crops
if
(
rnd
.
get_random_double
()
>
0.1
)
crop
=
jitter_image
(
crop
,
rnd
);
}
// All the images going into a mini-batch have to be the same size. And really, all
// All the images going into a mini-batch have to be the same size. And really, all
...
...
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