Commit 44702809 authored by Davis King's avatar Davis King

Fixed load_image_dataset()'s skip_empty_images() option. It wasn't skipping

images that only have ignore boxes when you load into mmod_rects like it should
have been.
parent c2a9dee8
......@@ -188,6 +188,20 @@ namespace dlib
// ----------------------------------------------------------------------------------------
namespace impl
{
size_t num_non_ignored_boxes (const std::vector<mmod_rect>& rects)
{
size_t cnt = 0;
for (auto& b : rects)
{
if (!b.ignore)
cnt++;
}
return cnt;
}
}
template <
typename array_type
>
......@@ -235,7 +249,7 @@ namespace dlib
}
}
if (!source.should_skip_empty_images() || rects.size() != 0)
if (!source.should_skip_empty_images() || impl::num_non_ignored_boxes(rects) != 0)
{
load_image(img, data.images[i].filename);
if (rects.size() != 0)
......
......@@ -51,8 +51,9 @@ namespace dlib
) const;
/*!
ensures
- returns true if we are supposed to skip images that don't have any boxes
to load when loading an image dataset using load_image_dataset().
- returns true if we are supposed to skip images that don't have any
non-ignored boxes to load when loading an image dataset using
load_image_dataset().
!*/
image_dataset_file boxes_match_label(
......
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