zhang-tao-whu / e2ec

E2EC: An End-to-End Contour-based Method for High-Quality High-Speed Instance Segmentation
Other
214 stars 45 forks source link

question about get_gcn_feature function #17

Closed TankosTao closed 2 years ago

TankosTao commented 2 years ago

Thanks very much for your work, I have some questions about get_gcn_feature function. In this function, we have input 'cnn_feature','img_poly' . Our main focus is to extract the features of img_polys‘ points from the feature map, is this correct? If so, we need to use torch.nn.functional.grid_sample to finish this task. So why in your code, you didn't normalize img_polys between [-1,1] to target the location in cnn_feature instead img_poly[..., 0] = img_poly[..., 0] / (w / 2.) - 1 img_poly[..., 1] = img_poly[..., 1] / (h / 2.) - 1

I dont understand how this works, I hope you can help me out.

In torch.nn.functional.grid_sample(input, grid, mode='bilinear', padding_mode='zeros', align_corners=None) grid specifies the sampling pixel locations normalized by the input spatial dimensions. Therefore, it should have most values in the range of [-1, 1]