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
4b2178c6
Commit
4b2178c6
authored
Jan 09, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made trainer disk synchronization more reliable and efficient.
parent
08f965a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
trainer.h
dlib/dnn/trainer.h
+5
-12
No files found.
dlib/dnn/trainer.h
View file @
4b2178c6
...
@@ -281,20 +281,10 @@ namespace dlib
...
@@ -281,20 +281,10 @@ namespace dlib
sync_filename
=
filename
;
sync_filename
=
filename
;
time_between_syncs
=
time_between_syncs_
;
time_between_syncs
=
time_between_syncs_
;
// check if the sync file already exists, if it does we should load it. We
// check if the sync file already exists, if it does we should load it.
// first check for a .tmp version since that would be the newest if it existed.
std
::
ifstream
fin
(
filename
,
std
::
ios
::
binary
);
// If it doesn't exist we check the canonical sync file.
std
::
ifstream
fin
(
filename
+
".tmp"
,
std
::
ios
::
binary
);
if
(
fin
)
if
(
fin
)
{
deserialize
(
*
this
,
fin
);
deserialize
(
*
this
,
fin
);
}
else
{
std
::
ifstream
fin
(
filename
,
std
::
ios
::
binary
);
if
(
fin
)
deserialize
(
*
this
,
fin
);
}
}
}
double
get_average_loss
(
double
get_average_loss
(
...
@@ -521,6 +511,9 @@ namespace dlib
...
@@ -521,6 +511,9 @@ namespace dlib
// save our state to a temp file
// save our state to a temp file
std
::
string
tempfile
=
sync_filename
+
".tmp"
;
std
::
string
tempfile
=
sync_filename
+
".tmp"
;
std
::
ofstream
fout
(
tempfile
,
std
::
ios
::
binary
);
std
::
ofstream
fout
(
tempfile
,
std
::
ios
::
binary
);
// compact network before saving to disk.
wait_for_thread_to_pause
();
this
->
net
.
clean
();
serialize
(
*
this
,
fout
);
serialize
(
*
this
,
fout
);
fout
.
close
();
fout
.
close
();
...
...
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