Visualization of rotated bounding boxes
See original GitHub issueHi!
I’m working with rotated bounding boxes now and I found out that the visualizer cannot display the bounding box annotation for rotated boxes. The reason it cannot display rotated bounding boxes for a dataset by using draw_dataset_dict
is simply because the code expects a BoxMode
to convert the dataset coordinates to the variant which is used for visualization. However, rotated bounding boxes currently don’t have any BoxMode.
I made a small fix that let me skip the coordinate conversion and visualize the rotated bounding boxes. I was considering submitting a pull request, but I think that a cleaner solution would be to add an additional BoxMode value for rotated bounding boxes. What is your opinion?
This is my makeshift solution. I replaced line https://github.com/facebookresearch/detectron2/blob/706a3185d187ea912b324eb0b5eac064ca0a62ce/detectron2/utils/visualizer.py#L489 with this code.
if "bbox" in annos[0] and len(annos[0]["bbox"]) == 4:
boxes = [BoxMode.convert(x["bbox"], x["bbox_mode"], BoxMode.XYXY_ABS) for x in annos]
else:
boxes = [x["bbox"] for x in annos]
If you think this is okay, I will submit a pull request. If you think that an additional BoxMode value would be better, I can try adding one and submit a pull request then. I’m looking forward to your reply.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
Hi! now i trying visualize rotated bbox in detectron2. but it’s not visualize well
i build own get_dataset_dict as here
after that i try visualize rotated box like here
but image display like this
so i fixed this line. like here
https://github.com/facebookresearch/detectron2/blob/706a3185d187ea912b324eb0b5eac064ca0a62ce/detectron2/utils/visualizer.py#L489
as result it work well
That’s a way to bypass it and visualize rotated boxes with the current code, but hopefully some following updates will enable visualization of rotated boxes and training with rotated boxes by default.