Code Monkey home page Code Monkey logo

Comments (5)

lilanxiao avatar lilanxiao commented on May 30, 2024

hi, I think it's possible. The idea is actually simple:

  1. find all vertices of the intersection polygon
  2. sort these vertices
  3. apply shoelace formula to calculate the area
  4. find the smallest enclosing box if necessary

My implementation uses the brute force method in Step 1 and 4. The brute force method works fine since I only consider rectangles. If you want to extend my code to arbitrary polygons (especially those with many vertices), you should probably consider replacing the brute force algorithms with more elegant ones for less memory usage and faster speed.

from rotated_iou.

sanagno avatar sanagno commented on May 30, 2024

Hi @liuchangf, if you have any updates on that, highly appreciated!

from rotated_iou.

HolyCrap96 avatar HolyCrap96 commented on May 30, 2024

Can I use this implementaton to calculate the IoU of quadrangles without any modification?

from rotated_iou.

lilanxiao avatar lilanxiao commented on May 30, 2024

Can I use this implementaton to calculate the IoU of quadrangles without any modification?

no, my code only works with rectangles. At least two functions assume that the inputs are rectangles.

  • box1_in_box2 in box_intersection.py: it uses the properties of rectangles to simplify the calculation.
  • box2corners_th in oriented_iou_loss.py: it calculates the corner coordinates of rectangles.

Other functions should work with arbitrary quadrangles, as far as I can see. If you need support for arbitrary quadrangles, feel free to modify these two functions and see what happens.

from rotated_iou.

HolyCrap96 avatar HolyCrap96 commented on May 30, 2024

thanks! I'll give it a try after I'm done with the work at hand.

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.