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
5da76449
Commit
5da76449
authored
Jan 24, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added another constructor to object_detector that makes it easy to combine
multiple detectors together.
parent
d62fac0d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
object_detector.h
dlib/image_processing/object_detector.h
+30
-0
object_detector_abstract.h
dlib/image_processing/object_detector_abstract.h
+29
-1
No files found.
dlib/image_processing/object_detector.h
View file @
5da76449
...
@@ -73,6 +73,10 @@ namespace dlib
...
@@ -73,6 +73,10 @@ namespace dlib
const
std
::
vector
<
feature_vector_type
>&
w_
const
std
::
vector
<
feature_vector_type
>&
w_
);
);
explicit
object_detector
(
const
std
::
vector
<
object_detector
>&
detectors
);
unsigned
long
num_detectors
(
unsigned
long
num_detectors
(
)
const
{
return
w
.
size
();
}
)
const
{
return
w
.
size
();
}
...
@@ -356,6 +360,32 @@ namespace dlib
...
@@ -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
<
template
<
...
...
dlib/image_processing/object_detector_abstract.h
View file @
5da76449
...
@@ -110,7 +110,7 @@ namespace dlib
...
@@ -110,7 +110,7 @@ namespace dlib
- w.size() > 0
- w.size() > 0
ensures
ensures
- When the operator() member function is called it will invoke
- 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
will take all the detections output by the calls to detect() and suppress
overlapping detections, and finally report the results.
overlapping detections, and finally report the results.
- when #*this is used to detect objects, the set of output detections will
- when #*this is used to detect objects, the set of output detections will
...
@@ -126,6 +126,34 @@ namespace dlib
...
@@ -126,6 +126,34 @@ namespace dlib
I.e. the copy is done using copy_configuration())
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
(
unsigned
long
num_detectors
(
)
const
;
)
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