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.

[BUG] Bbox coordinate mismatch in hub visualization

See original GitHub issue

🐛🐛 Bug Report

⚗️ Current Behavior

In Hub documentation, BBox is defined as tensorflow’s style of normalized coordinate in [ymin, xmin, ymax, xmax]. But when I want to visualize it in app.activeloop.ai, the bbox was very small at the top-left corner.

Input Code

h, w, c = img.shape
box = np.array([y1/h, x1/w, y2/h, x2/w])

Expected behavior/code The bbox should be in the same encoding type as in the dataset and hub visualizer

⚙️ Environment

  • Python version(s): 3.6.9
  • Google Colab

🧰 Possible Solution

After several tests, PASCAL VOC’s style of unnormalized [xmin, ymin, xmax, ymax] is the solution to correctly visualize the bbox.

box = np.array([x1, y1, x2, y2])

🖼 Additional context/Screenshots

A. Using Hub’s style [ymin, xmin, ymax, xmax] small red dot at the top corner Screenshot from 2021-02-21 20-07-24

B. Using Pascal’s stye [xmin, ymin, xmax, ymax] with segmentation too Screenshot from 2021-02-21 20-17-41

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AbhinavTulicommented, Feb 21, 2021

@Diveafall can you take a look at this?

0reactions
haritsahmcommented, Feb 23, 2021

@haritsahm Can you see the bounding boxes now?

Yes I can!

@AbhinavTuli @haritsahm is the default bbox format normalized or unnormalized now?

You can use both but you have to choose the datatype in the visualizer app, but the official documentation uses normalized [xmin, ymin, xmax, ymax]

You can use the **unnormalized [xmin, ymin, xmax, ymax] ** and set the bbox datatype with Basic [xmin, ymin, xmax, ymax] (the first option)

You can also use the Tensorflow’s version of **normalized [ymin, xmin, ymax, xmax] ** and set the bbox datatype with the Tensorflow Bounding Box (third option).

The second option is unusual for me. It only works with unnormalized bbox with a format of:

top_left_y = ymin-box_height# shift the coordinate
bottom_right_y = ymax-box_height# shift the coordinate

bbox = [top_left_y , xmin, bottom_right_y , xmax] # unnormalized

I’m not sure why I have to shift y coordinate. Maybe @Diveafall or @AbhinavTuli can check it out.

image

I think another good option for a bounding box encoding are:

  • normalized/unnormalized [xmin, ymin, box_width, box_height]
  • YOLO’s style normalized [xmin, ymin, box_width, box_height] relative to width and height of image

I’m sorry for closing this issue without testing it because I think that is enough for me. I should have tested it first before closing this issue, Feel free to open the issue again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Bbox coordinate mismatch in hub visualization - Python Hub
In Hub documentation, BBox is defined as tensorflow's style of normalized coordinate in [ymin, xmin, ymax, xmax]. But when I want to visualize...
Read more >
How to display 3D bounding box in real-time #314 - GitHub
@marcgpuig I think this is a bug, I'll post a new issue for it. ... 3D world coordinates to 2Dimages coordinates of the...
Read more >
Coordinate Mismatch Error - Intergraph CADWorx & Analysis
Hello, I am continuously getting a coordinate mismatch error when trying to run an analysis. I've rechecked all data entry, and even deleted ......
Read more >
Recently Active 'coordinate-system' Questions
I'm using Python to map match a given trajectory to a real lane of a road. However, the match is done in a...
Read more >
PROJ coordinate transformation software library - GitHub
PROJ coordinate transformation software library, Release 9.1.1. 2.3.2 Bug fixes. • Use CMAKE_INSTALL_MANDIR to override default (#3081).
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