MCPcopy
hub / github.com/ZFTurbo/Weighted-Boxes-Fusion / example_nms_2_models

Function example_nms_2_models

example.py:139–201  ·  view source on GitHub ↗

This example shows how to ensemble boxes from 2 models using NMS method :return:

(method, iou_thr=0.5, sigma=0.5, thresh=0.001, draw_image=True)

Source from the content-addressed store, hash-verified

137
138
139def example_nms_2_models(method, iou_thr=0.5, sigma=0.5, thresh=0.001, draw_image=True):
140 """
141 This example shows how to ensemble boxes from 2 models using NMS method
142 :return:
143 """
144
145 boxes_list = [
146 [
147 [0.00, 0.51, 0.81, 0.91],
148 [0.10, 0.31, 0.71, 0.61],
149 [0.01, 0.32, 0.83, 0.93],
150 [0.02, 0.53, 0.11, 0.94],
151 [0.03, 0.24, 0.12, 0.35],
152 ],
153 [
154 [0.04, 0.56, 0.84, 0.92],
155 [0.12, 0.33, 0.72, 0.64],
156 [0.38, 0.66, 0.79, 0.95],
157 [0.08, 0.49, 0.21, 0.89],
158 ],
159 ]
160 scores_list = [
161 [
162 0.9,
163 0.8,
164 0.2,
165 0.4,
166 0.7,
167 ],
168 [
169 0.5,
170 0.8,
171 0.7,
172 0.3,
173 ]
174 ]
175 labels_list = [
176 [
177 0,
178 1,
179 0,
180 1,
181 1,
182 ],
183 [
184 1,
185 1,
186 1,
187 0,
188 ]
189 ]
190 weights = [2, 1]
191
192 if draw_image:
193 show_boxes(boxes_list, scores_list, labels_list)
194
195 boxes, scores, labels = nms_method(boxes_list, scores_list, labels_list, method=method, weights=weights, iou_thr=iou_thr, sigma=sigma, thresh=thresh)
196

Callers 1

example.pyFile · 0.85

Calls 2

show_boxesFunction · 0.85
nms_methodFunction · 0.85

Tested by

no test coverage detected