Comments (8)
hi, thank you for the issue!
Yeah, the CUDA result is incorrect in this case. My code is sometimes unstable when it comes to some corner cases, e.g, when some edges and corners exactly overlap. If one rotates one rectangle a little bit, the result becomes correct. For example, with box1 = [4,5,8,10,0.0001]
instead of box1 = [4,5,8,10,0]
. It might be a numerical issue with float32, but I'm not sure. The NumPy version is probably more stable because it uses float64 by default.
I'm busy with some deadlines now. I would probably come back and try to fix this issue after a few weeks.
TBH, I don't think it's a big problem when you use this code to train neural networks. Because the possibility, that the prediction and the ground truth have exactly overlapping points and edges, is 0 from a statistical perspective. But anyway, it still deserves a fix : )
from rotated_iou.
Hello, Just to let you know that I made a tensorflow version of your algorithm that does not suffer this issue at https://github.com/atuleu/tf-convex-polygon-iou . For the polygon point inclusion, I use the winding number approach, which is a bit more involved, but generalizes to any polygon shape, not just rotated boxes. The unit test gives a correct answer, even for the case above.
from rotated_iou.
hi guys, sorry for the late response. I have been struggling with my own staff in the last few months.
Anyway, I've created a new debug branch
and updated my code there.
I've made a lot of changes:
- The CUDA extension is replaced with a native PyTorch implementation. I think they do the same thing. I was just too naive to realize that the CUDA part was unnecessary.
- We don't have to compile anything now, which would probably reduce a lot of issues in the future :-)
- I realized that most problems occurred when two boxes have overlapped corners. So I added a function to check this situation and provide a workaround.
The code looks good to me now and has passed my tests. But I feel the numerical stuff is pretty tricky. I am not sure if all known issues are fixed or if new bugs are introduced (and that's why I didn't push it to the main branch).
So, feel free to check the update in the debug branch
and let me know your results.
from rotated_iou.
And I found that if there are some overlapping points(not completely overlapping), the intersection area is wrong.
from rotated_iou.
Thanks for your quick reply! I will try this loss to train my network. By the way, I implemented a differential IoU loss in python before. Although it is accurate, it is too slow because it is not parallel now. I think we could communicate with each other~
from rotated_iou.
Hello, Just to let you know that I made a tensorflow version of your algorithm that does not suffer this issue at https://github.com/atuleu/tf-convex-polygon-iou . For the polygon point inclusion, I use the winding number approach, which is a bit more involved, but generalizes to any polygon shape, not just rotated boxes. The unit test gives a correct answer, even for the case above.
Well done! And thank you for the information! I would try the winding number approach and hope it could solve the issue here.
from rotated_iou.
兄弟,改好了代码上传啊,等了3个多月了,代码还没有更新,这个iou有的地方不对
from rotated_iou.
The enclosing area in this repo is not convex hull area, therefore the results are different from standard package such as Shapely. I think you could use https://github.com/JarvisUSTC/Differential-Rotated-IoU-Loss for calculating more accurate iou.
from rotated_iou.
Related Issues (20)
- ModuleNotFoundError: No module named 'sort_vertices'
- box_intersection_2d 中的box1_in_box2存在bug, box1_in_box2(box1,box1), 在特定数据下返回的不是[true,true,true,true] HOT 1
- 在做批量的旋转iou计算时,计算的inter_area会出现nan值,导致loss变为nan,但是在把计算为nan的两个box的x,y,w,h,angle提出来单个计算的话就会出现正常的inter_area。请问这是什么原因导致的呢,还请解答 HOT 7
- is this result correct? HOT 2
- Wrong IoU calculation when corners are smaller than 0 HOT 6
- Yolact
- About the 2D coordinates (x, y, w, h, alpha) HOT 2
- 请教大佬代码实现问题 HOT 2
- Please Help HOT 1
- warning: missing return statement at end of non-void function "compare_vertices" HOT 6
- debug版本报错 HOT 3
- a problem when using 3d-giou for regression training HOT 2
- 大佬,求助,CUDA out of memory HOT 12
- inf bbox loss when using cal_giou_3d ( but the iou is right)
- Batch computation for IoU Loss HOT 1
- debug版本和老的版本计算结果不一致
- 为什么input shape是 B,N,4,2?
- Segmentation fault
- `np.bool` was a deprecated alias for the builtin `bool`.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rotated_iou.