Corners bounding box format
See original GitHub issueI got an issue when trying to port two of my currently using bounding box augment related functions resize_and_crop_bboxes and bboxes_apply_affine. I think we better set a default expecting bbox input format. For my usage, the corner bounding box is in same format with tfds COCO
, that I think is [top, left, bottom, right]
with value in range [0, 1]
.
import tensorflow_datasets as tfds
ds, info = tfds.load('coco/2017', with_info=True)
aa = ds['train'].as_numpy_iterator().next()
print(aa['image'].shape)
# (462, 640, 3)
print(aa['objects'])
# {'area': array([17821, 16942, 4344]),
# 'bbox': array([[0.54380953, 0.13464062, 0.98651516, 0.33742186],
# [0.50707793, 0.517875 , 0.8044805 , 0.891125 ],
# [0.3264935 , 0.36971876, 0.65203464, 0.4431875 ]], dtype=float32),
# 'id': array([152282, 155195, 185150]),
# 'is_crowd': array([False, False, False]),
# 'label': array([3, 3, 0])}
imm = aa['image']
plt.imshow(imm)
for bb in aa["objects"]["bbox"]:
bb = np.array([bb[0] * imm.shape[0], bb[1] * imm.shape[1], bb[2] * imm.shape[0], bb[3] * imm.shape[1]])
plt.plot(bb[[1, 1, 3, 3, 1]], bb[[0, 2, 2, 0, 0]])
It will save some effort checking format if we can set a standard. So my questions are:
- Currently in bounding_box.py, we are assuming it’s
LEFT, TOP, RIGHT, BOTTOM
. Are we gonna set this as default? - Is value range expecting in
[0, 1]
or scaled with image actual shape?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Bounding boxes augmentation for object detection
The bounding box has the following (x, y) coordinates of its corners: top-left is (x_min, y_min) or (98px, 345px) , top-right is (x_max,...
Read more >Basics of Bounding Boxes - Medium
A bounding box in essence, is a rectangle that surrounds an object, that specifies its position, class(eg: car, person) and confidence(how ...
Read more >Bounding Boxes - PBR Book
Given two bounding boxes with pMin and pMax points denoted by open circles, the bounding box of their area of intersection (shaded region)...
Read more >14.3. Object Detection and Bounding Boxes
The bounding box is rectangular, which is determined by the x and y coordinates of the upper-left corner of the rectangle and the...
Read more >Find the 4 Corners of a Bounding Box of a Rotated, Offsetted ...
After that, it's just a matter of finding the width between the furthest corners in the x direction and finding the height between...
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
I think @qlzh727 and I have decided to move forward with
corners
format as the default. This is XYWH with true pixel values.If there is a strong reason to deviate, please let us know and we can reconsider.
Ya, it’s good for me. Will close this issue then.