Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在做批量的旋转iou计算时,计算的inter_area会出现nan值,导致loss变为nan,但是在把计算为nan的两个box的x,y,w,h,angle提出来单个计算的话就会出现正常的inter_area。请问这是什么原因导致的呢,还请解答 #37

Open
c978899 opened this issue Dec 28, 2021 · 7 comments

Comments

@c978899
Copy link

c978899 commented Dec 28, 2021

批量计算错误图片

@c978899
Copy link
Author

c978899 commented Dec 28, 2021

单独计算为nan的box

单独计算时计算正常,我以为是数据量过大出现误差,修改了batch_size可是依然会出现nan

@jjn037
Copy link

jjn037 commented Dec 30, 2021

用了amp吧

@lilanxiao
Copy link
Owner

lilanxiao commented Dec 30, 2021

你好,能不能提供具体的输入参数呢?我好做一点测试。根据目前的信息来看,我感觉像是数值误差引起的问题。就像我在#36 里面说的:

说实话我这整个repo的代码都是naive实现,只是proof of concept,写的时候突出一个quick and dirty,没有针对数值稳定性做过太多优化和测试(我也确实不擅长这个,对不住)。

我建议可以试试把x,y,w,h这几个尺寸参数进行归一化,可能会更稳定一些。

而且batch size取1的时候算出IoU=1.3429肯定是有问题的,因为IoU不应该大于1。

@c978899
Copy link
Author

c978899 commented Jan 1, 2022

fault

test_code
test_result
抱歉这么晚才回复。根据测试的result来看的话,iou计算是有问题的,不过具体问题在哪,我不太清楚。。我太菜了。

@rubbish001
Copy link

这个程序还会出现负数,我x,怎么玩

@lilanxiao
Copy link
Owner

我在debug branch下更新了代码,你可以试试。新版本要比之前稳定一些。

@rubbish001
Copy link

debug一样会出现nan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants