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
347257cb
Commit
347257cb
authored
Oct 27, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made random_cropper use cleaner and unbiased dlib::rand interface.
parent
faf8676a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
random_cropper.h
dlib/image_transforms/random_cropper.h
+5
-5
No files found.
dlib/image_transforms/random_cropper.h
View file @
347257cb
...
@@ -157,7 +157,7 @@ namespace dlib
...
@@ -157,7 +157,7 @@ namespace dlib
DLIB_CASSERT
(
images
.
size
()
==
rects
.
size
());
DLIB_CASSERT
(
images
.
size
()
==
rects
.
size
());
size_t
idx
;
size_t
idx
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
rnd_mutex
);
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
rnd_mutex
);
idx
=
rnd
.
get_
random_64bit_number
()
%
images
.
size
(
);
idx
=
rnd
.
get_
integer
(
images
.
size
()
);
}
}
(
*
this
)(
images
[
idx
],
rects
[
idx
],
crop
,
crop_rects
);
(
*
this
)(
images
[
idx
],
rects
[
idx
],
crop
,
crop_rects
);
}
}
...
@@ -290,9 +290,9 @@ namespace dlib
...
@@ -290,9 +290,9 @@ namespace dlib
)
)
{
{
DLIB_CASSERT
(
has_non_ignored_box
(
rects
));
DLIB_CASSERT
(
has_non_ignored_box
(
rects
));
size_t
idx
=
rnd
.
get_
random_64bit_number
()
%
rects
.
size
(
);
size_t
idx
=
rnd
.
get_
integer
(
rects
.
size
()
);
while
(
rects
[
idx
].
ignore
)
while
(
rects
[
idx
].
ignore
)
idx
=
rnd
.
get_
random_64bit_number
()
%
rects
.
size
(
);
idx
=
rnd
.
get_
integer
(
rects
.
size
()
);
return
idx
;
return
idx
;
}
}
...
@@ -311,8 +311,8 @@ namespace dlib
...
@@ -311,8 +311,8 @@ namespace dlib
auto
scale
=
rnd
.
get_double_in_range
(
mins
,
maxs
);
auto
scale
=
rnd
.
get_double_in_range
(
mins
,
maxs
);
rectangle
rect
(
scale
*
dims
.
cols
,
scale
*
dims
.
rows
);
rectangle
rect
(
scale
*
dims
.
cols
,
scale
*
dims
.
rows
);
// randomly shift the box around
// randomly shift the box around
point
offset
(
rnd
.
get_
random_32bit_number
()
%
(
1
+
img
.
nc
()
-
rect
.
width
()),
point
offset
(
rnd
.
get_
integer
(
1
+
img
.
nc
()
-
rect
.
width
()),
rnd
.
get_
random_32bit_number
()
%
(
1
+
img
.
nr
()
-
rect
.
height
()));
rnd
.
get_
integer
(
1
+
img
.
nr
()
-
rect
.
height
()));
return
move_rect
(
rect
,
offset
);
return
move_rect
(
rect
,
offset
);
}
}
...
...
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