Refactor bounding_box utils with `BoundingBox` class to represent box.
See original GitHub issueclass 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)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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 axywh
andcorners
property - no need for anything more complex than that.