Commit cd5147b2 authored by Davis King's avatar Davis King

Made both versions of load_image_dataset() support the skip_empty_images option

parent 8bde794c
......@@ -97,7 +97,8 @@ namespace dlib
array<image_type,MM>& images,
std::vector<std::vector<full_object_detection> >& object_locations,
const std::string& filename,
const std::string& label
const std::string& label,
bool skip_empty_images = false
)
{
images.clear();
......@@ -144,11 +145,10 @@ namespace dlib
ret_parts_list.push_back(*i);
}
images.resize(data.images.size());
image_type img;
std::vector<full_object_detection> object_dets;
for (unsigned long i = 0; i < data.images.size(); ++i)
{
load_image(images[i], data.images[i].filename);
object_dets.clear();
for (unsigned long j = 0; j < data.images[i].boxes.size(); ++j)
{
......@@ -167,7 +167,13 @@ namespace dlib
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);
......
......@@ -82,7 +82,8 @@ namespace dlib
array<image_type,MM>& images,
std::vector<std::vector<full_object_detection> >& object_locations,
const std::string& filename,
const std::string& label
const std::string& label,
bool skip_empty_images = false
);
/*!
requires
......@@ -95,7 +96,8 @@ namespace dlib
- 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
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()
- This routine is capable of loading any image format which can be read
by the load_image() routine.
......@@ -105,6 +107,9 @@ namespace dlib
- #images[i] == a copy of the ith image from the dataset.
- #object_locations[i] == a vector of all the object detections associated
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:
- #object_locations[i][j].num_parts() == RETURNED_PARTS.size()
- for all valid k:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment