Closed kazuki-can closed 3 years ago
Do you mean the pixel number ratio of each mask in a bbox?
Yes, I want to know it. If some things are detected, I would like to see the ratio of each one. Thank you.
Modify the code like this.
img_fused = img_origin
if not cfg.hide_mask:
masks_semantic = mask_p * (ids_p[:, None, None] + 1) # expand ids_p' shape for broadcasting
for one_b in box_p:
x1, y1, x2, y2 = one_b
masks_in_box = masks_semantic[y1:y2, x1:x2, :]
masks_in_box = (masks_in_box != 0).sum((1, 2))
ratios = masks_in_box / ((x2 - x1) * (y2 - y1))
Thank you for your work. And sorry for replying late.
Hello again. Thanks for the past a lot. Now, I want to know the ratio of how much mask includes in bbox. I think I can calculate it for here below. `masks_semantic = mask_p * (ids_p[:, None, None] + 1) # expand ids_p' shape for broadcasting
The color of the overlap area is different because of the '%' operation.
Thank you.