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
ae3cb6b7
Commit
ae3cb6b7
authored
Sep 03, 2016
by
Davis King
Browse files
Made load_image_dataset() more generic. Now it can operate on arrays of images
that use std::vector in addition to dlib::array.
parent
bb7d2ef5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
40 deletions
+42
-40
dlib/data_io/load_image_dataset.h
dlib/data_io/load_image_dataset.h
+12
-15
dlib/data_io/load_image_dataset_abstract.h
dlib/data_io/load_image_dataset_abstract.h
+30
-25
No files found.
dlib/data_io/load_image_dataset.h
View file @
ae3cb6b7
...
@@ -84,11 +84,10 @@ namespace dlib
...
@@ -84,11 +84,10 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
const
image_dataset_file
&
source
const
image_dataset_file
&
source
)
)
...
@@ -109,6 +108,7 @@ namespace dlib
...
@@ -109,6 +108,7 @@ namespace dlib
set_current_dir
(
get_parent_directory
(
file
(
source
.
get_filename
())));
set_current_dir
(
get_parent_directory
(
file
(
source
.
get_filename
())));
typedef
typename
array_type
::
value_type
image_type
;
image_type
img
;
image_type
img
;
...
@@ -167,11 +167,10 @@ namespace dlib
...
@@ -167,11 +167,10 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
const
std
::
string
&
filename
const
std
::
string
&
filename
)
)
...
@@ -184,16 +183,16 @@ namespace dlib
...
@@ -184,16 +183,16 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
const
image_dataset_file
&
source
,
const
image_dataset_file
&
source
,
std
::
vector
<
std
::
string
>&
parts_list
std
::
vector
<
std
::
string
>&
parts_list
)
)
{
{
typedef
typename
array_type
::
value_type
image_type
;
parts_list
.
clear
();
parts_list
.
clear
();
images
.
clear
();
images
.
clear
();
object_locations
.
clear
();
object_locations
.
clear
();
...
@@ -287,11 +286,10 @@ namespace dlib
...
@@ -287,11 +286,10 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
const
image_dataset_file
&
source
const
image_dataset_file
&
source
)
)
...
@@ -303,11 +301,10 @@ namespace dlib
...
@@ -303,11 +301,10 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
const
std
::
string
&
filename
const
std
::
string
&
filename
)
)
...
...
dlib/data_io/load_image_dataset_abstract.h
View file @
ae3cb6b7
...
@@ -121,18 +121,19 @@ namespace dlib
...
@@ -121,18 +121,19 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
const
image_dataset_file
&
source
const
image_dataset_file
&
source
);
);
/*!
/*!
requires
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- array_type == An array of images. This is anything with an interface that
- pixel_traits<typename image_type::type> is defined
looks like std::vector<some generic image type> where a "generic image" is
anything that implements the generic image interface defined in
dlib/image_processing/generic_image.h.
ensures
ensures
- This routine loads the images and their associated object boxes from the
- This routine loads the images and their associated object boxes from the
image metadata file indicated by source.get_filename(). This metadata file
image metadata file indicated by source.get_filename(). This metadata file
...
@@ -162,18 +163,19 @@ namespace dlib
...
@@ -162,18 +163,19 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
object_locations
,
const
std
::
string
&
filename
const
std
::
string
&
filename
);
);
/*!
/*!
requires
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- array_type == An array of images. This is anything with an interface that
- pixel_traits<typename image_type::type> is defined
looks like std::vector<some generic image type> where a "generic image" is
anything that implements the generic image interface defined in
dlib/image_processing/generic_image.h.
ensures
ensures
- performs: return load_image_dataset(images, object_locations, image_dataset_file(filename));
- performs: return load_image_dataset(images, object_locations, image_dataset_file(filename));
(i.e. it ignores box labels and therefore loads all the boxes in the dataset)
(i.e. it ignores box labels and therefore loads all the boxes in the dataset)
...
@@ -183,19 +185,20 @@ namespace dlib
...
@@ -183,19 +185,20 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
const
image_dataset_file
&
source
,
const
image_dataset_file
&
source
,
std
::
vector
<
std
::
string
>&
parts_list
std
::
vector
<
std
::
string
>&
parts_list
);
);
/*!
/*!
requires
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- array_type == An array of images. This is anything with an interface that
- pixel_traits<typename image_type::type> is defined
looks like std::vector<some generic image type> where a "generic image" is
anything that implements the generic image interface defined in
dlib/image_processing/generic_image.h.
ensures
ensures
- This routine loads the images and their associated object locations from the
- This routine loads the images and their associated object locations from the
image metadata file indicated by source.get_filename(). This metadata file
image metadata file indicated by source.get_filename(). This metadata file
...
@@ -237,18 +240,19 @@ namespace dlib
...
@@ -237,18 +240,19 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
const
image_dataset_file
&
source
const
image_dataset_file
&
source
);
);
/*!
/*!
requires
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- array_type == An array of images. This is anything with an interface that
- pixel_traits<typename image_type::type> is defined
looks like std::vector<some generic image type> where a "generic image" is
anything that implements the generic image interface defined in
dlib/image_processing/generic_image.h.
ensures
ensures
- performs: return load_image_dataset(images, object_locations, source, parts_list);
- performs: return load_image_dataset(images, object_locations, source, parts_list);
(i.e. this function simply calls the above function and discards the output
(i.e. this function simply calls the above function and discards the output
...
@@ -259,18 +263,19 @@ namespace dlib
...
@@ -259,18 +263,19 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
typename
image_type
,
typename
array_type
typename
MM
>
>
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
std
::
vector
<
std
::
vector
<
rectangle
>
>
load_image_dataset
(
array
<
image
_type
,
MM
>
&
images
,
array_type
&
images
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
std
::
vector
<
std
::
vector
<
full_object_detection
>
>&
object_locations
,
const
std
::
string
&
filename
const
std
::
string
&
filename
);
);
/*!
/*!
requires
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- array_type == An array of images. This is anything with an interface that
- pixel_traits<typename image_type::type> is defined
looks like std::vector<some generic image type> where a "generic image" is
anything that implements the generic image interface defined in
dlib/image_processing/generic_image.h.
ensures
ensures
- performs: return load_image_dataset(images, object_locations, image_dataset_file(filename));
- performs: return load_image_dataset(images, object_locations, image_dataset_file(filename));
(i.e. it ignores box labels and therefore loads all the boxes in the dataset)
(i.e. it ignores box labels and therefore loads all the boxes in the dataset)
...
...
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