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
a215c494
Commit
a215c494
authored
Sep 28, 2016
by
Davis King
Browse files
Added missing requires clauses and asserts.
parent
d41613d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
dlib/image_transforms/random_cropper.h
dlib/image_transforms/random_cropper.h
+3
-1
dlib/image_transforms/random_cropper_abstract.h
dlib/image_transforms/random_cropper_abstract.h
+18
-0
No files found.
dlib/image_transforms/random_cropper.h
View file @
a215c494
...
@@ -135,6 +135,7 @@ namespace dlib
...
@@ -135,6 +135,7 @@ namespace dlib
std
::
vector
<
mmod_rect
>&
crop_rects
std
::
vector
<
mmod_rect
>&
crop_rects
)
)
{
{
DLIB_CASSERT
(
num_rows
(
img
)
*
num_columns
(
img
)
!=
0
);
chip_details
crop_plan
;
chip_details
crop_plan
;
bool
should_flip_crop
;
bool
should_flip_crop
;
make_crop_plan
(
img
,
rects
,
crop_plan
,
should_flip_crop
);
make_crop_plan
(
img
,
rects
,
crop_plan
,
should_flip_crop
);
...
@@ -233,9 +234,10 @@ namespace dlib
...
@@ -233,9 +234,10 @@ namespace dlib
template
<
typename
image_type
>
template
<
typename
image_type
>
rectangle
make_random_cropping_rect_resnet
(
rectangle
make_random_cropping_rect_resnet
(
const
image_type
&
img
const
image_type
&
img
_
)
)
{
{
const_image_view
<
image_type
>
img
(
img_
);
// figure out what rectangle we want to crop from the image
// figure out what rectangle we want to crop from the image
double
mins
=
0.1
,
maxs
=
0.95
;
double
mins
=
0.1
,
maxs
=
0.95
;
auto
scale
=
rnd
.
get_double_in_range
(
mins
,
maxs
);
auto
scale
=
rnd
.
get_double_in_range
(
mins
,
maxs
);
...
...
dlib/image_transforms/random_cropper_abstract.h
View file @
a215c494
...
@@ -174,6 +174,11 @@ namespace dlib
...
@@ -174,6 +174,11 @@ namespace dlib
/*!
/*!
requires
requires
- images.size() == rects.size()
- images.size() == rects.size()
- for all valid i:
- images[i].size() != 0
- array_type is a type with an interface compatible with dlib::array or
std::vector and it must in turn contain image objects that implement the
interface defined in dlib/image_processing/generic_image.h
ensures
ensures
- Randomly extracts num_crops chips from images. We also copy the object
- Randomly extracts num_crops chips from images. We also copy the object
metadata for each extracted crop and store it into #crop_rects. In
metadata for each extracted crop and store it into #crop_rects. In
...
@@ -195,6 +200,13 @@ namespace dlib
...
@@ -195,6 +200,13 @@ namespace dlib
/*!
/*!
requires
requires
- images.size() == rects.size()
- images.size() == rects.size()
- for all valid i:
- images[i].size() != 0
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- array_type is a type with an interface compatible with dlib::array or
std::vector and it must in turn contain image objects that implement the
interface defined in dlib/image_processing/generic_image.h
ensures
ensures
- Selects a random image and creates a random crop from it. Specifically,
- Selects a random image and creates a random crop from it. Specifically,
we pick a random index IDX < images.size() and then execute
we pick a random index IDX < images.size() and then execute
...
@@ -212,6 +224,12 @@ namespace dlib
...
@@ -212,6 +224,12 @@ namespace dlib
std
::
vector
<
mmod_rect
>&
crop_rects
std
::
vector
<
mmod_rect
>&
crop_rects
);
);
/*!
/*!
requires
- img.size() != 0
- image_type1 == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- image_type2 == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
ensures
- Extracts a random crop from img and copies over the mmod_rect objects in
- Extracts a random crop from img and copies over the mmod_rect objects in
rects to #crop_rects if they are contained inside the crop. Moreover,
rects to #crop_rects if they are contained inside the crop. Moreover,
...
...
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