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
4a1b5941
Commit
4a1b5941
authored
Sep 11, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved the error messages output when a set of truth rectangles can't be
represented by an image scanner.
parent
07e48859
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
12 deletions
+63
-12
structural_svm_object_detection_problem.h
dlib/svm/structural_svm_object_detection_problem.h
+46
-12
structural_svm_object_detection_problem_abstract.h
dlib/svm/structural_svm_object_detection_problem_abstract.h
+17
-0
No files found.
dlib/svm/structural_svm_object_detection_problem.h
View file @
4a1b5941
...
...
@@ -7,10 +7,19 @@
#include "../matrix.h"
#include "structural_svm_problem_threaded.h"
#include <sstream>
#include "../string.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
impossible_labeling_error
:
public
dlib
::
error
{
public
:
impossible_labeling_error
(
const
std
::
string
&
msg
)
:
dlib
::
error
(
msg
)
{};
};
// ----------------------------------------------------------------------------------------
template
<
...
...
@@ -160,11 +169,22 @@ namespace dlib
{
using
namespace
std
;
ostringstream
sout
;
sout
<<
"impossible labeling found!"
<<
endl
;
sout
<<
"An impossible set of object labels was detected. This is happening because "
;
sout
<<
"the truth labels for an image contain rectangles which overlap according to the "
;
sout
<<
"overlap_tester_type supplied for non-max suppression. To resolve this, you either need to "
;
sout
<<
"relax the overlap tester so it doesn't mark these rectangles as overlapping "
;
sout
<<
"or adjust the truth rectangles. "
;
// make sure the above string fits nicely into a command prompt window.
string
temp
=
sout
.
str
();
sout
.
str
(
""
);
sout
<<
wrap_string
(
temp
,
0
,
0
)
<<
endl
<<
endl
;
sout
<<
"image index: "
<<
idx
<<
endl
;
sout
<<
"The offending rectangles are:
\n
"
;
sout
<<
"rect1: "
<<
mapped_rects
[
i
]
<<
endl
;
sout
<<
"rect2: "
<<
mapped_rects
[
j
]
<<
endl
;
sout
<<
"in image "
<<
idx
<<
endl
;
throw
dlib
::
error
(
sout
.
str
());
throw
dlib
::
impossible_labeling_error
(
sout
.
str
());
}
}
}
...
...
@@ -179,15 +199,29 @@ namespace dlib
{
using
namespace
std
;
ostringstream
sout
;
sout
<<
"overlap_eps is too tight!"
<<
endl
;
sout
<<
"overlap_eps: "
<<
overlap_eps
<<
endl
;
sout
<<
"mapped overlap: "
<<
area
/
total_area
<<
endl
;
sout
<<
"width/height: "
<<
rects
[
idx
][
i
].
width
()
/
(
double
)
rects
[
idx
][
i
].
height
()
<<
endl
;
sout
<<
"area: "
<<
rects
[
idx
][
i
].
area
()
<<
endl
;
sout
<<
"true rect: "
<<
rects
[
idx
][
i
]
<<
endl
;
sout
<<
"mapped rect: "
<<
mapped_rects
[
i
]
<<
endl
;
sout
<<
"in image "
<<
idx
<<
endl
;
throw
dlib
::
error
(
sout
.
str
());
sout
<<
"An impossible set of object labels was detected. This is happening because "
;
sout
<<
"none of the sliding window detection templates is capable of matching the size "
;
sout
<<
"and/or shape of one of the ground truth rectangles to within the required overlap_eps "
;
sout
<<
"amount of overlap. To resolve this you need to either lower the overlap_eps, add "
;
sout
<<
"another detection template which can match the offending rectangle, or adjust the "
;
sout
<<
"offending truth rectangle so that it can be matched by an existing detection template. "
;
sout
<<
"It is also possible that the image pyramid you are using is too coarse. E.g. if one of "
;
sout
<<
"your existing detection templates has a matching width/height ratio and smaller area than the offending "
;
sout
<<
"rectangle then a finer image pyramid would probably help."
;
// make sure the above string fits nicely into a command prompt window.
string
temp
=
sout
.
str
();
sout
.
str
(
""
);
sout
<<
wrap_string
(
temp
,
0
,
0
)
<<
endl
<<
endl
;
sout
<<
"overlap_eps: "
<<
overlap_eps
<<
endl
;
sout
<<
"best possible overlap: "
<<
area
/
total_area
<<
endl
;
sout
<<
"truth rect width/height: "
<<
rects
[
idx
][
i
].
width
()
/
(
double
)
rects
[
idx
][
i
].
height
()
<<
endl
;
sout
<<
"truth rect area: "
<<
rects
[
idx
][
i
].
area
()
<<
endl
;
sout
<<
"truth rect: "
<<
rects
[
idx
][
i
]
<<
endl
;
sout
<<
"nearest detection template rect: "
<<
mapped_rects
[
i
]
<<
endl
;
sout
<<
"image index "
<<
idx
<<
endl
;
throw
dlib
::
impossible_labeling_error
(
sout
.
str
());
}
}
...
...
dlib/svm/structural_svm_object_detection_problem_abstract.h
View file @
4a1b5941
...
...
@@ -10,6 +10,23 @@
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
impossible_labeling_error
:
public
dlib
::
error
{
/*!
WHAT THIS OBJECT REPRESENTS
This is the exception thrown by the structural_svm_object_detection_problem
when it detects that the image_scanner_type it is working with is incapable
of representing the truth rectangles it has been asked to predict.
This kind of problem can happen when the overlap_tester_type indicates that
two ground truth rectangles overlap and are therefore not allowed to both
be output at the same time. Or alternatively, if there are not enough
detection templates to cover the variety of truth rectangle shapes.
!*/
};
// ----------------------------------------------------------------------------------------
template
<
...
...
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