未验证 提交 7c8fc03b 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix x0,y0 out of bound (#2582)

* fix x0,y0 out of bound

* clip x1/y1
上级 444fb09f
...@@ -184,10 +184,10 @@ def mask2out(results, clsid2catid, resolution, thresh_binarize=0.5): ...@@ -184,10 +184,10 @@ def mask2out(results, clsid2catid, resolution, thresh_binarize=0.5):
resized_mask > thresh_binarize, dtype=np.uint8) resized_mask > thresh_binarize, dtype=np.uint8)
im_mask = np.zeros((im_h, im_w), dtype=np.uint8) im_mask = np.zeros((im_h, im_w), dtype=np.uint8)
x0 = max(xmin, 0) x0 = min(max(xmin, 0), im_w)
x1 = min(xmax + 1, im_w) x1 = min(max(xmax + 1, 0), im_w)
y0 = max(ymin, 0) y0 = min(max(ymin, 0), im_h)
y1 = min(ymax + 1, im_h) y1 = min(max(ymax + 1, 0), im_h)
im_mask[y0:y1, x0:x1] = resized_mask[(y0 - ymin):(y1 - ymin), ( im_mask[y0:y1, x0:x1] = resized_mask[(y0 - ymin):(y1 - ymin), (
x0 - xmin):(x1 - xmin)] x0 - xmin):(x1 - xmin)]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册