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
565bed38
Commit
565bed38
authored
Jan 24, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made it so you can deserialize bn_ objects into affine_ objects.
parent
c7813163
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
layers.h
dlib/dnn/layers.h
+12
-0
layers_abstract.h
dlib/dnn/layers_abstract.h
+5
-0
No files found.
dlib/dnn/layers.h
View file @
565bed38
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include "../rand.h"
#include "../rand.h"
#include "../string.h"
#include "../string.h"
#include "tensor_tools.h"
#include "tensor_tools.h"
#include "../vectorstream.h"
namespace
dlib
namespace
dlib
...
@@ -884,6 +885,17 @@ namespace dlib
...
@@ -884,6 +885,17 @@ namespace dlib
{
{
std
::
string
version
;
std
::
string
version
;
deserialize
(
version
,
in
);
deserialize
(
version
,
in
);
if
(
version
==
"bn_"
)
{
// Since we can build an affine_ from a bn_ we check if that's what is in
// the stream and if so then just convert it right here.
unserialize
sin
(
version
,
in
);
bn_
temp
;
deserialize
(
temp
,
sin
);
item
=
temp
;
return
;
}
if
(
version
!=
"affine_"
)
if
(
version
!=
"affine_"
)
throw
serialization_error
(
"Unexpected version found while deserializing dlib::affine_."
);
throw
serialization_error
(
"Unexpected version found while deserializing dlib::affine_."
);
deserialize
(
item
.
params
,
in
);
deserialize
(
item
.
params
,
in
);
...
...
dlib/dnn/layers_abstract.h
View file @
565bed38
...
@@ -154,6 +154,11 @@ namespace dlib
...
@@ -154,6 +154,11 @@ namespace dlib
This kind of pattern is useful if you want to use one type of layer
This kind of pattern is useful if you want to use one type of layer
during training but a different type of layer during testing since it
during training but a different type of layer during testing since it
allows you to easily convert between related deep neural network types.
allows you to easily convert between related deep neural network types.
Additionally, if you provide a constructor to build a layer from another
layer type you should also write your layer's deserialize() routine such
that it can read that other layer's serialized data in addition to your
own serialized data.
!*/
!*/
template
<
typename
SUBNET
>
template
<
typename
SUBNET
>
...
...
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