Convert rotation matrixs to rotation 6d representations. Args: matrix (Union[torch.Tensor, numpy.ndarray]): input shape should be (..., 3, 3). ndim of input is unlimited. Returns: Union[torch.Tensor, numpy.ndarray]: shape would be (..., 6). [1] Zhou, Y.,
(
matrix: Union[torch.Tensor, numpy.ndarray]
)
| 163 | |
| 164 | |
| 165 | def rotmat_to_rot6d( |
| 166 | matrix: Union[torch.Tensor, numpy.ndarray] |
| 167 | ) -> Union[torch.Tensor, numpy.ndarray]: |
| 168 | """Convert rotation matrixs to rotation 6d representations. |
| 169 | |
| 170 | Args: |
| 171 | matrix (Union[torch.Tensor, numpy.ndarray]): input shape |
| 172 | should be (..., 3, 3). ndim of input is unlimited. |
| 173 | Returns: |
| 174 | Union[torch.Tensor, numpy.ndarray]: shape would be (..., 6). |
| 175 | |
| 176 | [1] Zhou, Y., Barnes, C., Lu, J., Yang, J., & Li, H. |
| 177 | On the Continuity of Rotation Representations in Neural Networks. |
| 178 | IEEE Conference on Computer Vision and Pattern Recognition, 2019. |
| 179 | Retrieved from http://arxiv.org/abs/1812.07035 |
| 180 | """ |
| 181 | if matrix.shape[-1] != 3 or matrix.shape[-2] != 3: |
| 182 | raise ValueError(f'Invalid rotation matrix shape f{matrix.shape}.') |
| 183 | t = Compose([matrix_to_rotation_6d]) |
| 184 | return t(matrix) |
| 185 | |
| 186 | |
| 187 | def quat_to_aa( |