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
aa88a574
"git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "3f7911483be0cfb7d6d854d8276068e65e264b60"
Commit
aa88a574
authored
Sep 09, 2011
by
Davis King
Browse files
setup separate measures of loss for false alarms and missed truth boxes.
parent
c8ccb488
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
dlib/svm/structural_svm_object_detection_problem.h
dlib/svm/structural_svm_object_detection_problem.h
+9
-8
No files found.
dlib/svm/structural_svm_object_detection_problem.h
View file @
aa88a574
...
@@ -161,16 +161,17 @@ namespace dlib
...
@@ -161,16 +161,17 @@ namespace dlib
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>
dets
;
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>
dets
;
const
double
thresh
=
current_solution
(
scanner
.
get_num_dimensions
());
const
double
thresh
=
current_solution
(
scanner
.
get_num_dimensions
());
const
double
loss_per_error
=
1
;
const
double
loss_per_false_alarm
=
1
;
const
double
loss_per_missed_target
=
1
;
scanner
.
load
(
images
[
idx
]);
scanner
.
load
(
images
[
idx
]);
scanner
.
detect
(
current_solution
,
dets
,
thresh
-
loss_per_
error
);
scanner
.
detect
(
current_solution
,
dets
,
thresh
-
loss_per_
false_alarm
);
// The loss will measure the number of incorrect detections. A detection is
// The loss will measure the number of incorrect detections. A detection is
// incorrect if it doesn't hit a truth rectangle or if it is a duplicate detection
// incorrect if it doesn't hit a truth rectangle or if it is a duplicate detection
// on a truth rectangle.
// on a truth rectangle.
loss
=
rects
[
idx
].
size
()
*
loss_per_
error
;
loss
=
rects
[
idx
].
size
()
*
loss_per_
missed_target
;
// Measure the loss augmented score for the detections which hit a truth rect.
// Measure the loss augmented score for the detections which hit a truth rect.
std
::
vector
<
double
>
truth_score_hits
(
rects
[
idx
].
size
(),
0
);
std
::
vector
<
double
>
truth_score_hits
(
rects
[
idx
].
size
(),
0
);
...
@@ -193,9 +194,9 @@ namespace dlib
...
@@ -193,9 +194,9 @@ namespace dlib
// if this is the first time we have seen a detect which hit rects[truth.second]
// if this is the first time we have seen a detect which hit rects[truth.second]
const
double
score
=
dets
[
i
].
first
-
thresh
;
const
double
score
=
dets
[
i
].
first
-
thresh
;
if
(
truth_score_hits
[
truth
.
second
]
==
0
)
if
(
truth_score_hits
[
truth
.
second
]
==
0
)
truth_score_hits
[
truth
.
second
]
+=
score
-
loss_per_
error
;
truth_score_hits
[
truth
.
second
]
+=
score
-
loss_per_
missed_target
;
else
else
truth_score_hits
[
truth
.
second
]
+=
score
+
loss_per_
error
;
truth_score_hits
[
truth
.
second
]
+=
score
+
loss_per_
false_alarm
;
}
}
}
}
...
@@ -223,12 +224,12 @@ namespace dlib
...
@@ -223,12 +224,12 @@ namespace dlib
{
{
hit_truth_table
[
truth
.
second
]
=
true
;
hit_truth_table
[
truth
.
second
]
=
true
;
final_dets
.
push_back
(
dets
[
i
].
second
);
final_dets
.
push_back
(
dets
[
i
].
second
);
loss
-=
loss_per_
error
;
loss
-=
loss_per_
missed_target
;
}
}
else
else
{
{
final_dets
.
push_back
(
dets
[
i
].
second
);
final_dets
.
push_back
(
dets
[
i
].
second
);
loss
+=
loss_per_
error
;
loss
+=
loss_per_
false_alarm
;
}
}
}
}
}
}
...
@@ -236,7 +237,7 @@ namespace dlib
...
@@ -236,7 +237,7 @@ namespace dlib
{
{
// didn't hit anything
// didn't hit anything
final_dets
.
push_back
(
dets
[
i
].
second
);
final_dets
.
push_back
(
dets
[
i
].
second
);
loss
+=
loss_per_
error
;
loss
+=
loss_per_
false_alarm
;
}
}
}
}
...
...
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