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

The gradient derivation in ROIWarping Layer #52

Open
yexiguafuqihao opened this issue Mar 30, 2017 · 2 comments
Open

The gradient derivation in ROIWarping Layer #52

yexiguafuqihao opened this issue Mar 30, 2017 · 2 comments

Comments

@yexiguafuqihao
Copy link

yexiguafuqihao commented Mar 30, 2017

@oh233 ,I can't well understand the code:
if (coordinate_index == 1) {
// \par f / \par x1
weight = 0.5 * dxc - dw;
} else if (coordinate_index == 2) {
// \par f / \par y1
weight = 0.5 * dyc - dh;
} else if (coordinate_index == 3) {
// \par f / \par w
weight = 0.5 * dxc + dw;
} else if (coordinate_index == 4) {
// \par f / \par h
weight = 0.5 * dyc + dh;
}
in the function of get_coordinate_gradient in ROIWarpingLayer.cu in https://github.com/daijifeng001/caffe-mnc/blob/mnc/src/caffe/layers/roi_warping_layer.cu ,would you or anyone kindly please to afford me a detail explaination?I kown this is a partial derivative but I really can't figure out where 0.5 comes from?

@handong1587
Copy link

handong1587 commented May 31, 2017

Hi, I also get stuck in some code details like calculations of dw and dh
Can someone help me to figure out how does 0.5 come about in formula (0.5 - map_ratio_w) ? I am a bit confused.

@SunSet0864
Copy link

I think the dxc and dw/ dyc and dh should combine together and 0.5 will be disappeared using the function you have mentioned above, the last functions will be like that:
1-map_ratio_h or map_ratio_h-1 or -1-map_ratio_h or 1+map_ratio_h, the same for map_ratio_w;
However, i have another question about the derivation, the equation (8) in the paper,wi is not a function of xi, so if we derivative for the xi, the wi will be zero,but from the code, we can see that the (u/W)*wi becomes u'/W` when we derivative the variable xi, so how to explain the (u'/W')?

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

3 participants