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
bf0ed361
"docs/basic_usage/native_api.ipynb" did not exist on "43f93f632cb51518bc68a00ac78dd089f9e94294"
Commit
bf0ed361
authored
Dec 26, 2011
by
Davis King
Browse files
Refactored code into a cleaner form.
parent
1bb12d6a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
37 deletions
+35
-37
dlib/image_processing/scan_image_pyramid.h
dlib/image_processing/scan_image_pyramid.h
+16
-22
dlib/image_processing/scan_image_pyramid_abstract.h
dlib/image_processing/scan_image_pyramid_abstract.h
+14
-13
dlib/svm/structural_svm_object_detection_problem.h
dlib/svm/structural_svm_object_detection_problem.h
+5
-2
No files found.
dlib/image_processing/scan_image_pyramid.h
View file @
bf0ed361
...
...
@@ -85,7 +85,7 @@ namespace dlib
)
const
;
void
get_feature_vector
(
const
std
::
vector
<
rectangle
>
&
rect
s
,
const
rectangle
&
rect
,
feature_vector_type
&
psi
)
const
;
...
...
@@ -646,7 +646,7 @@ namespace dlib
>
void
scan_image_pyramid
<
Pyramid_type
,
Feature_extractor_type
>::
get_feature_vector
(
const
std
::
vector
<
rectangle
>
&
rect
s
,
const
rectangle
&
rect
,
feature_vector_type
&
psi
)
const
{
...
...
@@ -663,16 +663,11 @@ namespace dlib
<<
"
\n\t
this: "
<<
this
);
psi
=
0
;
pyramid_type
pyr
;
for
(
unsigned
long
i
=
0
;
i
<
rects
.
size
();
++
i
)
{
rectangle
mapped_rect
;
detection_template
best_template
;
unsigned
long
best_level
;
get_mapped_rect_and_metadata
(
rect
s
[
i
]
,
mapped_rect
,
best_template
,
best_level
);
get_mapped_rect_and_metadata
(
rect
,
mapped_rect
,
best_template
,
best_level
);
for
(
unsigned
long
j
=
0
;
j
<
best_template
.
rects
.
size
();
++
j
)
{
...
...
@@ -691,7 +686,6 @@ namespace dlib
}
}
}
}
}
...
...
dlib/image_processing/scan_image_pyramid_abstract.h
View file @
bf0ed361
...
...
@@ -303,7 +303,7 @@ namespace dlib
!*/
void
get_feature_vector
(
const
std
::
vector
<
rectangle
>
&
rects
,
const
rectangle
&
rects
,
feature_vector_type
&
psi
)
const
;
/*!
...
...
@@ -312,20 +312,21 @@ namespace dlib
- get_num_detection_templates() > 0
- psi.size() >= get_num_dimensions()
ensures
- This function allows you to determine the feature vector used for a sliding window location
or the sum of such vectors for a set of locations.
- if (rects was produced by a call to detect(), i.e. rects contains the contents of dets) then
- #psi == the sum of feature vectors corresponding to the sliding window locations contained
in rects.
- Let w denote the w vector given to detect(), then we have:
- dot(w,#psi) == sum of scores of the dets produced by detect()
- This function allows you to determine the feature vector used for a sliding window location.
Note that this vector is added to psi.
- if (rect was produced by a call to detect(), i.e. rect contains an element of dets) then
- #psi == psi + the feature vector corresponding to the sliding window location indicated
by rect.
- Let w denote the w vector given to detect(), then if we assigned psi to 0 before calling
get_feature_vector() then we have:
- dot(w,#psi) == the score produced by detect() for rect.
- get_best_matching_rect(rect) == rect
- 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 rects contains rectangles which could not arise
from a call to detect(), this function will map the rectangles in rects to the nearest possible
object boxes and then store the sum of feature vectors for the mapped rectangles into #psi.
- for all valid i: get_best_matching_rect(rects[i]) == the rectangle rects[i] gets mapped to for
feature extraction.
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.
!*/
};
...
...
dlib/svm/structural_svm_object_detection_problem.h
View file @
bf0ed361
...
...
@@ -156,10 +156,12 @@ namespace dlib
scanner
.
load
(
images
[
idx
]);
psi
.
set_size
(
get_num_dimensions
());
std
::
vector
<
rectangle
>
mapped_rects
;
scanner
.
get_feature_vector
(
truth_rects
[
idx
],
psi
);
psi
=
0
;
for
(
unsigned
long
i
=
0
;
i
<
truth_rects
[
idx
].
size
();
++
i
)
{
mapped_rects
.
push_back
(
scanner
.
get_best_matching_rect
(
truth_rects
[
idx
][
i
]));
scanner
.
get_feature_vector
(
truth_rects
[
idx
][
i
],
psi
);
}
psi
(
scanner
.
get_num_dimensions
())
=
-
1.0
*
truth_rects
[
idx
].
size
();
...
...
@@ -332,7 +334,8 @@ namespace dlib
psi
.
set_size
(
get_num_dimensions
());
psi
=
0
;
scanner
.
get_feature_vector
(
final_dets
,
psi
);
for
(
unsigned
long
i
=
0
;
i
<
final_dets
.
size
();
++
i
)
scanner
.
get_feature_vector
(
final_dets
[
i
],
psi
);
psi
(
scanner
.
get_num_dimensions
())
=
-
1.0
*
final_dets
.
size
();
}
...
...
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