Git Product home page Git Product logo

Comments (2)

lilanxiao avatar lilanxiao commented on May 26, 2024 4

I saw your code only calculate the giou when the number of label and GT boxes are equal what about a Different number of labels and Prediction?

Hi! It's only possible to calculate IoU of paired bounding boxes (unless one changes the definition). If you have different numbers or GT and predictions, you have to somehow match them to get pairs of boxes first.

If you want to calculate IoU between each GT box and each prediction, you have to duplicate them. Let's say we have two labels (GT1 and GT2) and three predictions (PR1, PR2, PR3). We have to duplicate them to get all six combinations:

[GT1, GT1, GT1, GT2, GT2, GT2]  # duplicated labels
[PR1, PR2, PR3, PR1, PR2, PR3]  # duplicated predictions

from rotated_iou.

botinock avatar botinock commented on May 26, 2024 3

Hello! I've done it this way.

box1 = torch.tensor([[1, 1, 2, 2, 0.0], [1, 1, 2, 2, 0.0]], device="cuda:0")
box2 = torch.tensor([[3, 3, 2, 2, 0.0], [2, 2, 2, 2, 0.0]], device="cuda:0")
box1_new = box1.view([box1.shape[0], 1, 5]).repeat([1, box2.shape[0], 1])
box2_new = box2.view([1, box2.shape[0], 5]).repeat([box1.shape[0], 1, 1])
print(box1_new.shape, box2_new.shape)
cal_iou(box1_new, box2_new)[0]

P.S.
Thank you very much for this repo

from rotated_iou.

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.