| 503 | // ---------------------------------------------------------------------------------------- |
| 504 | |
| 505 | int ignore_overlapped_boxes( |
| 506 | std::vector<truth_instance>& truth_instances, |
| 507 | const test_box_overlap& overlaps |
| 508 | ) |
| 509 | /*! |
| 510 | ensures |
| 511 | - Whenever two rectangles in boxes overlap, according to overlaps(), we set the |
| 512 | smallest box to ignore. |
| 513 | - returns the number of newly ignored boxes. |
| 514 | !*/ |
| 515 | { |
| 516 | int num_ignored = 0; |
| 517 | for (size_t i = 0, end = truth_instances.size(); i < end; ++i) |
| 518 | { |
| 519 | auto& box_i = truth_instances[i].mmod_rect; |
| 520 | if (box_i.ignore) |
| 521 | continue; |
| 522 | for (size_t j = i+1; j < end; ++j) |
| 523 | { |
| 524 | auto& box_j = truth_instances[j].mmod_rect; |
| 525 | if (box_j.ignore) |
| 526 | continue; |
| 527 | if (overlaps(box_i, box_j)) |
| 528 | { |
| 529 | ++num_ignored; |
| 530 | if(box_i.rect.area() < box_j.rect.area()) |
| 531 | box_i.ignore = true; |
| 532 | else |
| 533 | box_j.ignore = true; |
| 534 | } |
| 535 | } |
| 536 | } |
| 537 | return num_ignored; |
| 538 | } |
| 539 | |
| 540 | std::vector<truth_instance> load_truth_instances(const image_info& info) |
| 541 | { |
no test coverage detected