I running detectron2 for object detection.
In the origina, after the trining, I run the follwing code:
v = Visualizer(im[:, :, ::-1],
metadata=MetadataCatalog.get("name"),
scale=1,
instance_mode=ColorMode.SEGMENTATION)
v = v.draw_instance_predictions(outputs["instances"].to("cpu"))
cv2_imshow(v.get_image()[:, :, ::-1])
cv2_imshow(resized)
and it works perfectly.
Now, after filttering some of the segmented objects, I try to run the code and present only some of the segments, so I built an array, arr_in which includes only the number of the instances that I want to present and I try to append it to the v.draw_instance_prediction.
v = Visualizer(im[:, :, ::-1],
metadata=MetadataCatalog.get("name"),
scale=1,
instance_mode=ColorMode.SEGMENTATION
)
for i in range(len(arr_in)):
num= np.int(arr_in[i])
np.append(v, v.draw_instance_predictions(outputs["instances"].to("cpu")[num]))
cv2_imshow(v.get_image()[:, :, ::-1])
cv2_imshow(resized)
but it doesn't works. What I'm asking is how can I append variables from type predictions?
Thanks