1 #ifndef BOX_H 2 #define BOX_H 3 4 #include "darknet.h" 5 6 //typedef struct{ 7 // float x, y, w, h; 8 //} box; 9 10 typedef struct{ 11 float dx, dy, dw, dh; 12 } dbox; 13 14 //typedef struct detection { 15 // box bbox; 16 // int classes; 17 // float *prob; 18 // float *mask; 19 // float objectness; 20 // int sort_class; 21 //} detection; 22 23 typedef struct detection_with_class { 24 detection det; 25 // The most probable class id: the best class index in this->prob. 26 // Is filled temporary when processing results, otherwise not initialized 27 int best_class; 28 } detection_with_class; 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 box float_to_box(float *f); 34 box float_to_box_stride(float *f, int stride); 35 float box_iou(box a, box b); 36 float box_iou_kind(box a, box b, IOU_LOSS iou_kind); 37 float box_rmse(box a, box b); 38 dxrep dx_box_iou(box a, box b, IOU_LOSS iou_loss); 39 float box_giou(box a, box b); 40 float box_diou(box a, box b); 41 float box_ciou(box a, box b); 42 dbox diou(box a, box b); 43 boxabs to_tblr(box a); 44 void do_nms(box *boxes, float **probs, int total, int classes, float thresh); 45 void do_nms_sort_v2(box *boxes, float **probs, int total, int classes, float thresh); 46 //LIB_API void do_nms_sort(detection *dets, int total, int classes, float thresh); 47 //LIB_API void do_nms_obj(detection *dets, int total, int classes, float thresh); 48 //LIB_API void diounms_sort(detection *dets, int total, int classes, float thresh, NMS_KIND nms_kind, float beta1); 49 box decode_box(box b, box anchor); 50 box encode_box(box b, box anchor); 51 52 // Creates array of detections with prob > thresh and fills best_class for them 53 // Return number of selected detections in *selected_detections_num 54 detection_with_class* get_actual_detections(detection *dets, int dets_num, float thresh, int* selected_detections_num, char **names); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 #endif 60