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
0f6ddb64
Commit
0f6ddb64
authored
May 07, 2017
by
Davis King
Browse files
merged
parents
84d54e2f
6e6a7cfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
dlib/dnn/layers.h
dlib/dnn/layers.h
+8
-5
dlib/dnn/utilities.h
dlib/dnn/utilities.h
+14
-0
dlib/dnn/utilities_abstract.h
dlib/dnn/utilities_abstract.h
+15
-0
No files found.
dlib/dnn/layers.h
View file @
0f6ddb64
...
...
@@ -1595,14 +1595,17 @@ namespace dlib
friend
void
to_xml
(
const
affine_
&
item
,
std
::
ostream
&
out
)
{
out
<<
"<affine"
;
if
(
item
.
mode
==
CONV_MODE
)
out
<<
"
mode='conv'
"
;
out
<<
"
<affine_con>
\n
"
;
else
out
<<
"
mode='fc'
"
;
out
<<
">
\n
"
;
out
<<
"
<affine_fc>
\n
"
;
out
<<
mat
(
item
.
params
);
out
<<
"</affine>
\n
"
;
if
(
item
.
mode
==
CONV_MODE
)
out
<<
"</affine_con>
\n
"
;
else
out
<<
"</affine_fc>
\n
"
;
}
private:
...
...
dlib/dnn/utilities.h
View file @
0f6ddb64
...
...
@@ -6,6 +6,7 @@
#include "core.h"
#include "utilities_abstract.h"
#include "../geometry.h"
#include <fstream>
namespace
dlib
{
...
...
@@ -103,9 +104,22 @@ namespace dlib
std
::
ostream
&
out
)
{
auto
old_precision
=
out
.
precision
(
9
);
out
<<
"<net>
\n
"
;
visit_layers
(
net
,
impl
::
visitor_net_to_xml
(
out
));
out
<<
"</net>
\n
"
;
// restore the original stream precision.
out
.
precision
(
old_precision
);
}
template
<
typename
net_type
>
void
net_to_xml
(
const
net_type
&
net
,
const
std
::
string
&
filename
)
{
std
::
ofstream
fout
(
filename
);
net_to_xml
(
net
,
fout
);
}
// ----------------------------------------------------------------------------------------
...
...
dlib/dnn/utilities_abstract.h
View file @
0f6ddb64
...
...
@@ -56,6 +56,21 @@ namespace dlib
stream.
!*/
template
<
typename
net_type
>
void
net_to_xml
(
const
net_type
&
net
,
const
std
::
string
&
filename
);
/*!
requires
- net_type is an object of type add_layer, add_loss_layer, add_skip_layer, or
add_tag_layer.
- All layers in the net must provide to_xml() functions.
ensures
- This function is just like the above net_to_xml(), except it writes to a file
rather than an ostream.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
net_type
>
...
...
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