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
c4c8535d
"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "454f82e6fc4f932747cf7c2062805289fde2672b"
Commit
c4c8535d
authored
Aug 24, 2012
by
Davis King
Browse files
refactored the scan_image_pyramid interface slightly.
parent
a32002ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
42 deletions
+33
-42
dlib/image_processing/object_detector_abstract.h
dlib/image_processing/object_detector_abstract.h
+4
-2
dlib/image_processing/scan_image_pyramid.h
dlib/image_processing/scan_image_pyramid.h
+4
-8
dlib/image_processing/scan_image_pyramid_abstract.h
dlib/image_processing/scan_image_pyramid_abstract.h
+22
-30
dlib/svm/structural_svm_object_detection_problem.h
dlib/svm/structural_svm_object_detection_problem.h
+1
-1
dlib/test/object_detector.cpp
dlib/test/object_detector.cpp
+2
-1
No files found.
dlib/image_processing/object_detector_abstract.h
View file @
c4c8535d
...
@@ -130,8 +130,9 @@ namespace dlib
...
@@ -130,8 +130,9 @@ namespace dlib
confidence detections come first. E.g. element 0 is the best detection,
confidence detections come first. E.g. element 0 is the best detection,
element 1 the next best, and so on.
element 1 the next best, and so on.
- #get_scanner() will have been loaded with img. Therefore, you can call
- #get_scanner() will have been loaded with img. Therefore, you can call
#get_scanner().get_feature_vector() to obtain the feature vectors for
#get_scanner().get_feature_vector() to obtain the feature vectors or
the resulting object detection boxes.
#get_scanner().get_full_object_detection() to get the
full_object_detections for the resulting object detection boxes.
!*/
!*/
template
<
template
<
...
@@ -158,6 +159,7 @@ namespace dlib
...
@@ -158,6 +159,7 @@ namespace dlib
- #dets[i].second == the bounding box for the i-th detection.
- #dets[i].second == the bounding box for the i-th detection.
- #get_scanner() will have been loaded with img. Therefore, you can call
- #get_scanner() will have been loaded with img. Therefore, you can call
#get_scanner().get_feature_vector() to obtain the feature vectors or
#get_scanner().get_feature_vector() to obtain the feature vectors or
#get_scanner().get_full_object_detection() to get the
full_object_detections for the resulting object detection boxes.
full_object_detections for the resulting object detection boxes.
- The detection threshold is adjusted by having adjust_threshold added
- The detection threshold is adjusted by having adjust_threshold added
to it. Therefore, an adjust_threshold value > 0 makes detecting
to it. Therefore, an adjust_threshold value > 0 makes detecting
...
...
dlib/image_processing/scan_image_pyramid.h
View file @
c4c8535d
...
@@ -113,10 +113,9 @@ namespace dlib
...
@@ -113,10 +113,9 @@ namespace dlib
feature_vector_type
&
psi
feature_vector_type
&
psi
)
const
;
)
const
;
full_object_detection
get_f
eature_vector
(
full_object_detection
get_f
ull_object_detection
(
const
rectangle
&
rect
,
const
rectangle
&
rect
,
const
feature_vector_type
&
w
,
const
feature_vector_type
&
w
feature_vector_type
&
psi
)
const
;
)
const
;
const
rectangle
get_best_matching_rect
(
const
rectangle
get_best_matching_rect
(
...
@@ -834,10 +833,9 @@ namespace dlib
...
@@ -834,10 +833,9 @@ namespace dlib
typename
Feature_extractor_type
typename
Feature_extractor_type
>
>
full_object_detection
scan_image_pyramid
<
Pyramid_type
,
Feature_extractor_type
>::
full_object_detection
scan_image_pyramid
<
Pyramid_type
,
Feature_extractor_type
>::
get_f
eature_vector
(
get_f
ull_object_detection
(
const
rectangle
&
rect
,
const
rectangle
&
rect
,
const
feature_vector_type
&
w
,
const
feature_vector_type
&
w
feature_vector_type
&
psi
)
const
)
const
{
{
full_object_detection
obj
(
rect
);
full_object_detection
obj
(
rect
);
...
@@ -931,8 +929,6 @@ namespace dlib
...
@@ -931,8 +929,6 @@ namespace dlib
obj
.
movable_parts
.
push_back
(
max_loc
);
obj
.
movable_parts
.
push_back
(
max_loc
);
}
}
get_feature_vector
(
obj
,
psi
);
return
obj
;
return
obj
;
}
}
...
...
dlib/image_processing/scan_image_pyramid_abstract.h
View file @
c4c8535d
...
@@ -404,46 +404,38 @@ namespace dlib
...
@@ -404,46 +404,38 @@ namespace dlib
- psi.size() >= get_num_dimensions()
- psi.size() >= get_num_dimensions()
(i.e. psi must have preallocated its memory before this function is called)
(i.e. psi must have preallocated its memory before this function is called)
ensures
ensures
- This function allows you to determine the feature vector used for a sliding window location.
- This function allows you to determine the feature vector used for a
Note that this vector is added to psi.
sliding window location. Note that this vector is added to psi. Note
- Since scan_image_pyramid is a sliding window classifier system, not all possible rectangles can
also that you must use get_full_object_detection() to convert a rect from
be output by detect(). So in the case where obj.rect could not arise from a call to detect(), this
detect() into the needed full_object_detection.
function will map obj.rect to the nearest possible object box and then add the feature vector for
- Since scan_image_pyramid is a sliding window classifier system, not all
the mapped rectangle into #psi.
possible rectangles can be output by detect(). So in the case where
- get_best_matching_rect(obj.rect) == the rectangle obj.rect gets mapped to for feature extraction.
obj.rect could not arise from a call to detect(), this function will map
obj.rect to the nearest possible object box and then add the feature
vector for the mapped rectangle into #psi.
- get_best_matching_rect(obj.rect) == the rectangle obj.rect gets mapped to
for feature extraction.
!*/
!*/
full_object_detection
get_f
eature_vector
(
full_object_detection
get_f
ull_object_detection
(
const
rectangle
&
rect
,
const
rectangle
&
rect
,
const
feature_vector_type
&
w
,
const
feature_vector_type
&
w
feature_vector_type
&
psi
)
const
;
)
const
;
/*!
/*!
requires
requires
- w.size() >= get_num_dimensions()
- w.size() >= get_num_dimensions()
- is_loaded_with_image() == true
- is_loaded_with_image() == true
- get_num_detection_templates() > 0
- get_num_detection_templates() > 0
- psi.size() >= get_num_dimensions()
(i.e. psi must have preallocated its memory before this function is called)
ensures
ensures
- This function allows you to determine the feature vector used for a sliding window location.
- This function allows you to determine the full_object_detection
Note that this vector is added to psi.
corresponding to a sliding window location. Note that the detect()
- if (rect was produced by a call to detect(), i.e. rect contains an element of dets) then
routine doesn't return the locations of the movable parts in a detected
- #psi == psi + the feature vector corresponding to the sliding window location indicated
object. Therefore, if you are using any movable parts in your model you
by rect.
must use get_full_object_detection() to find out where the movable parts
- If w is the w vector given to detect(), then if we assigned 0 to psi before calling
were detected. To do this, you supply the w and detected rectangle.
get_feature_vector() then we have:
Then the corresponding fully populated full_object_detection will be
- dot(w,#psi) == the score produced by detect() for rect.
returned.
- get_best_matching_rect(rect) == rect
- returns a full_object_detection, OBJ, such that:
- else
- Since scan_image_pyramid is a sliding window classifier system, not all possible rectangles can
be output by detect(). So in the case where rect could not arise from a call to detect(), this
function will map rect to the nearest possible object box and then add the feature vector for
the mapped rectangle into #psi.
- get_best_matching_rect(rect) == the rectangle rect gets mapped to for feature extraction.
- returns a full_object_detection OBJ such that calling get_feature_vector(OBJ,psi)
and get_feature_vector(OBJ.rect,w,psi) on a psi of 0 would both result in the same psi vector being output.
This means that:
- OBJ.rect == rect
- OBJ.rect == rect
- OBJ.movable_parts.size() == get_num_movable_components_per_detection_template()
- OBJ.movable_parts.size() == get_num_movable_components_per_detection_template()
- OBJ.movable_parts == the locations of the movable parts inside this detection.
- OBJ.movable_parts == the locations of the movable parts inside this detection.
...
...
dlib/svm/structural_svm_object_detection_problem.h
View file @
c4c8535d
...
@@ -371,7 +371,7 @@ namespace dlib
...
@@ -371,7 +371,7 @@ namespace dlib
psi
.
set_size
(
get_num_dimensions
());
psi
.
set_size
(
get_num_dimensions
());
psi
=
0
;
psi
=
0
;
for
(
unsigned
long
i
=
0
;
i
<
final_dets
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
final_dets
.
size
();
++
i
)
scanner
.
get_feature_vector
(
final_dets
[
i
],
current_solution
,
psi
);
scanner
.
get_feature_vector
(
scanner
.
get_full_object_detection
(
final_dets
[
i
],
current_solution
)
,
psi
);
#ifdef ENABLE_ASSERTS
#ifdef ENABLE_ASSERTS
const
double
psi_score
=
dot
(
psi
,
current_solution
);
const
double
psi_score
=
dot
(
psi
,
current_solution
);
...
...
dlib/test/object_detector.cpp
View file @
c4c8535d
...
@@ -65,8 +65,9 @@ namespace
...
@@ -65,8 +65,9 @@ namespace
{
{
DLIB_TEST
(
dets
[
j
]
==
dets2
[
j
].
second
);
DLIB_TEST
(
dets
[
j
]
==
dets2
[
j
].
second
);
const
full_object_detection
fdet
=
detector
.
get_scanner
().
get_full_object_detection
(
dets
[
j
],
detector
.
get_w
());
psi
=
0
;
psi
=
0
;
const
full_object_detection
fdet
=
detector
.
get_scanner
().
get_feature_vector
(
det
s
[
j
],
detector
.
get_w
()
,
psi
);
detector
.
get_scanner
().
get_feature_vector
(
f
det
,
psi
);
double
check_score
=
dot
(
psi
,
detector
.
get_w
())
-
thresh
;
double
check_score
=
dot
(
psi
,
detector
.
get_w
())
-
thresh
;
DLIB_TEST
(
std
::
abs
(
check_score
-
dets2
[
j
].
first
)
<
1e-10
);
DLIB_TEST
(
std
::
abs
(
check_score
-
dets2
[
j
].
first
)
<
1e-10
);
...
...
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