I want to calculate the area of predicted masks from the output of Detectron2 object detection Segmentation
So when I run inference it returns the dictionary
outputs = predictor(im)
pred_mask,pred_boxes,pred_scores
. When I print the pred_masks
the values are in binary (False,True)
But when i call the visualizer function by sending the predictions it paste all the predicted masks but it shows me (true false ) I don't get it Here is a coed of visualizer
v = Visualizer(im\[:, :, ::-1\],
metadata=grain_metadata,
scale=0.5,
instance_mode=ColorMode.IMAGE_BW
)
out = v.draw_instance_predictions(outputs\["instances"\].to("cpu"))
cv2_imshow(out.get_image()[:, :, ::-1])
This function is in a file
(detectron2->utils->visualizer->draw_instance_predictions(predictions)
I made some changes in that file in collab like trying to print the masks but it didn't affect at all I comment on the whole file but still the visualizer working can someone tell me how to get the masks values so I will draw on my own using OpenCV.