bonus-edge-proxy/src/rknn/postprocess.h

57 lines
1.6 KiB
C
Raw Normal View History

2025-10-24 13:11:33 +08:00
#ifndef _RKNN_YOLOV5_DEMO_POSTPROCESS_H_
#define _RKNN_YOLOV5_DEMO_POSTPROCESS_H_
#include <stdint.h>
#include <vector>
#define OBJ_NAME_MAX_SIZE 16
#define OBJ_NUMB_MAX_SIZE 64
2025-11-04 18:38:05 +08:00
// 移除 #define OBJ_CLASS_NUM 80
2025-10-24 13:11:33 +08:00
#define NMS_THRESH 0.45
#define BOX_THRESH 0.25
2025-11-04 18:38:05 +08:00
// 移除 #define PROP_BOX_SIZE (5 + OBJ_CLASS_NUM)
typedef struct _BOX_RECT {
int left;
int right;
int top;
int bottom;
2025-10-24 13:11:33 +08:00
} BOX_RECT;
2025-11-04 18:38:05 +08:00
typedef struct __detect_result_t {
char name[OBJ_NAME_MAX_SIZE];
BOX_RECT box;
float prop;
2025-10-24 13:11:33 +08:00
} detect_result_t;
2025-11-04 18:38:05 +08:00
typedef struct _detect_result_group_t {
int id;
int count;
detect_result_t results[OBJ_NUMB_MAX_SIZE];
2025-10-24 13:11:33 +08:00
} detect_result_group_t;
2025-11-04 18:38:05 +08:00
/**
* @brief []
* @param label_path
* @param class_num ( 80)
* @return int 0 , -1
*/
int initPostProcess(const char *label_path, int class_num);
/**
* @brief [] post_process
* @param class_num [] , initPostProcess 使
*/
int post_process(int8_t *input0, int8_t *input1, int8_t *input2, int model_in_h,
int model_in_w, float conf_threshold, float nms_threshold,
BOX_RECT pads, float scale_w, float scale_h,
2025-10-24 13:11:33 +08:00
std::vector<int32_t> &qnt_zps, std::vector<float> &qnt_scales,
2025-11-04 18:38:05 +08:00
int class_num, // <-- 新增参数
2025-10-24 13:11:33 +08:00
detect_result_group_t *group);
2025-11-04 18:38:05 +08:00
/**
* @brief [] deinitPostProcess g_labels
*/
2025-10-24 13:11:33 +08:00
void deinitPostProcess();
2025-11-04 18:38:05 +08:00
#endif //_RKNN_YOLOV5_DEMO_POSTPROCESS_H_