-
Notifications
You must be signed in to change notification settings - Fork 4
Yolov8 segmentation output giving multiple contours per bounding box. #2
Copy link
Copy link
Open
Description
Hi. I am trying to write a custom code for handling segmentation output. The problem I am facing is converting the outputs to a binary mask and the binary mask detecting multiple contours for a single bounding box coordinate.
mask = row.reshape(160,160)
mask = sigmoid(mask)
mask = (mask > 0.5).astype("uint8")*255
x1,y1,x2,y2 = box
mask_x1 = round(x1/image_width*160)
mask_y1 = round(y1/image_height*160)
mask_x2 = round(x2/image_width*160)
mask_y2 = round(y2/image_height*160)
mask = mask[mask_y1:mask_y2,mask_x1:mask_x2]
img_mask = Image.fromarray(mask,"L")
img_mask = img_mask.resize((round(x2-x1),round(y2-y1)))
mask = np.array(img_mask)
return mask
When I save the mask and have a look, I get multiple white contours for a single bounding box. And when this mask is passed to cv2.drawContours I get multiple polygon coordinates.I should have got a single polygon shape. Moreover there is a single probability attached to per box. Per box giving 5 contours is not matching with a single probability. If anyone can pls help me with this issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels