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
0f6ddb64
Commit
0f6ddb64
authored
May 07, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
84d54e2f
6e6a7cfe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
layers.h
dlib/dnn/layers.h
+8
-5
utilities.h
dlib/dnn/utilities.h
+14
-0
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
...
@@ -1595,14 +1595,17 @@ namespace dlib
friend
void
to_xml
(
const
affine_
&
item
,
std
::
ostream
&
out
)
friend
void
to_xml
(
const
affine_
&
item
,
std
::
ostream
&
out
)
{
{
out
<<
"<affine"
;
if
(
item
.
mode
==
CONV_MODE
)
if
(
item
.
mode
==
CONV_MODE
)
out
<<
"
mode='conv'
"
;
out
<<
"
<affine_con>
\n
"
;
else
else
out
<<
"
mode='fc'
"
;
out
<<
"
<affine_fc>
\n
"
;
out
<<
">
\n
"
;
out
<<
mat
(
item
.
params
);
out
<<
mat
(
item
.
params
);
out
<<
"</affine>
\n
"
;
if
(
item
.
mode
==
CONV_MODE
)
out
<<
"</affine_con>
\n
"
;
else
out
<<
"</affine_fc>
\n
"
;
}
}
private
:
private
:
...
...
dlib/dnn/utilities.h
View file @
0f6ddb64
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "core.h"
#include "core.h"
#include "utilities_abstract.h"
#include "utilities_abstract.h"
#include "../geometry.h"
#include "../geometry.h"
#include <fstream>
namespace
dlib
namespace
dlib
{
{
...
@@ -103,9 +104,22 @@ namespace dlib
...
@@ -103,9 +104,22 @@ namespace dlib
std
::
ostream
&
out
std
::
ostream
&
out
)
)
{
{
auto
old_precision
=
out
.
precision
(
9
);
out
<<
"<net>
\n
"
;
out
<<
"<net>
\n
"
;
visit_layers
(
net
,
impl
::
visitor_net_to_xml
(
out
));
visit_layers
(
net
,
impl
::
visitor_net_to_xml
(
out
));
out
<<
"</net>
\n
"
;
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
...
@@ -56,6 +56,21 @@ namespace dlib
stream.
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
>
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