52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
#ifndef _RKNN_DEMO_YOLOV5_H_
|
|
#define _RKNN_DEMO_YOLOV5_H_
|
|
|
|
#include "rknn_api.h"
|
|
#include "common.h"
|
|
|
|
#define OBJ_NAME_MAX_SIZE 64
|
|
#define OBJ_NUMB_MAX_SIZE 128
|
|
#define OBJ_MAX_CLASS_NUM 80
|
|
#define OBJ_CLASS_MAX 80
|
|
|
|
#define NMS_THRESH 0.45
|
|
#define BOX_THRESH 0.25
|
|
|
|
typedef struct {
|
|
image_rect_t box;
|
|
float prop;
|
|
int cls_id;
|
|
} object_detect_result;
|
|
|
|
typedef struct {
|
|
int id;
|
|
int count;
|
|
object_detect_result results[OBJ_NUMB_MAX_SIZE];
|
|
} object_detect_result_list;
|
|
|
|
typedef struct _rknn_app_context{
|
|
rknn_context rknn_ctx;
|
|
rknn_input_output_num io_num;
|
|
rknn_tensor_attr* input_attrs;
|
|
rknn_tensor_attr* output_attrs;
|
|
|
|
int (*callback)(struct _rknn_app_context *rk, object_detect_result_list *result_group, unsigned char *buff);
|
|
|
|
int model_channel;
|
|
int model_width;
|
|
int model_height;
|
|
bool is_quant;
|
|
} rknn_app_context_t;
|
|
|
|
extern rknn_app_context_t rknn_app_ctx;
|
|
|
|
|
|
#include "postprocess.h"
|
|
|
|
int init_yolov5_model(const char* model_path, rknn_app_context_t* app_ctx, int(*callback)(rknn_app_context_t *rk, object_detect_result_list *result_group, unsigned char *buff));
|
|
|
|
int release_yolov5_model(rknn_app_context_t* app_ctx);
|
|
|
|
int inference_yolov5_model(rknn_app_context_t* app_ctx, image_buffer_t* img, object_detect_result_list* od_results);
|
|
|
|
#endif |