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
c38d7e55
Commit
c38d7e55
authored
Feb 13, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored the random feature selection function so that it always has bounded
runtime, even with very bad parameter selections.
parent
ef4b7a0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
shape_predictor_trainer.h
dlib/image_processing/shape_predictor_trainer.h
+9
-6
No files found.
dlib/image_processing/shape_predictor_trainer.h
View file @
c38d7e55
...
...
@@ -523,15 +523,18 @@ namespace dlib
{
const
double
lambda
=
get_lambda
();
impl
::
split_feature
feat
;
double
accept_prob
;
do
const
size_t
max_iters
=
get_feature_pool_size
()
*
get_feature_pool_size
()
;
for
(
size_t
i
=
0
;
i
<
max_iters
;
++
i
)
{
feat
.
idx1
=
rnd
.
get_random_32bit_number
()
%
get_feature_pool_size
();
feat
.
idx2
=
rnd
.
get_random_32bit_number
()
%
get_feature_pool_size
();
feat
.
idx1
=
rnd
.
get_integer
(
get_feature_pool_size
());
feat
.
idx2
=
rnd
.
get_integer
(
get_feature_pool_size
());
while
(
feat
.
idx1
==
feat
.
idx2
)
feat
.
idx2
=
rnd
.
get_integer
(
get_feature_pool_size
());
const
double
dist
=
length
(
pixel_coordinates
[
feat
.
idx1
]
-
pixel_coordinates
[
feat
.
idx2
]);
accept_prob
=
std
::
exp
(
-
dist
/
lambda
);
const
double
accept_prob
=
std
::
exp
(
-
dist
/
lambda
);
if
(
accept_prob
>
rnd
.
get_random_double
())
break
;
}
while
(
feat
.
idx1
==
feat
.
idx2
||
!
(
accept_prob
>
rnd
.
get_random_double
()));
feat
.
thresh
=
(
rnd
.
get_random_double
()
*
256
-
128
)
/
2
.
0
;
...
...
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