xref: /OK3568_Linux_fs/external/rknpu2/examples/rknn_yolov5_demo/include/postprocess.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef _RKNN_ZERO_COPY_DEMO_POSTPROCESS_H_
2 #define _RKNN_ZERO_COPY_DEMO_POSTPROCESS_H_
3 
4 #include <stdint.h>
5 #include <vector>
6 
7 #define OBJ_NAME_MAX_SIZE 16
8 #define OBJ_NUMB_MAX_SIZE 64
9 #define OBJ_CLASS_NUM     80
10 #define NMS_THRESH        0.45
11 #define BOX_THRESH        0.25
12 #define PROP_BOX_SIZE     (5+OBJ_CLASS_NUM)
13 
14 typedef struct _BOX_RECT
15 {
16     int left;
17     int right;
18     int top;
19     int bottom;
20 } BOX_RECT;
21 
22 typedef struct __detect_result_t
23 {
24     char name[OBJ_NAME_MAX_SIZE];
25     BOX_RECT box;
26     float prop;
27 } detect_result_t;
28 
29 typedef struct _detect_result_group_t
30 {
31     int id;
32     int count;
33     detect_result_t results[OBJ_NUMB_MAX_SIZE];
34 } detect_result_group_t;
35 
36 int post_process(int8_t *input0, int8_t *input1, int8_t *input2, int model_in_h, int model_in_w,
37                  float conf_threshold, float nms_threshold, float scale_w, float scale_h,
38                  std::vector<int32_t> &qnt_zps, std::vector<float> &qnt_scales,
39                  detect_result_group_t *group);
40 
41 void deinitPostProcess();
42 #endif //_RKNN_ZERO_COPY_DEMO_POSTPROCESS_H_
43