daijifeng001 / MNC

Instance-aware Semantic Segmentation via Multi-task Network Cascades

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The gradient derivation in ROIWarping Layer

yexiguafuqihao opened this issue · comments

commented

@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?

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.

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')?