Skip to content

Denormalize_boxes problem #1959

@johnbacas

Description

@johnbacas

Search before asking

  • I have searched the Supervision issues and found no similar bug report.

Bug

with input boxes:
array([[ 0.91953, 0.13889, 1, 0.80694],
[ 0.84297, 0.41806, 0.925, 0.69167],
[ 0.15, 0.625, 0.23516, 1],
[ 0.1375, 0.54167, 0.26875, 1],
[ 0.38359, 0.50556, 0.54063, 1],
[ 0.23672, 0.079167, 0.43516, 1],
[ 0.00078125, 0.0013889, 0.16094, 1],
[ 0.12422, 0.097222, 0.41953, 0.75694],
[ 0.4125, 0.17778, 0.55156, 0.875],
[ 0.55391, 0.18472, 0.69609, 0.98889],
[ 0.66953, 0.22917, 0.80156, 1],
[ 0.13281, 0.50556, 0.14922, 0.6],
[ 0.57188, 0.25278, 0.6, 0.32361],
[ 0.60313, 0.27361, 0.61406, 0.3125],
[ 0.79688, 0.47639, 0.83906, 0.60556]])

I got a result (with w=1280 and h=720)

array([[ 1177, 177.78, 1280, 1032.9],
[ 606.94, 301, 666, 498],
[ 192, 800, 301, 1280],
[ 99, 390, 193.5, 720],
[ 0.38359, 0.50556, 0.54063, 1],
[ 0.23672, 0.079167, 0.43516, 1],
[ 0.00078125, 0.0013889, 0.16094, 1],
[ 0.12422, 0.097222, 0.41953, 0.75694],
[ 0.4125, 0.17778, 0.55156, 0.875],
[ 0.55391, 0.18472, 0.69609, 0.98889],
[ 0.66953, 0.22917, 0.80156, 1],
[ 0.13281, 0.50556, 0.14922, 0.6],
[ 0.57188, 0.25278, 0.6, 0.32361],
[ 0.60313, 0.27361, 0.61406, 0.3125],
[ 0.79688, 0.47639, 0.83906, 0.60556]])

Copilot suggested that instead of
result[[0, 2]] = (result[[0, 2]] * width) / normalization_factor
result[[1, 3]] = (result[[1, 3]] * height) / normalization_factor

it should use
result[:, [0, 2]] = (result[:, [0, 2]] * width) / normalization_factor
result[:, [1, 3]] = (result[:, [1, 3]] * height) / normalization_factor

Environment

Colab

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions