hysts / pytorch_mpiigaze

An unofficial PyTorch implementation of MPIIGaze and MPIIFaceGaze
MIT License
346 stars 85 forks source link

question about rotation matrix #65

Closed bychen7 closed 1 year ago

bychen7 commented 1 year ago

https://github.com/hysts/pytorch_mpiigaze/blob/2a31a6ce82264dd9b34f74cfd5ef54c08e4eed5f/gaze_estimation/gaze_estimator/common/face_model.py#L136 Thanks for sharing your code. I'm confused about why this rotation matrix needs to be transposed. The Solovpnp function result provides the transformation from world space to camera space, but transposing the matrix seems to indicate the opposite direction. I think this line is meant to transform a 3D face model to camera space, so I'm unsure why the transpose operation is necessary.

hysts commented 1 year ago

Hi, @blackmagicianZ I haven't looked at this code for a long time and forgot the details, so I'm not 100% sure, (I should have left more comments in the code), but I think it's because the self.LANDMARKS here is a row vector, not a column vector. Applying a transposed rotation matrix to a row vector from the right is the same as applying the original rotation matrix to a column vector from the left.

bychen7 commented 1 year ago

@hysts Thank you for your patience, I understand now.