Giter VIP home page Giter VIP logo

Comments (5)

ZFTurbo avatar ZFTurbo commented on July 4, 2024 1

You have y2 less than y1 and x2 less than x1. I probably need to fix it in code.

from weighted-boxes-fusion.

ZFTurbo avatar ZFTurbo commented on July 4, 2024

Can you provide more deatils?
For example, 2 boxes with large IoU can be present together in case they have different labels (classes).

from weighted-boxes-fusion.

ZFTurbo avatar ZFTurbo commented on July 4, 2024
def bb_intersection_over_union(A, B):
    xA = max(A[0], B[0])
    yA = max(A[1], B[1])
    xB = min(A[2], B[2])
    yB = min(A[3], B[3])

    # compute the area of intersection rectangle
    interArea = max(0, xB - xA) * max(0, yB - yA)

    if interArea == 0:
        return 0.0

    # compute the area of both the prediction and ground-truth rectangles
    boxAArea = (A[2] - A[0]) * (A[3] - A[1])
    boxBArea = (B[2] - B[0]) * (B[3] - B[1])

    iou = interArea / float(boxAArea + boxBArea - interArea)
    return iou

iou = bb_intersection_over_union(
        (0.73385417, 0.34259259, 0.81041667, 0.45648148),
        (0.74930206, 0.36653722, 0.79911662, 0.45000624),
)
print(iou)

It gives me 0.476852 < 0.5

from weighted-boxes-fusion.

shonenkov avatar shonenkov commented on July 4, 2024

@ZFTurbo I have found the same problem, maybe this example can help

def bb_intersection_over_union(A, B):
    xA = max(A[0], B[0])
    yA = max(A[1], B[1])
    xB = min(A[2], B[2])
    yB = min(A[3], B[3])

    # compute the area of intersection rectangle
    interArea = max(0, xB - xA) * max(0, yB - yA)

    if interArea == 0:
        return 0.0

    # compute the area of both the prediction and ground-truth rectangles
    boxAArea = (A[2] - A[0]) * (A[3] - A[1])
    boxBArea = (B[2] - B[0]) * (B[3] - B[1])

    iou = interArea / float(boxAArea + boxBArea - interArea)
    return iou

iou = bb_intersection_over_union(
        (0.99804688, 0.58007812, 0.81835938, 0.43554688),
        (0.94726562, 0.55078125, 0.77734375, 0.4140625),
)
print(iou)
>>> 0.0

Без названия

from weighted-boxes-fusion.

ZFTurbo avatar ZFTurbo commented on July 4, 2024

I fixed problem. Earlier method works incorrect if x2 (or y2) was less than x1 (or y1), now it's automatically fixed with warning message. So latest version must be totally ok.

from weighted-boxes-fusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.