MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / rotmat_to_rot6d

Function rotmat_to_rot6d

detrsmpl/utils/transforms.py:165–184  ·  view source on GitHub ↗

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]
)

Source from the content-addressed store, hash-verified

163
164
165def 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
187def quat_to_aa(

Callers 2

__call__Method · 0.90
__call__Method · 0.90

Calls 1

ComposeClass · 0.70

Tested by

no test coverage detected