-
Notifications
You must be signed in to change notification settings - Fork 85
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
梯度计算问题 #38
Comments
you can check the caculation of dCw_dx. And -1*dCw_dx corresponds to its moving direction for x. |
对Diou的附加项:-S/C 求偏导时,求出来,p_dx,y的后半部分(-(2CwdCw_dx+2ChdCh_dx)S)) 与 p_dw,p_dh((2CwdCw_dh+2ChdCh_dh))的后半部分,符号不应该本是一样嘛/(ㄒoㄒ)/~~ |
现在我们主要考察上图的四个情形 (忽略了不相交的情形),并且主要考察横坐标x与宽w (y与h同理)。 代码中 再看 但实际上应该注意,此处是DIoU loss惩罚项对pred.w求梯度,因此一切改变应该考虑如何最小化normalized central point distance,即使得d²/c²→0 因此,出于上述考虑,对于Case 1、2进一步增大pred.w,就会使得最小覆盖矩形的宽Cw增大,从而使得c²进一步增大。 而Case 3保持pred.w无改变,是因为此时预测框包含于GT,任何变化都对c²无影响。 Case 4增大pred.w也是使得c²进一步增大。 在模拟实验中,我多加了一句符合直观的做法https://github.com/Zzh-tju/DIoU/blob/master/simulation%20experiment/dDIOU.m#L65 而在模拟实验中以及真实训练中,发现加与不加这句话对结果没有影响。我的猜测是DIoU惩罚项本身重点在x, y的移动上,对w, h没甚影响。真正对w, h有影响的应该是IoU loss和CIoU loss的长宽比惩罚项。 |
十分感谢作者的耐心回复,我会仔细揣摩一下。 |
请问你理解了吗?我没看懂作者的解释…… |
根据公式推导,感觉代码写的的确有问题…… |
请问作者,在计算Diou梯度的时候(box.c文件中)
if (iou_loss == DIOU) {
if (C > 0) {
p_dx += (2*(truth.x-pred.x)C-(2CwdCw_dx+2ChdCh_dx)S) / (C * C);
p_dy += (2(truth.y-pred.y)C-(2CwdCw_dy+2ChdCh_dy)S) / (C * C);
p_dw += (2CwdCw_dw+2ChdCh_dw)S / (C * C);
p_dh += (2CwdCw_dh+2ChdCh_dh)S / (C * C);
p_dx与p_dy 部分 -(2CwdCw_dx+2Ch*dCh_dx)*S) 这里的负号为什么不是正号呢?
The text was updated successfully, but these errors were encountered: