77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
#ifndef _RKNN_H_
|
|
#define _RKNN_H_
|
|
|
|
#include "rknn_api.h"
|
|
#include <vector>
|
|
#include "yolov5.h"
|
|
|
|
|
|
#define MODELDIR "."
|
|
|
|
#define DEFAULT_CONF_THRESHOLD 0.6
|
|
extern float conf_threshold;
|
|
|
|
extern char *CameraID;
|
|
extern int TypeID;
|
|
extern int UploadPort;
|
|
|
|
/*
|
|
typedef struct _BOX_RECT
|
|
{
|
|
int left, right, top, bottom;
|
|
} BOX_RECT;
|
|
|
|
typedef struct __detect_result_t
|
|
{
|
|
char name[OBJ_NAME_MAX_SIZE];
|
|
int class_index;
|
|
BOX_RECT box;
|
|
float prop;
|
|
} detect_result_t;
|
|
|
|
typedef struct _detect_result_groupt_t
|
|
{
|
|
int id;
|
|
int count;
|
|
detect_result_t results[OBJ_NUMB_MAX_SIZE];
|
|
} detect_result_group_t;
|
|
|
|
typedef struct rknn
|
|
{
|
|
rknn_context ctx;
|
|
unsigned char *model;
|
|
int num_input;
|
|
int num_output;
|
|
|
|
int model_width;
|
|
int model_height;
|
|
|
|
rknn_tensor_attr *out_attrs;
|
|
|
|
int (*do_judge)(struct rknn *rk, char *rgb_hwc, int width, int height,
|
|
int (*callback)(struct rknn *rk, detect_result_group_t *result_group));
|
|
int (*deinit)(struct rknn *rk);
|
|
} rknn_t;
|
|
*/
|
|
|
|
extern char *global_model;
|
|
|
|
/*
|
|
rknn_t *get_rknn();
|
|
rknn_t *do_init_model();
|
|
rknn_t *reload_rknn(char *model_path);
|
|
*/
|
|
int process_a_frame(char *buf, int sw, int sh);
|
|
|
|
/*
|
|
int post_process_u8(uint8_t *input0, uint8_t *input1, uint8_t *input2, int model_in_h, int model_in_w,
|
|
int h_offset, int w_offset, float resize_w_scale, float resize_h_scale, float conf_threshold, float nms_threshold,
|
|
std::vector<uint8_t> &qnt_zps, std::vector<float> &qnt_scales,
|
|
detect_result_group_t *group, char *origin_buf);
|
|
*/
|
|
|
|
int print_object_detect_result(rknn_app_context_t* rknn, object_detect_result_list *group, unsigned char *buff);
|
|
|
|
// #define DUMP_FIRST_FRAME
|
|
|
|
#endif |