6 #include <forward_list>
10 #include "../ma_types.h"
16 template <typename T, std::enable_if_t<std::is_base_of<ma_bbox_t, T>::value,
bool> =
true>
18 const float x1 = std::max(box1.x, box2.x);
19 const float y1 = std::max(box1.y, box2.y);
20 const float x2 = std::min(box1.x + box1.w, box2.x + box2.w);
21 const float y2 = std::min(box1.y + box1.h, box2.y + box2.h);
22 const float w = std::max(0.0f, x2 - x1);
23 const float h = std::max(0.0f, y2 - y1);
24 const float inter = w * h;
25 const float d = box1.w * box1.h + box2.w * box2.h - inter;
26 if (std::abs(d) < std::numeric_limits<float>::epsilon()) [[unlikely]] {
32 void nms(std::forward_list<ma_bbox_t>& bboxes,
float threshold_iou,
float threshold_score,
bool soft_nms,
bool multi_target);
34 void nms(std::forward_list<ma_bbox_ext_t>& bboxes,
float threshold_iou,
float threshold_score,
bool soft_nms,
bool multi_target);
36 void nms(std::forward_list<ma_keypoint3f_t>& decodings,
const float iou_thr,
bool should_nms_cross_classes);
Definition: ma_anchors.cpp:3
float compute_iou(const T &box1, const T &box2)
Definition: ma_nms.h:17
void nms(std::forward_list< ma_bbox_t > &bboxes, float threshold_iou, float threshold_score, bool soft_nms, bool multi_target)
Definition: ma_nms.cpp:48