NonMaxSuppression
===================
对检测框进行非极大值抑制（Non-Maximum Suppression, NMS），用于在目标检测中选取得分较高且重叠度低的边界框，并去除那些重叠度较高的低得分框。其目的是减少冗余边界框，提高目标检测的准确性。

.. math::

    \text{对于每个类别 } c, \text{在同一批次下保留置信度较高且 IoU 小于阈值的框:} 

    \text{若 } \mathrm{IoU}(box_i, box_j) > \text{iou\_threshold} \Rightarrow \text{抑制 } box_j,  

.. math::
    IoU=\frac{intersec\_area}{(cand.get\_area() + box.get\_area() - intersec\_area)}

输入：
    - **NmsParam** - 输入参数结构体。
    - **core_mask(int, 可选)** - 核掩码（仅适用于共享存储版本）。

    **结构体定义：**

    .. code-block:: c
        :linenos:

        typedef struct {
            float* boxes;               // 形状为 (batch, num_boxes, 4)
            float* score;               // 形状为 (batch, class, num_boxes)
            int* output;                // 输出缓冲区
            float* candidates;          // 候选框临时缓冲区
            int batch_num;              // 批次数量
            int class_num;              // 类别数量
            int box_num;                // 每个类别的框数量
            int center_point_box;       // 0: corner box, 1: center point box
            bool simple_out;            // true: 仅输出index, false: 输出 batch, class, index
            int max_output_per_class;   // 每个类别最大输出框数
            float iou_threshold;        // IoU 阈值
            float score_threshold;      // 分数阈值
        } NmsParamFp32;
        typedef struct {
            int8_t* boxes;               // 形状为 (batch, num_boxes, 4)
            int8_t* score;               // 形状为 (batch, class, num_boxes)
            int* output;                // 输出缓冲区
            float* candidates;          // 候选框临时缓冲区
            int batch_num;              // 批次数量
            int class_num;              // 类别数量
            int box_num;                // 每个类别的框数量
            int center_point_box;       // 0: corner box, 1: center point box
            bool simple_out;            // true: 仅输出index, false: 输出 batch, class, index
            int max_output_per_class;   // 每个类别最大输出框数
            float iou_threshold;        // IoU 阈值
            int8_t score_threshold;      // 分数阈值
        } NmsParamInt8;
        typedef struct {
            float16* boxes;
            float16* score;
            int* output;
            float16* candidates;
            uint64_t batch_num;
            uint64_t class_num;
            uint64_t box_num;
            uint64_t center_point_box;
            uint64_t simple_out;
            uint64_t max_output_per_class;
            float iou_threshold_bits;   
            float score_threshold_bits; 
        } NmsParamFp16;
支持平台：
    ``FT78NE``  
    ``MT7004``

.. note::
    - FT78NE 支持 fp32, int8  
    - MT7004 支持 fp16, fp32  
    - MT7004中使用结构体作为参数传入。   

**共享存储版本:**

.. c:function:: void i8_non_max_suppression_s(NmsParamInt8* param, int core_mask)
.. c:function:: void fp_non_max_suppression_s(NmsParamFp32* param, int core_mask)
.. c:function:: void hp_non_max_suppression_s(NmsParamFp16* param, int core_mask)


    **C调用示例：**

    .. code-block:: c
        :linenos:
        :emphasize-lines: 24

        //MT7004示例
        #include <stdio.h>

        int main(int argc, char* argv[]) {
            float *boxes = (float *)0xA0000000;
            float *score = (float *)0xA1000000;
            int *output = (int *)0xA2000000;
            NmsParamFp32* param = (NmsParamFp32*)0xA3000000;

            param->boxes = boxes;
            param->score = score;
            param->output = output;
            param->candidates = candidates;
            param->batch_num = 1;
            param->class_num = 3;
            param->box_num = 100;
            param->center_point_box = 0;
            param->simple_out = 1;
            param->max_output_per_class = 50;
            param->iou_threshold_bits = 0.5;  
            param->score_threshold_bits = 0.1; 

            int core_mask = 0xff;
            fp_non_max_suppression_s(param, core_mask);
            return 0;
        }

**私有存储版本:**

.. c:function:: void i8_non_max_suppression_p(NmsParamInt8* param)
.. c:function:: void fp_non_max_suppression_p(NmsParamFp32* param)
.. c:function:: void hp_non_max_suppression_p(NmsParamFp16* param)

    **C调用示例：**

    .. code-block:: c
        :linenos:
        :emphasize-lines: 23

        //FT78NE示例
        #include <stdio.h>

        int main(int argc, char* argv[]) {
            float *boxes = (float *)0x1000000;
            float *score = (float *)0xA1000000;
            int *output = (int *)0xA2000000;
            NmsParamFp32* param = (NmsParamFp32*)0xA3000000;

            param->boxes = boxes;
            param->score = score;
            param->output = output;
            param->candidates = candidates;
            param->batch_num = 1;
            param->class_num = 3;
            param->box_num = 100;
            param->center_point_box = 0;
            param->simple_out = 1;
            param->max_output_per_class = 50;
            param->iou_threshold_bits = 0.5;  
            param->score_threshold_bits = 0.1;

            fp_non_max_suppression_s(param);
            return 0;
        }

