chenhsuanlin / inverse-compositional-STN

Inverse Compositional Spatial Transformer Networks :performing_arts: (CVPR 2017 oral)
MIT License
318 stars 63 forks source link

what is the role of refMtrx in function: transformImage(warp.py) #18

Closed haohang96 closed 5 years ago

haohang96 commented 5 years ago

Hi, I have read your code。 But I am confused about the role of refMtrx in #warp.py-function: transformImage()#. It seems that refMtrx is set to be torch.eye() in options.py, and do nothing in #warp.py-Line75#. Can I directly use transMtrx = pMtrx in #warp.py-Line75#? I am worried about if i ignore refMtrx, some unexpected errors may be introduced.

Looking forward to your reply! Thanks

chenhsuanlin commented 5 years ago

Sorry for the late reply. refMtrx plays the role of transforming between the image coordinates and canonical coordinates. refMtrx is set to identity in Pytorch because F.grid_sample also requires the coordinates to be in the range of [-1,1]. This is not the case in the Tensorflow code, where I have my own implementation of bilinear image sampling and refMtrx would be necessary.