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.

Refactor bounding_box utils with `BoundingBox` class to represent box.

See original GitHub issue
class BoundingBoxMixin:

    @staticmethod
    def _get_corners(bbox):
        ...

    @staticmethod
    def _get_xywh(bbox):
        ...

    @staticmethod
    def _pad_bbox(bbox):
        ...

# will use internally in upcoming BoundingBox related more data augmentation or even provide this publicly
class BoundingBox(BoudningBoxMixin):
    _ALLOWED_FORMAT = ['xywh', 'corner']

    def __init__(self, box, type='xywh'):
        self._box = box
        # assert type.
        self._type = type

    @property
    def corners(self):
          return self._box

    @property
    def xywh(self):
          # convert to xywh.
          return _box
    @property
    def area(self):
        return _area

    @property
    def extended_corners(self):
        # return extended 4 corners  of box
        return _extended_corners

    def pad(self):
        return padded_bounding_box


# public endpoints.
def get_corner(bbox):
    return BoundingBoxMixin._get_corners(bbox)

def get_xywh(bbox):
    return BoundingBoxMixin._get_xywh(bbox)

@fchollet @LukeWood thoughts?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
LukeWoodcommented, Mar 20, 2022

Hey @kartik4949 ! I’m not convinced that we want to use the class based solution yet. For now I think the utility functions do everything the class solution does just fine.

1reaction
LukeWoodcommented, Feb 27, 2022

The other alternative we can consider is a tf extension type: https://www.tensorflow.org/guide/extension_type

I’m not fully sold on any of the solutions, and think this is an important choice to make.

If we do go for a class based solution, I’d probably want to wrap a tensorflow tensor in a BoundingBoxes class with a xywh and corners property - no need for anything more complex than that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BoundingBox
Creates a bounding box containing only the specified point. Parameters: p - point to include. BoundingBox. public BoundingBox(float x, float ...
Read more >
How to get the coordinates of the bounding box in YOLO ...
Question I need to get the bounding box coordinates generated in an image ... All instances of all classes in all images must...
Read more >
: Class BoundingBox - Oracle Help Center
This class defines an axis aligned bounding box which is used for bounding regions. ... Finds closest bounding object which intersects this bounding...
Read more >
Bounding Box Algorithm in Java with only the center points ...
I am trying to create a circle in Java using the fillOval command. The user inputs the center co-ordinates and the radius for...
Read more >
Part 2 Object Detection using YOLOv2 on Pascal VOC2012
2nd anchor box specializes narrow bounding box ... Yolo v2 uses K-means clustering to decide what type of shapes anchor boxes should ...
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