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
825ae091
Commit
825ae091
authored
Aug 06, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
f1c734d6
c42fdead
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
10 deletions
+55
-10
spectral_cluster.h
dlib/clustering/spectral_cluster.h
+3
-1
object_detector.h
dlib/image_processing/object_detector.h
+3
-5
shape_predictor.h
dlib/image_processing/shape_predictor.h
+0
-0
shape_predictor_abstract.h
dlib/image_processing/shape_predictor_abstract.h
+47
-2
kkmeans.h
dlib/svm/kkmeans.h
+2
-2
No files found.
dlib/clustering/spectral_cluster.h
View file @
825ae091
...
...
@@ -59,7 +59,9 @@ namespace dlib
for
(
long
r
=
0
;
r
<
v
.
nr
();
++
r
)
{
spec_samps
.
push_back
(
trans
(
rowm
(
v
,
r
)));
spec_samps
.
back
()
/=
length
(
spec_samps
.
back
());
const
double
len
=
length
(
spec_samps
.
back
());
if
(
len
!=
0
)
spec_samps
.
back
()
/=
len
;
}
// Finally do the K-means clustering
pick_initial_centers
(
num_clusters
,
centers
,
spec_samps
);
...
...
dlib/image_processing/object_detector.h
View file @
825ae091
...
...
@@ -341,7 +341,7 @@ namespace dlib
boxes_overlap
(
overlap_tester
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
scanner_
.
get_num_detection_templates
()
>
0
&&
w_
.
size
()
>
0
,
DLIB_
C
ASSERT
(
scanner_
.
get_num_detection_templates
()
>
0
&&
w_
.
size
()
>
0
,
"
\t
object_detector::object_detector(scanner_,overlap_tester,w_)"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
scanner_.get_num_detection_templates(): "
<<
scanner_
.
get_num_detection_templates
()
...
...
@@ -349,10 +349,9 @@ namespace dlib
<<
"
\n\t
this: "
<<
this
);
#ifdef ENABLE_ASSERTS
for
(
unsigned
long
i
=
0
;
i
<
w_
.
size
();
++
i
)
{
DLIB_ASSERT
(
w_
[
i
].
size
()
==
scanner_
.
get_num_dimensions
()
+
1
,
DLIB_
C
ASSERT
(
w_
[
i
].
size
()
==
scanner_
.
get_num_dimensions
()
+
1
,
"
\t
object_detector::object_detector(scanner_,overlap_tester,w_)"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
scanner_.get_num_detection_templates(): "
<<
scanner_
.
get_num_detection_templates
()
...
...
@@ -361,7 +360,6 @@ namespace dlib
<<
"
\n\t
this: "
<<
this
);
}
#endif
scanner
.
copy_configuration
(
scanner_
);
w
.
resize
(
w_
.
size
());
...
...
@@ -382,7 +380,7 @@ namespace dlib
const
std
::
vector
<
object_detector
>&
detectors
)
{
DLIB_ASSERT
(
detectors
.
size
()
!=
0
,
DLIB_
C
ASSERT
(
detectors
.
size
()
!=
0
,
"
\t
object_detector::object_detector(detectors)"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
this: "
<<
this
...
...
dlib/image_processing/shape_predictor.h
View file @
825ae091
This diff is collapsed.
Click to expand it.
dlib/image_processing/shape_predictor_abstract.h
View file @
825ae091
...
...
@@ -42,6 +42,7 @@ namespace dlib
/*!
ensures
- #num_parts() == 0
- #num_features() == 0
!*/
unsigned
long
num_parts
(
...
...
@@ -51,15 +52,27 @@ namespace dlib
- returns the number of parts in the shapes predicted by this object.
!*/
template
<
typename
image_type
>
unsigned
long
num_features
(
)
const
;
/*!
ensures
- Returns the dimensionality of the feature vector output by operator().
This number is the total number of trees in this object times the number
of leaves on each tree.
!*/
template
<
typename
image_type
,
typename
T
,
typename
U
>
full_object_detection
operator
()(
const
image_type
&
img
,
const
rectangle
&
rect
const
rectangle
&
rect
,
std
::
vector
<
std
::
pair
<
T
,
U
>
>&
feats
)
const
;
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- T is some unsigned integral type (e.g. unsigned int).
- U is any scalar type capable of storing the value 1 (e.g. float).
ensures
- Runs the shape prediction algorithm on the part of the image contained in
the given bounding rectangle. So it will try and fit the shape model to
...
...
@@ -73,6 +86,29 @@ namespace dlib
- for all valid i:
- DET.part(i) == the location in img for the i-th part of the shape
predicted by this object.
- #feats == a sparse vector that records which leaf each tree used to make
the shape prediction. Moreover, it is an indicator vector, Therefore,
for all valid i:
- #feats[i].second == 1
Further, #feats is a vector from the space of num_features() dimensional
vectors. The output shape positions can be represented as the dot
product between #feats and a weight vector. Therefore, #feats encodes
all the information from img that was used to predict the returned shape
object.
!*/
template
<
typename
image_type
>
full_object_detection
operator
()(
const
image_type
&
img
,
const
rectangle
&
rect
)
const
;
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- Calling this function is equivalent to calling (*this)(img, rect, ignored)
where the 3d argument is discarded.
!*/
};
...
...
@@ -359,6 +395,9 @@ namespace dlib
- images.size() > 0
- for some i: objects[i].size() != 0
(i.e. there has to be at least one full_object_detection in the training set)
- for all valid p, there must exist i and j such that:
objects[i][j].part(p) != OBJECT_PART_NOT_PRESENT.
(i.e. You can't define a part that is always set to OBJECT_PART_NOT_PRESENT.)
- for all valid i,j,k,l:
- objects[i][j].num_parts() == objects[k][l].num_parts()
(i.e. all objects must agree on the number of parts)
...
...
@@ -370,6 +409,10 @@ namespace dlib
shape_predictor, SP, such that:
SP(images[i], objects[i][j].get_rect()) == objects[i][j]
This learned SP object is then returned.
- Not all parts are required to be observed for all objects. So if you
have training instances with missing parts then set the part positions
equal to OBJECT_PART_NOT_PRESENT and this algorithm will basically ignore
those missing parts.
!*/
};
...
...
@@ -408,6 +451,8 @@ namespace dlib
and compare the result with the truth part positions in objects[i][j]. We
then return the average distance (measured in pixels) between a predicted
part location and its true position.
- Note that any parts in objects that are set to OBJECT_PART_NOT_PRESENT are
simply ignored.
- if (scales.size() != 0) then
- Each time we compute the distance between a predicted part location and
its true location in objects[i][j] we divide the distance by
...
...
dlib/svm/kkmeans.h
View file @
825ae091
...
...
@@ -288,7 +288,7 @@ namespace dlib
struct
dlib_pick_initial_centers_data
{
dlib_pick_initial_centers_data
()
:
idx
(
0
),
dist
(
1e200
){}
dlib_pick_initial_centers_data
()
:
idx
(
0
),
dist
(
std
::
numeric_limits
<
double
>::
infinity
()
){}
long
idx
;
double
dist
;
bool
operator
<
(
const
dlib_pick_initial_centers_data
&
d
)
const
{
return
dist
<
d
.
dist
;
}
...
...
@@ -331,7 +331,7 @@ namespace dlib
// pick the first sample as one of the centers
centers
.
push_back
(
samples
[
0
]);
const
long
best_idx
=
static_cast
<
long
>
(
s
amples
.
size
()
-
samples
.
size
()
*
percentile
-
1
);
const
long
best_idx
=
static_cast
<
long
>
(
s
td
::
max
(
0
.
0
,
samples
.
size
()
-
samples
.
size
()
*
percentile
-
1
)
);
// pick the next center
for
(
long
i
=
0
;
i
<
num_centers
-
1
;
++
i
)
...
...
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