This example shows how to ensemble boxes from single model using WBF method :return:
(iou_thr=0.55, draw_image=True)
| 105 | |
| 106 | |
| 107 | def example_wbf_1_model(iou_thr=0.55, draw_image=True): |
| 108 | """ |
| 109 | This example shows how to ensemble boxes from single model using WBF method |
| 110 | :return: |
| 111 | """ |
| 112 | |
| 113 | boxes_list = [ |
| 114 | [0.00, 0.51, 0.81, 0.91], |
| 115 | [0.10, 0.31, 0.71, 0.61], |
| 116 | [0.01, 0.32, 0.83, 0.93], |
| 117 | [0.02, 0.53, 0.11, 0.94], |
| 118 | [0.03, 0.24, 0.12, 0.35], |
| 119 | [0.04, 0.56, 0.84, 0.92], |
| 120 | [0.12, 0.33, 0.72, 0.64], |
| 121 | [0.38, 0.66, 0.79, 0.95], |
| 122 | [0.08, 0.49, 0.21, 0.89], |
| 123 | ] |
| 124 | scores_list = [0.9, 0.8, 0.2, 0.4, 0.7, 0.5, 0.8, 0.7, 0.3] |
| 125 | labels_list = [0, 1, 0, 1, 1, 1, 1, 1, 0] |
| 126 | |
| 127 | if draw_image: |
| 128 | show_boxes([boxes_list], [scores_list], [labels_list]) |
| 129 | |
| 130 | boxes, scores, labels = weighted_boxes_fusion([boxes_list], [scores_list], [labels_list], weights=None, iou_thr=iou_thr, skip_box_thr=0.0) |
| 131 | |
| 132 | if draw_image: |
| 133 | show_boxes([boxes], [scores], [labels.astype(np.int32)]) |
| 134 | |
| 135 | print(len(boxes)) |
| 136 | print(boxes) |
| 137 | |
| 138 | |
| 139 | def example_nms_2_models(method, iou_thr=0.5, sigma=0.5, thresh=0.001, draw_image=True): |
no test coverage detected