examples/postprocess/yolov8s_post.h

60 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: xun
* @Date: 2025-02-14 10:22:55
* @LastEditors: xun
* @LastEditTime: 2025-03-04 14:18:03
* @Description:
* Copyright (c) 2025 by CCYH, All Rights Reserved.
*/
// yolov8s_post.h
#ifndef _YOLOV8S_POST_H
#define _YOLOV8S_POST_H
#ifdef __cplusplus
extern "C" {
#endif
#define CONFIDENCE_THRESHOLD 0.45f
#define IOU_THRESHOLD 0.25f
#define MAX_DET_NUM 100
#define GRID_ROW_COUNT 8400
#define NUM_CLASSES 80
#define MAX_DIMS 2
#define INPUT0_SIZE 640*640*3*2
#define INPUT1_SIZE 0
typedef struct box {
float x, y, w, h; // 中心坐标(x,y)和宽高(w,h)
} box;
typedef struct detection {
box boxes;
float scores;
int classes;
} detection;
/**
* @brief YOLOv8s后处理函数
* @param input_buffer input_buffer[0]坐标张量,维度[4,8400,1];
* input_buffer[1]分数张量,维度[10,8400,1]
* @param counts input_buffer维度
* @param dets 检测结果数组
* @return int 有效检测框数量
*/
int yolov8s_postprocess(void **input_buffer, int counts, detection *dets);
/**
* @brief 打印yolov8s后处理结果
*
* @param IN results 结果地址
* @param IN nboxes 目标个数
* @return int 返回处理后的状态码0表示成功-1表示失败
*/
int print_yolov8s_result(void *results, unsigned short nboxes);
#ifdef __cplusplus
}
#endif
#endif