I am learning detectron2 and practicing it using pokemonster data. So, I follow the detectron2 tutorial (here : https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5)
And also a detector is developed and below image can be detected.
But, in this image, red circle is class name. I want to plot only bounding box(green color) with the exception of red circle (class name). Now below is my code for visualization. What code should be modified? Thank you.
import glob
for imageName in sorted(glob.glob(os.path.join(test_path, '*.jpg'))):
im = cv2.imread(imageName)
outputs = predictor(im)
v = Visualizer(im[:, :, ::-1],
metadata=train_metadata,
scale=0.8
)
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
boxes = v._convert_boxes(outputs["instances"].pred_boxes.to('cpu'))
for box in boxes:
box = (round(box[0]), round(box[1]), round(box[2]) - round(box[0]), round(box[3] - box[1]))
out = v.draw_text(f"{box[2:4]}", (box[0], box[1]))
cv2_imshow(out.get_image()[:, :, ::-1])