You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __CORTEX_BOX_HEADER__
  2. #define __CORTEX_BOX_HEADER__
  3. #include <stdint.h>
  4. /*
  5. typedef struct{
  6. float x, y, w, h;
  7. } box;
  8. typedef struct{
  9. float dx, dy, dw, dh;
  10. } dbox;
  11. box float_to_box(float *f);
  12. float box_iou(box a, box b);
  13. float box_rmse(box a, box b);
  14. dbox diou(box a, box b);
  15. void do_nms(box *boxes, float **probs, int total, int classes, float thresh);
  16. void do_nms_sort(box *boxes, float **probs, int total, int classes, float thresh);
  17. box decode_box(box b, box anchor);
  18. box encode_box(box b, box anchor);
  19. */
  20. typedef struct S_BOXLABEL{
  21. uint32_t id;
  22. float x, y, w, h;
  23. float left, right, top, bottom;
  24. void _float(float *val);
  25. float _intersection(S_BOXLABEL b);
  26. float _union(S_BOXLABEL b);
  27. void _encode(S_BOXLABEL anchor);
  28. void _decode(S_BOXLABEL anchor);
  29. float _iou(S_BOXLABEL b);
  30. float _rmse(S_BOXLABEL b);
  31. } cortexBOXLABEL;
  32. typedef struct S_DBOX{
  33. float dx, dy, dw, dh;
  34. void _derivative(S_BOXLABEL a, S_BOXLABEL b);
  35. void _intersect(S_BOXLABEL a, S_BOXLABEL b);
  36. void _union(S_BOXLABEL a, S_BOXLABEL b);
  37. void _iou(S_BOXLABEL a, S_BOXLABEL b);
  38. } cortexDBOX;
  39. typedef struct S_SORTABLE_DBOX{
  40. uint32_t index;
  41. uint32_t cls;
  42. float **probs;
  43. } cortexSortableDBOX;
  44. void nmsSort(S_BOXLABEL *boxes, float **probs, uint32_t total, uint32_t classes, float thresh);
  45. void doNMS(S_BOXLABEL *boxes, float **probs, uint32_t total, uint32_t classes, float thresh);
  46. #endif