/ components / kendryte_sdk / include / sipeed_yolo2.h
sipeed_yolo2.h
 1  #ifndef __SIPEED_YOLO2_H
 2  #define __SIPEED_YOLO2_H
 3  
 4  #include <stdint.h>
 5  
 6  #include "kpu.h"
 7  
 8  typedef struct
 9  {
10      uint32_t obj_number;
11      struct
12      {
13          uint32_t x1;
14          uint32_t y1;
15          uint32_t x2;
16          uint32_t y2;
17          uint32_t classid;
18          float prob;
19      } obj[10];
20  } __attribute__((aligned(8))) obj_info_t;
21  
22  typedef struct
23  {
24      float threshold;
25      float nms_value;
26      uint32_t coords;
27      uint32_t anchor_number;
28      float *anchor;
29      uint32_t image_width;
30      uint32_t image_height;
31      uint32_t classes;
32      uint32_t net_width;
33      uint32_t net_height;
34      uint32_t layer_width;
35      uint32_t layer_height;
36      uint32_t boxes_number;
37      uint32_t output_number;
38      float scale;
39      float bias;
40      void *boxes;
41      //uint8_t *input;
42      float *output;
43      float *probs_buf;
44      float **probs;
45      float *activate;
46      float *softmax;
47  } __attribute__((aligned(8))) region_layer_t;
48  
49  typedef void (*callback_draw_box)(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t class, float prob);;
50  
51  int  region_layer_init(region_layer_t *rl, void* ctx);
52  void region_layer_deinit(region_layer_t *rl);
53  void region_layer_run(region_layer_t *rl, obj_info_t *obj_info);
54  void region_layer_draw_boxes(region_layer_t *rl, callback_draw_box callback);
55  
56  
57  #endif