Commit a2c152e8 authored by Davis King's avatar Davis King

Made --cluster skip empty images

parent b040e654
......@@ -111,6 +111,18 @@ double mean_aspect_ratio (
// ----------------------------------------------------------------------------------------
bool has_non_ignored_boxes (const image_dataset_metadata::image& img)
{
for (auto&& b : img.boxes)
{
if (!b.ignore)
return true;
}
return false;
}
// ----------------------------------------------------------------------------------------
int cluster_dataset(
const dlib::command_line_parser& parser
)
......@@ -140,8 +152,9 @@ int cluster_dataset(
for (unsigned long i = 0; i < data.images.size(); ++i)
{
pbar.print_status(i);
if (data.images[i].boxes.size() == 0)
if (!has_non_ignored_boxes(data.images[i]))
continue;
array2d<rgb_pixel> img, chip;
load_image(img, data.images[i].filename);
......@@ -181,8 +194,9 @@ int cluster_dataset(
{
idata[i].first = std::numeric_limits<double>::infinity();
idata[i].second.filename = data.images[i].filename;
if (data.images[i].boxes.size() == 0)
if (!has_non_ignored_boxes(data.images[i]))
continue;
for (unsigned long j = 0; j < data.images[i].boxes.size(); ++j)
{
idata[i].second.boxes.push_back(data.images[i].boxes[j]);
......
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