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
7359ab4b
Commit
7359ab4b
authored
Dec 03, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup serialization support for assignment_function objects.
parent
9d81a1ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletion
+44
-1
assignment_function.h
dlib/svm/assignment_function.h
+44
-1
No files found.
dlib/svm/assignment_function.h
View file @
7359ab4b
...
...
@@ -90,6 +90,14 @@ namespace dlib
);
}
const
feature_extractor
&
get_feature_extractor
(
)
const
{
return
fe
;
}
const
matrix
<
double
,
0
,
1
>&
get_weights
(
)
const
{
return
weights
;
}
bool
forces_assignment
(
)
const
{
return
force_assignment
;
}
result_type
operator
()(
const
std
::
vector
<
lhs_type
>&
lhs
,
...
...
@@ -156,7 +164,6 @@ namespace dlib
return
assignment
;
}
result_type
operator
()
(
const
sample_type
&
item
)
const
...
...
@@ -172,6 +179,42 @@ namespace dlib
bool
force_assignment
;
};
// ----------------------------------------------------------------------------------------
template
<
typename
feature_extractor
>
void
serialize
(
const
assignment_function
<
feature_extractor
>&
item
,
std
::
ostream
&
out
)
{
serialize
(
item
.
get_feature_extractor
(),
out
);
serialize
(
item
.
get_weights
(),
out
);
serialize
(
item
.
forces_assignment
(),
out
);
}
// ----------------------------------------------------------------------------------------
template
<
typename
feature_extractor
>
void
deserialize
(
assignment_function
<
feature_extractor
>&
item
,
std
::
istream
&
in
)
{
feature_extractor
fe
;
matrix
<
double
,
0
,
1
>
weights
;
bool
force_assignment
;
deserialize
(
fe
,
in
);
deserialize
(
weights
,
in
);
deserialize
(
force_assignment
,
in
);
item
=
assignment_function
<
feature_extractor
>
(
fe
,
weights
,
force_assignment
);
}
// ----------------------------------------------------------------------------------------
}
...
...
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