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