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
67448f72
Commit
67448f72
authored
Apr 05, 2014
by
Davis King
Browse files
Made the loss calculation more explicit.
parent
137b7f80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
dlib/svm/structural_svm_assignment_problem.h
dlib/svm/structural_svm_assignment_problem.h
+10
-3
No files found.
dlib/svm/structural_svm_assignment_problem.h
View file @
67448f72
...
...
@@ -193,6 +193,8 @@ namespace dlib
}
cost
.
set_size
(
size
,
size
);
const
double
loss_for_false_association
=
1
;
const
double
loss_for_missed_association
=
1
;
typename
feature_extractor
::
feature_vector_type
feats
;
// now fill out the cost assignment matrix
...
...
@@ -211,7 +213,7 @@ namespace dlib
// add in the loss since this corresponds to an incorrect prediction.
if
(
c
!=
labels
[
idx
][
r
])
{
cost
(
r
,
c
)
+=
1
;
cost
(
r
,
c
)
+=
loss_for_false_association
;
}
}
else
...
...
@@ -219,7 +221,7 @@ namespace dlib
if
(
labels
[
idx
][
r
]
==
-
1
)
cost
(
r
,
c
)
=
0
;
else
cost
(
r
,
c
)
=
1
;
// 1 for the loss
cost
(
r
,
c
)
=
loss_for_missed_association
;
}
}
...
...
@@ -250,7 +252,12 @@ namespace dlib
assignment
[
i
]
=
-
1
;
if
(
assignment
[
i
]
!=
labels
[
idx
][
i
])
loss
+=
1
;
{
if
(
assignment
[
i
]
==
-
1
)
loss
+=
loss_for_missed_association
;
else
loss
+=
loss_for_false_association
;
}
}
get_joint_feature_vector
(
samples
[
idx
],
assignment
,
psi
);
...
...
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