mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

Something wrong about ROIAlign source code

Open ming71 opened this issue 7 years ago • 6 comments

  1. Useless codes here:
    https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L101-L105

  2. The sampling points are not equally spaced:
    https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L110 Is it right to represent the y as
    roi_start_h + ph * bin_size_h + (scalar_t)(iy + 1) * bin_size_h / (scalar_t)(sample_num_h+1)

ming71 avatar Jul 20 '19 01:07 ming71

BTW , I can't figure out the function here : https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L133 such as AT_DISPATCH_FLOATING_TYPES_AND_HALF , features.type() , features.data ,especially the first one ,any relative information for that ? Thanks !!! :p

ming71 avatar Jul 20 '19 01:07 ming71

Another question: Why '+1' here? It seems not necessary for this op. https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L82-L83

ming71 avatar Jul 20 '19 07:07 ming71

  1. Useless codes here: https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L101-L105

  2. The sampling points are not equally spaced: https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L110

    Is it right to represent the y as roi_start_h + ph * bin_size_h + (scalar_t)(iy + 1) * bin_size_h / (scalar_t)(sample_num_h+1)

  1. Yes these lines are unused.
  2. If sample_num is 2, then we want the point at 0.5, 1.5 instead of 2/3, 4/3, which follows the official implementation.

hellock avatar Jul 20 '19 13:07 hellock

BTW , I can't figure out the function here : https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L133

such as AT_DISPATCH_FLOATING_TYPES_AND_HALF , features.type() , features.data ,especially the first one ,any relative information for that ? Thanks !!! :p

The documentation of PyTorch C++ APIs is quite poor, we need to look into the source code sometimes.

hellock avatar Jul 20 '19 13:07 hellock

Another question: Why '+1' here? It seems not necessary for this op. https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L82-L83

See #835 for details.

hellock avatar Jul 20 '19 13:07 hellock

Another question: Why '+1' here? It seems not necessary for this op. https://github.com/open-mmlab/mmdetection/blob/5b9c5dd45fc5446a1c2f6c1fce571ad504e4d9ce/mmdet/ops/roi_align/src/roi_align_kernel.cu#L82-L83

See #835 for details.

Thanks for your reply !!!!

ming71 avatar Jul 22 '19 07:07 ming71