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
dc45871a
Commit
dc45871a
authored
Aug 20, 2017
by
Davis King
Browse files
Made the loss value management a little more conservative.
parent
dc071cea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
dlib/dnn/trainer.h
dlib/dnn/trainer.h
+8
-4
No files found.
dlib/dnn/trainer.h
View file @
dc45871a
...
@@ -701,7 +701,7 @@ namespace dlib
...
@@ -701,7 +701,7 @@ namespace dlib
test_steps_without_progress
=
0
;
test_steps_without_progress
=
0
;
// Empty out some of the previous loss values so that test_steps_without_progress
// Empty out some of the previous loss values so that test_steps_without_progress
// will decrease below test_iter_without_progress_thresh.
// will decrease below test_iter_without_progress_thresh.
for
(
int
cnt
=
0
;
cnt
<
previous_loss_values_dump_amount
&&
test_previous_loss_values
.
size
()
>
0
;
++
cnt
)
for
(
int
cnt
=
0
;
cnt
<
test_
previous_loss_values_dump_amount
&&
test_previous_loss_values
.
size
()
>
0
;
++
cnt
)
test_previous_loss_values
.
pop_front
();
test_previous_loss_values
.
pop_front
();
}
}
}
}
...
@@ -879,7 +879,8 @@ namespace dlib
...
@@ -879,7 +879,8 @@ namespace dlib
prob_loss_increasing_thresh
=
prob_loss_increasing_thresh_default_value
;
prob_loss_increasing_thresh
=
prob_loss_increasing_thresh_default_value
;
updated_net_since_last_sync
=
false
;
updated_net_since_last_sync
=
false
;
sync_file_reloaded
=
false
;
sync_file_reloaded
=
false
;
previous_loss_values_dump_amount
=
100
;
previous_loss_values_dump_amount
=
400
;
test_previous_loss_values_dump_amount
=
100
;
start
();
start
();
}
}
...
@@ -890,7 +891,7 @@ namespace dlib
...
@@ -890,7 +891,7 @@ namespace dlib
friend
void
serialize
(
const
dnn_trainer
&
item
,
std
::
ostream
&
out
)
friend
void
serialize
(
const
dnn_trainer
&
item
,
std
::
ostream
&
out
)
{
{
item
.
wait_for_thread_to_pause
();
item
.
wait_for_thread_to_pause
();
int
version
=
1
0
;
int
version
=
1
1
;
serialize
(
version
,
out
);
serialize
(
version
,
out
);
size_t
nl
=
dnn_trainer
::
num_layers
;
size_t
nl
=
dnn_trainer
::
num_layers
;
...
@@ -917,6 +918,7 @@ namespace dlib
...
@@ -917,6 +918,7 @@ namespace dlib
serialize
(
item
.
test_steps_without_progress
.
load
(),
out
);
serialize
(
item
.
test_steps_without_progress
.
load
(),
out
);
serialize
(
item
.
test_previous_loss_values
,
out
);
serialize
(
item
.
test_previous_loss_values
,
out
);
serialize
(
item
.
previous_loss_values_dump_amount
,
out
);
serialize
(
item
.
previous_loss_values_dump_amount
,
out
);
serialize
(
item
.
test_previous_loss_values_dump_amount
,
out
);
}
}
friend
void
deserialize
(
dnn_trainer
&
item
,
std
::
istream
&
in
)
friend
void
deserialize
(
dnn_trainer
&
item
,
std
::
istream
&
in
)
...
@@ -924,7 +926,7 @@ namespace dlib
...
@@ -924,7 +926,7 @@ namespace dlib
item
.
wait_for_thread_to_pause
();
item
.
wait_for_thread_to_pause
();
int
version
=
0
;
int
version
=
0
;
deserialize
(
version
,
in
);
deserialize
(
version
,
in
);
if
(
version
!=
1
0
)
if
(
version
!=
1
1
)
throw
serialization_error
(
"Unexpected version found while deserializing dlib::dnn_trainer."
);
throw
serialization_error
(
"Unexpected version found while deserializing dlib::dnn_trainer."
);
size_t
num_layers
=
0
;
size_t
num_layers
=
0
;
...
@@ -961,6 +963,7 @@ namespace dlib
...
@@ -961,6 +963,7 @@ namespace dlib
deserialize
(
ltemp
,
in
);
item
.
test_steps_without_progress
=
ltemp
;
deserialize
(
ltemp
,
in
);
item
.
test_steps_without_progress
=
ltemp
;
deserialize
(
item
.
test_previous_loss_values
,
in
);
deserialize
(
item
.
test_previous_loss_values
,
in
);
deserialize
(
item
.
previous_loss_values_dump_amount
,
in
);
deserialize
(
item
.
previous_loss_values_dump_amount
,
in
);
deserialize
(
item
.
test_previous_loss_values_dump_amount
,
in
);
if
(
item
.
devices
.
size
()
>
1
)
if
(
item
.
devices
.
size
()
>
1
)
{
{
...
@@ -1269,6 +1272,7 @@ namespace dlib
...
@@ -1269,6 +1272,7 @@ namespace dlib
bool
sync_file_reloaded
;
bool
sync_file_reloaded
;
int
previous_loss_values_dump_amount
;
int
previous_loss_values_dump_amount
;
int
test_previous_loss_values_dump_amount
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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