Open aihcyllop opened 2 years ago
You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template. The following information is missing: "Instructions To Reproduce the Issue and Full Logs"; "Your Environment";
like get such kind of image? here is the original image with mask:
@frozen-mind yes
actually your answer is in the second tutorial vedio, here is the link https://www.youtube.com/watch?v=eUSgtfK4ivk starts from appoximately 17:00, the youtuber will show you how to get the mask of the image have fun ^ ^
@frozen-mind Thank you!!
btw, did you solve the problem in #4487 ?
@frozen-mind sorry, I didn't faced the problem of $4487
Lol fine
---Original--- From: @.> Date: Thu, Aug 18, 2022 18:08 PM To: @.>; Cc: @.**@.>; Subject: Re: [facebookresearch/detectron2] How to get the visualizationresults of only instance masks without the original image? (Issue #4488)
@frozen-mind sorry, I didn't faced the problem of $4487
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
You can loop through each canny like this and see each detection. I used something like this to manipulate the pixels of each detection.
# Load your image here and call predictor on it
frame = cv2.imread("test.png")
outputs = predictor(frame)
instances = outputs['instances']
# Referencing pred mask outputs
mask_array = instances.pred_masks.to("cpu").numpy()
mask_array = np.moveaxis(mask_array, 0, -1)
img = np.zeros_like(frame)
h = img.shape[0]
w = img.shape[1]
img_mask = np.zeros([h, w, 3], np.uint8)
# Looping through each detection
for i in range(instances):
# Creat blank array matching image size and add single canny to array
mask_array_instance = mask_array[:, :, i:(i+1)]
applied_canny = np.where(mask_array_instance == True, 255, img)
array_img = np.asarray(applied_canny)
# Show Canny
cv2.imshow('area', array_img)
cv2.waitKey(0)
How to get the visualization results of only instance masks without the original image?
When I used demo to save the images of inference, it usually shows the instance segmentation results on original images.
I want to ask how to get only instance segmentation results without original images.
Thanks!