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
5da76449
Commit
5da76449
authored
Jan 23, 2014
by
Davis King
Browse files
Added another constructor to object_detector that makes it easy to combine
multiple detectors together.
parent
d62fac0d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
dlib/image_processing/object_detector.h
dlib/image_processing/object_detector.h
+30
-0
dlib/image_processing/object_detector_abstract.h
dlib/image_processing/object_detector_abstract.h
+30
-2
No files found.
dlib/image_processing/object_detector.h
View file @
5da76449
...
...
@@ -73,6 +73,10 @@ namespace dlib
const
std
::
vector
<
feature_vector_type
>&
w_
);
explicit
object_detector
(
const
std
::
vector
<
object_detector
>&
detectors
);
unsigned
long
num_detectors
(
)
const
{
return
w
.
size
();
}
...
...
@@ -356,6 +360,32 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
image_scanner_type
>
object_detector
<
image_scanner_type
>::
object_detector
(
const
std
::
vector
<
object_detector
>&
detectors
)
{
DLIB_ASSERT
(
detectors
.
size
()
!=
0
,
"
\t
object_detector::object_detector(detectors)"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
this: "
<<
this
);
std
::
vector
<
feature_vector_type
>
weights
;
weights
.
reserve
(
detectors
.
size
());
for
(
unsigned
long
i
=
0
;
i
<
detectors
.
size
();
++
i
)
{
for
(
unsigned
long
j
=
0
;
j
<
detectors
[
i
].
num_detectors
();
++
j
)
weights
.
push_back
(
detectors
[
i
].
get_w
(
j
));
}
*
this
=
object_detector
(
detectors
[
0
].
get_scanner
(),
detectors
[
0
].
get_overlap_tester
(),
weights
);
}
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/image_processing/object_detector_abstract.h
View file @
5da76449
...
...
@@ -110,7 +110,7 @@ namespace dlib
- w.size() > 0
ensures
- When the operator() member function is called it will invoke
scanner.detect(w[i],dets,w[i](w[i].size()-1)) for all valid i. Then it
get_
scanner
()
.detect(w[i],dets,w[i](w[i].size()-1)) for all valid i. Then it
will take all the detections output by the calls to detect() and suppress
overlapping detections, and finally report the results.
- when #*this is used to detect objects, the set of output detections will
...
...
@@ -126,6 +126,34 @@ namespace dlib
I.e. the copy is done using copy_configuration())
!*/
explicit
object_detector
(
const
std
::
vector
<
object_detector
>&
detectors
);
/*!
requires
- detectors.size() != 0
- All the detectors must use compatibly configured scanners. That is, it
must make sense for the weight vector from one detector to be used with
the scanner from any other.
- for all valid i:
- detectors[i].get_scanner().get_num_dimensions() == detectors[0].get_scanner().get_num_dimensions()
(i.e. all the detectors use scanners that use the same kind of feature vectors.)
ensures
- Very much like the above constructor, this constructor takes all the
given detectors and packs them into #*this. That is, invoking operator()
on #*this will run all the detectors, perform non-max suppression, and
then report the results.
- When #*this is used to detect objects, the set of output detections will
never contain any overlaps with respect to overlap_tester. That is, for
all pairs of returned detections A and B, we will always have:
overlap_tester(A,B) == false
- #num_detectors() == The sum of detectors[i].num_detectors() for all valid i.
- #get_overlap_tester() == detectors[0].get_overlap_tester()
- #get_scanner() == detectors[0].get_scanner()
(note that only the "configuration" of scanner is copied. I.e. the copy
is done using copy_configuration())
!*/
unsigned
long
num_detectors
(
)
const
;
/*!
...
...
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