First, I will explain the problem statement. I am wuing Detectron2 for keypoint detection for my custom dataset. I am using the below code to visualize the bounding box and the keyoints.
outputs = predictor(im[..., ::-1])
v = Visualizer(im[:, :, ::-1], MetadataCatalog.get(cfg.DATASETS.TRAIN[0]), scale=1.2)
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
plt.figure(figsize=(60,30))
plt.imshow(out.get_image()[..., ::-1][..., ::-1])
I get the output as an image below.
As you can see, the class label and the two keypoints are drawn on the image by the detectron2 visualizer. The two keypoint names are [keypoint_up, keypoint_down].
I want to print the names of the two keypoint on the image as well. Someting like below example.
I know detectron provide a function called draw_text. If anyone has an idea of how I could use it to put the keypoint name on the image, that would be a great help. A coding example would be very useful. Any other solution except the draw_text function is also welcomed. Thank you for your time