You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an instance segmentation + 2D bounding box structure from Detectron 2 from which I converted the pred_masks into a binary object (of interest) mask.
So, here, my question is how can I convert this binary mask to a binary image wherein the entire image is black but the boundary around the object of interest in the object mask is white?
torch.Size([1, 224, 400])
na = instances[1].pred_masks.to('cpu').numpy()
print(na.shape)
(1, 224, 400)
na = na.reshape(224, 400)
na.shape
(224, 400)
na = np.where(na == False, 0, na)
na = np.where(na == True, 255, na)
plt.imshow(na)
In this specific example, I am interested in drawing a white line on the boundary of the baby elephant (which is my second instance in the instance segmentation mask object).
Unfortunately, I don't have a drawing of the boundary for the baby elephant but here's an example for the boundary of human (shown in white line):
^ image reference: https://www.programmersought.com/article/52814639867/
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have an instance segmentation + 2D bounding box structure from Detectron 2 from which I converted the pred_masks into a binary object (of interest) mask.
So, here, my question is how can I convert this binary mask to a binary image wherein the entire image is black but the boundary around the object of interest in the object mask is white?
instances2.pred_masks.shape
In this specific example, I am interested in drawing a white line on the boundary of the baby elephant (which is my second instance in the instance segmentation mask object).
Unfortunately, I don't have a drawing of the boundary for the baby elephant but here's an example for the boundary of human (shown in white line):

^ image reference: https://www.programmersought.com/article/52814639867/
https://stackoverflow.com/questions/68039388/extracting-a-binary-boundary-image-for-object-of-interest-in-a-binary-object-mas
Beta Was this translation helpful? Give feedback.
All reactions