def fomo_post_process(model, inputs, outputs):
ob, oh, ow, oc = model.output_shape[0]
x_scale = inputs[0].roi[2] /oh
y_scale = inputs[0].roi[3] /ow
scale = min(x_scale, y_scale)
x_offset = ((inputs[0].roi[2] - (ow*scale))/ 2) + inputs[0].roi[0]
y_offset = ((inputs[0].roi[3] - ( ow*scale))/ 2) + inputs[0].roi[1]
l = [[] for i in range(oc)]
for i in range(oc):
img = image.Image(outputs[0][0, :, :, i] * 255)
blobs = img.find_blobs(
threshold_list, x_stride=1, y_stride=1, area_threshold=1, pixels_threshold=1
)
for b in blobs:
rect = b.rect()
x, y, w, h = rect
score = (
img.get_statistics(thresholds=threshold_list, roi=rect).l_mean() / 255.0
)
x = int((x * scale) + x_offset)
y = int((y * scale) + y_offset)
w = int(w * scale)
h = int(h * scale)
l[i].append((x, y, w, h, score))
return l
A
av5z
@av5z
0
声望
8
楼层
151
资料浏览
0
粉丝
0
关注
av5z 发布的帖子
-
有没有大佬帮我解释一下这段代码是什么意思,画框的话怎么画