File size: 1,878 Bytes
0545ee2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef __LIBDET_H__
#define __LIBDET_H__
#include "ax_devices.h"

#if defined(__cplusplus)
extern "C"
{
#endif
#define AX_DET_MAX_OBJ_NUM 64
#define AX_DET_MAX_KPT_NUM 32
    typedef enum
    {
        ax_det_errcode_failed = -1,
        ax_det_errcode_success = 0,
    } ax_det_errcode_e;

    typedef enum
    {
        ax_det_model_type_unknown = -1,
        ax_det_model_type_yolov5,
        ax_det_model_type_yolov8,
        ax_det_model_type_yolov8_pose,
        ax_det_model_type_yolo11,
        ax_det_model_type_yolo11_pose,
    } ax_det_model_type_e;

    typedef struct
    {
        int width;
        int height;
        int channels;
        int stride;
        void *data;
    } ax_det_img_t;

    typedef struct
    {
        struct
        {
            int x, y, w, h;
        } box;

        struct
        {
            int x, y;
        } kpts[AX_DET_MAX_KPT_NUM];
        int num_kpt;

        float score;
        int label;
    } ax_det_obj_t;

    typedef struct
    {
        ax_det_obj_t objects[AX_DET_MAX_OBJ_NUM];
        int num_objs;
    } ax_det_result_t;

    typedef struct
    {
        ax_devive_e dev_type; // Device type
        char devid;           // axcl device ID

        ax_det_model_type_e model_type;
        char model_path[256];

        int num_classes;
        int num_kpt; // for face/pose

        float threshold;

        // int anchors[18]; // for yolov5
        // int strides[3];

        float mean[3]; // for nchw float input model, not suggestion
        float std[3];  // for nchw float input model, not suggestion
    } ax_det_init_t;

    typedef void *ax_det_handle_t;

    int ax_det_init(ax_det_init_t *init, ax_det_handle_t *handle);
    int ax_det_deinit(ax_det_handle_t handle);

    int ax_det(ax_det_handle_t handle, ax_det_img_t *img, ax_det_result_t *result);

#if defined(__cplusplus)
}
#endif
#endif