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
cd5147b2
Commit
cd5147b2
authored
Apr 14, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made both versions of load_image_dataset() support the skip_empty_images option
parent
8bde794c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
load_image_dataset.h
dlib/data_io/load_image_dataset.h
+10
-4
load_image_dataset_abstract.h
dlib/data_io/load_image_dataset_abstract.h
+7
-2
No files found.
dlib/data_io/load_image_dataset.h
View file @
cd5147b2
...
@@ -97,7 +97,8 @@ namespace dlib
...
@@ -97,7 +97,8 @@ namespace dlib
array
<
image_type
,
MM
>&
images
,
array
<
image_type
,
MM
>&
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
,
const
std
::
string
&
label
const
std
::
string
&
label
,
bool
skip_empty_images
=
false
)
)
{
{
images
.
clear
();
images
.
clear
();
...
@@ -144,11 +145,10 @@ namespace dlib
...
@@ -144,11 +145,10 @@ namespace dlib
ret_parts_list
.
push_back
(
*
i
);
ret_parts_list
.
push_back
(
*
i
);
}
}
image
s
.
resize
(
data
.
images
.
size
())
;
image
_type
img
;
std
::
vector
<
full_object_detection
>
object_dets
;
std
::
vector
<
full_object_detection
>
object_dets
;
for
(
unsigned
long
i
=
0
;
i
<
data
.
images
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
data
.
images
.
size
();
++
i
)
{
{
load_image
(
images
[
i
],
data
.
images
[
i
].
filename
);
object_dets
.
clear
();
object_dets
.
clear
();
for
(
unsigned
long
j
=
0
;
j
<
data
.
images
[
i
].
boxes
.
size
();
++
j
)
for
(
unsigned
long
j
=
0
;
j
<
data
.
images
[
i
].
boxes
.
size
();
++
j
)
{
{
...
@@ -167,7 +167,13 @@ namespace dlib
...
@@ -167,7 +167,13 @@ namespace dlib
object_dets
.
push_back
(
full_object_detection
(
data
.
images
[
i
].
boxes
[
j
].
rect
,
partlist
));
object_dets
.
push_back
(
full_object_detection
(
data
.
images
[
i
].
boxes
[
j
].
rect
,
partlist
));
}
}
}
}
object_locations
.
push_back
(
object_dets
);
if
(
!
skip_empty_images
||
object_dets
.
size
()
!=
0
)
{
object_locations
.
push_back
(
object_dets
);
load_image
(
img
,
data
.
images
[
i
].
filename
);
images
.
push_back
(
img
);
}
}
}
set_current_dir
(
old_working_dir
);
set_current_dir
(
old_working_dir
);
...
...
dlib/data_io/load_image_dataset_abstract.h
View file @
cd5147b2
...
@@ -82,7 +82,8 @@ namespace dlib
...
@@ -82,7 +82,8 @@ namespace dlib
array
<
image_type
,
MM
>&
images
,
array
<
image_type
,
MM
>&
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
,
const
std
::
string
&
label
const
std
::
string
&
label
,
bool
skip_empty_images
=
false
);
);
/*!
/*!
requires
requires
...
@@ -95,7 +96,8 @@ namespace dlib
...
@@ -95,7 +96,8 @@ namespace dlib
- The difference between this function and the version of load_image_dataset()
- The difference between this function and the version of load_image_dataset()
defined above is that this version will also load object part information and
defined above is that this version will also load object part information and
thus fully populates the full_object_detection objects.
thus fully populates the full_object_detection objects.
- #images.size() == the number of images in the metadata file
- #images.size() == The number of images loaded from the metadata file. This
is all the images listed in the file unless skip_empty_images is set to true.
- #images.size() == #object_locations.size()
- #images.size() == #object_locations.size()
- This routine is capable of loading any image format which can be read
- This routine is capable of loading any image format which can be read
by the load_image() routine.
by the load_image() routine.
...
@@ -105,6 +107,9 @@ namespace dlib
...
@@ -105,6 +107,9 @@ namespace dlib
- #images[i] == a copy of the ith image from the dataset.
- #images[i] == a copy of the ith image from the dataset.
- #object_locations[i] == a vector of all the object detections associated
- #object_locations[i] == a vector of all the object detections associated
with #images[i].
with #images[i].
- if (skip_empty_images == true) then
- #object_locations[i].size() != 0
(i.e. only images with detection boxes in them will be loaded.)
- for all valid j:
- for all valid j:
- #object_locations[i][j].num_parts() == RETURNED_PARTS.size()
- #object_locations[i][j].num_parts() == RETURNED_PARTS.size()
- for all valid k:
- for all valid k:
...
...
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