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
d9ef460c
Commit
d9ef460c
authored
Sep 09, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some testing/debugging code like internal asserts, cout
statements, and other cruft.
parent
167ddaf9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
57 deletions
+2
-57
object_detector.h
dlib/image_processing/object_detector.h
+0
-5
scan_image_pyramid.h
dlib/image_processing/scan_image_pyramid.h
+0
-16
structural_svm_object_detection_problem.h
dlib/svm/structural_svm_object_detection_problem.h
+2
-36
No files found.
dlib/image_processing/object_detector.h
View file @
d9ef460c
...
...
@@ -205,14 +205,9 @@ namespace dlib
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>
dets
;
const
double
thresh
=
w
(
scanner
.
get_num_dimensions
());
std
::
cout
<<
"!!!!! thresh: "
<<
thresh
<<
std
::
endl
;
scanner
.
load
(
img
);
scanner
.
detect
(
w
,
dets
,
thresh
);
std
::
cout
<<
"dets.size(): "
<<
dets
.
size
()
<<
std
::
endl
;
for
(
unsigned
long
i
=
0
;
i
<
dets
.
size
()
&&
final_dets
.
size
()
<
100
;
++
i
)
{
if
(
overlaps_any_box
(
final_dets
,
dets
[
i
].
second
))
...
...
dlib/image_processing/scan_image_pyramid.h
View file @
d9ef460c
...
...
@@ -212,7 +212,6 @@ namespace dlib
if
(
levels
>=
max_pyramid_levels
)
break
;
}
std
::
cout
<<
"levels: "
<<
levels
<<
std
::
endl
;
if
(
feats
.
max_size
()
<
levels
)
feats
.
set_max_size
(
levels
);
...
...
@@ -518,29 +517,14 @@ namespace dlib
point
p
=
point_dets
[
j
].
second
;
p
=
feats
[
l
].
feat_to_image_space
(
p
);
rectangle
rect
=
translate_rect
(
det_templates
[
i
].
object_box
,
p
);
rectangle
old_rect
=
rect
;
// TODO remove later
rect
=
pyr
.
rect_up
(
rect
,
l
);
DLIB_CASSERT
(
pyr
.
rect_down
(
rect
,
l
)
==
old_rect
,
""
);
dets
.
push_back
(
std
::
make_pair
(
score
,
rect
));
{
rectangle
r
=
pyr
.
rect_down
(
rect
,
l
);
const
point
origin
=
center
(
r
);
DLIB_CASSERT
(
origin
==
p
,
origin
<<
" "
<<
p
);
DLIB_CASSERT
(
feats
[
l
].
image_to_feat_space
(
origin
)
==
point_dets
[
j
].
second
,
""
);
}
}
}
}
std
::
cout
<<
"THRESH: "
<<
thresh
<<
std
::
endl
;
std
::
cout
<<
"NUM POINT DETS FOUND: "
<<
dets
.
size
()
<<
std
::
endl
;
std
::
sort
(
dets
.
rbegin
(),
dets
.
rend
(),
compare_pair_rect
);
}
// ----------------------------------------------------------------------------------------
...
...
dlib/svm/structural_svm_object_detection_problem.h
View file @
d9ef460c
...
...
@@ -104,9 +104,6 @@ namespace dlib
std
::
vector
<
rectangle
>
mapped_rects
;
scanner
.
get_feature_vector
(
rects
[
idx
],
psi
,
mapped_rects
);
psi
(
scanner
.
get_num_dimensions
())
=
-
1
.
0
*
rects
[
idx
].
size
();
std
::
cout
<<
"truth psi length: "
<<
length
(
psi
)
<<
std
::
endl
;
std
::
cout
<<
"max truth psi: "
<<
max
(
abs
(
psi
))
<<
std
::
endl
;
std
::
cout
<<
"index of max truth psi: "
<<
index_of_max
(
abs
(
psi
))
<<
std
::
endl
;
// check if any of the boxes overlap. If they do then it is impossible for
// us to learn to correctly classify this sample
...
...
@@ -149,9 +146,6 @@ namespace dlib
}
}
//std::cout << "TRUTH PSI: "<< trans(psi) << std::endl;
//abort();
}
virtual
void
separation_oracle
(
...
...
@@ -178,7 +172,7 @@ namespace dlib
// on a truth rectangle.
loss
=
rects
[
idx
].
size
()
*
loss_per_error
;
// Measure the
risk
loss augmented score for the detections which hit a truth rect.
// Measure the loss augmented score for the detections which hit a truth rect.
std
::
vector
<
double
>
truth_score_hits
(
rects
[
idx
].
size
(),
0
);
std
::
vector
<
rectangle
>
final_dets
;
...
...
@@ -206,7 +200,6 @@ namespace dlib
}
double
expected_psi_dot_w
=
0
;
// keep track of which truth boxes we have hit so far.
std
::
vector
<
bool
>
hit_truth_table
(
rects
[
idx
].
size
(),
false
);
final_dets
.
clear
();
...
...
@@ -230,13 +223,11 @@ namespace dlib
{
hit_truth_table
[
truth
.
second
]
=
true
;
final_dets
.
push_back
(
dets
[
i
].
second
);
expected_psi_dot_w
+=
dets
[
i
].
first
;
loss
-=
loss_per_error
;
}
else
{
final_dets
.
push_back
(
dets
[
i
].
second
);
expected_psi_dot_w
+=
dets
[
i
].
first
;
loss
+=
loss_per_error
;
}
}
...
...
@@ -245,41 +236,16 @@ namespace dlib
{
// didn't hit anything
final_dets
.
push_back
(
dets
[
i
].
second
);
expected_psi_dot_w
+=
dets
[
i
].
first
;
loss
+=
loss_per_error
;
}
}
psi
.
set_size
(
get_num_dimensions
());
psi
=
0
;
//feature_vector_type other_psi;
//other_psi.set_size(get_num_dimensions());
//other_psi = 0;
//scanner.get_feature_vector(final_dets, other_psi);
std
::
vector
<
rectangle
>
mapped_rects
;
scanner
.
get_feature_vector
(
final_dets
,
psi
,
mapped_rects
);
DLIB_CASSERT
(
mapped_rects
.
size
()
==
final_dets
.
size
(),
""
);
if
(
std
::
abs
(
expected_psi_dot_w
-
dot
(
psi
,
current_solution
))
>
1e-8
)
{
std
::
cout
<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
<<
std
::
endl
;
std
::
cout
<<
" psi dot w: "
<<
dot
(
psi
,
current_solution
)
<<
std
::
endl
;
std
::
cout
<<
" expected psi dot w: "
<<
expected_psi_dot_w
<<
std
::
endl
;
std
::
cout
<<
" final_dets.size(): "
<<
final_dets
.
size
()
<<
std
::
endl
;
for
(
unsigned
long
i
=
0
;
i
<
final_dets
.
size
();
++
i
)
{
DLIB_CASSERT
(
final_dets
[
i
]
==
mapped_rects
[
i
],
final_dets
[
i
]
<<
" "
<<
mapped_rects
[
i
]
<<
" i: "
<<
i
);
}
abort
();
}
for
(
unsigned
long
i
=
0
;
i
<
final_dets
.
size
();
++
i
)
{
DLIB_CASSERT
(
final_dets
[
i
]
==
mapped_rects
[
i
],
final_dets
[
i
]
<<
" "
<<
mapped_rects
[
i
]
<<
" i: "
<<
i
);
}
psi
(
scanner
.
get_num_dimensions
())
=
-
1
.
0
*
final_dets
.
size
();
std
::
cout
<<
"LOSS: "
<<
loss
<<
std
::
endl
;
std
::
cout
<<
" final_dets.size(): "
<<
final_dets
.
size
()
<<
std
::
endl
;
//std::cout << "PSI: "<< trans(psi) << std::endl;
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