question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A couple of questions about bbox module functions

See original GitHub issue

Hi guys,

during the bbox module refactoring, I have encountered a couple of weird things and I wanted to make sure that everything is how it suppose to be:

  1. bbox width and height arithmetic seem to be inclusive (adding +1 to the difference of coordinates): https://github.com/kornia/kornia/blob/1e0ccad60611f5e47d4eddbf950f120c30020dd9/kornia/geometry/bbox.py#L105-L107 So when we have this example: https://github.com/kornia/kornia/blob/1e0ccad60611f5e47d4eddbf950f120c30020dd9/kornia/geometry/bbox.py#L90-L95 the width and height is 2 pixels: https://github.com/kornia/kornia/blob/1e0ccad60611f5e47d4eddbf950f120c30020dd9/kornia/geometry/bbox.py#L102 Is it a standard procedure? It is the first time I see something like this - examples of other works for both 2D and 3D that are taking just a plain arithmetic difference without adding 1 to it. Two examples: EfficientDet in 2D: https://github.com/xuannianz/EfficientDet/blob/030fb7e10ab69a297c7723120c2d1be856a852c0/generators/coco.py#L152 and OpenPCDet in 3D: https://github.com/open-mmlab/OpenPCDet/blob/26a16123cf820e29ed565f4ad53964c66f3ea030/pcdet/utils/box_utils.py#L28
  2. The convention of coordinates used in the bbox module assumes the order x, y, z, but the return values in infer_bbox_shape are reversed: height, width in 2D and depth, height, width in 3D. Is there any particular reason why the order is reversed? https://github.com/kornia/kornia/blob/1e0ccad60611f5e47d4eddbf950f120c30020dd9/kornia/geometry/bbox.py#L105-L107
  3. bbox_to_mask and bbox_to_mask3d have inconsistent arguments: bbox_to_mask(boxes: torch.Tensor, width: int, height: int) and bbox_to_mask3d(boxes: torch.Tensor, size: Tuple[int, int, int]) accordingly. Can I make them more consistent? For example: bbox_to_mask(boxes: torch.Tensor, size: Tuple[int, int]) and bbox_to_mask3d(boxes: torch.Tensor, size: Tuple[int, int, int])?

I have analyzed the commit history and I believe @shijianjian wrote most of the bbox functionalities. @shijianjian , can you take a look at the points above and let me your thoughts?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:53 (38 by maintainers)

github_iconTop GitHub Comments

2reactions
dkoguciukcommented, Jul 21, 2021

Thanks @hal-314 for letting us know about the Detectron2 convention, we will probably adapt it to Kornia. I think I can now start working on the first work in progress version for the updated bbox module. I will keep you posted @shijianjian 🚀

2reactions
shijianjiancommented, Jul 2, 2021

Hi @dkoguciuk,

  1. I did not do much background research on how other libs did during the time of development. While, as we are dealing with corners than (x, y, h, w), (x, y, x, y), I think this inclusion can be more intuitive as we actually expect the point to be included while write it. Since our bbox format is a bit irregular due to the need by grid_sample, I think what we need is the good conversion from formats like (x, y, h, w), (x, y, x, y) to corner bbox.
  2. This only meant to match torch conventions like BCHW and BCDHW.
  3. Yes, please do so.

Plus, for bbox module, I think we are now in a good condition for handling most common cases. I would propose to go further down to other modalities like the rotated bbox 2d and 3d as mentioned in slack. Also, some bbox computations like this to attrack more advanced users. Please take these random ideas into consideration. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arguments of bbox_to_anchor() function - Stack Overflow
In the above code I have come accross the function bbox_to_anchor which places the legend in arbitary postion . I am not able...
Read more >
Introduction to {box} (1)
Goal of this talk. Introduce the {box} package and show how it can be used to write modularized/organized code and manage the name...
Read more >
The Shapely User Manual — Shapely 2.0.0 documentation
Shapely is a Python package for set-theoretic analysis and manipulation of planar features using (via Python's ctypes module) functions from the well known ......
Read more >
End-to-End Google Earth Engine (Full Course Material)
We use filters to select the appropriate images. There are many types of filter functions, look at ee.Filter... module to see all available...
Read more >
Victron & BYD - Battery Compatibility
In off-grid systems, the control functions of the BYD Battery Management ... Each B-Box Pro 2.5 battery module is approximately 50Ah at 48V ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found