nt9856x/code/application/source/cardv/SrcCode/UIApp/Alg/yolov5s_postprocess.h
2023-03-28 15:07:53 +08:00

66 lines
2.1 KiB
C
Executable File

/********************************************************************
INCLUDE FILES
********************************************************************/
#define DBG_YOLOV5S_DETECTOUT 0
#define PREDICT_NUMBERS 20000//20000
#define FINAL_PRED_NUMBERS 10000//10000
#define YOLOV5S_AXIS_NUM 5
#define NN_AXIS_NUM 4
#define NUM_CLASS 22
#define INPUT_W 640
#define INPUT_H 640
#define scale_out_w 640
#define scale_out_h 640
typedef struct _YOLOV5S_Bbox {
float xmin;
float ymin;
float xmax;
float ymax;
float score;
int cid;
} YOLOV5S_Bbox;
typedef struct _YOLOV5S_Anchor {
FLOAT width;
FLOAT height;
} YOLOV5S_Anchor;
typedef struct _TRANSPOSE_PARM {
UINT32 in_addr;
UINT32 out_addr;
UINT32 tmp_addr;
UINT32 width;
UINT32 height;
UINT32 channels;
UINT32 batch_num;
UINT32 in_line_ofs;
UINT32 in_channel_ofs;
UINT32 in_batch_ofs;
UINT32 out_line_ofs;
UINT32 out_channel_ofs;
UINT32 out_batch_ofs;
INT8 in_frac_bits;
INT8 in_int_bits;
INT8 in_sign_bits;
INT8 in_reserved;
INT8 out_frac_bits;
INT8 out_int_bits;
INT8 out_sign_bits;
INT8 out_reserved;
INT32 in_mul;
INT8 in_shf;
INT32 out_mul;
INT8 out_shf;
INT8 order[NN_AXIS_NUM];
}TRANSPOSE_PARM;
VOID print_detection_out_info(INT32 num, YOLOV5S_Bbox *yolov5s_final_bbox_buf);
void transform(INT32 num_kept, INT32 ih, INT32 iw, INT32 input_h, INT32 input_w, YOLOV5S_Bbox *yolov5s_final_bbox, BOOL is_padding);
INT32 yolov5s_nms(YOLOV5S_Bbox *yolov5s_final_bbox, YOLOV5S_Bbox *yolov5s_post_bbox, FLOAT nms_thre, INT32 *bbox_num);
void transpose_data(TRANSPOSE_PARM *t_parm);
void post_process_single(YOLOV5S_Bbox *yolov5s_post_bbox,INT32 input_w, INT32 input_h, INT32 height, INT32 width, INT32 idx, FLOAT conf_thre, INT16 *layer_float, INT32 *strides, YOLOV5S_Anchor *anchor, INT32 *bbox_num, INT8 frac_bits, float scale_ratio);