RoMa (Rotation Manipulation) is a lightweight Python library designed to simplify the handling of 3D rotations within PyTorch. It provides differentiable mappings between various 3D rotation representations (e.g., rotation vectors, quaternions, rotation matrices, Euler angles), mappings from Euclidean to rotation space, and a suite of utilities for rotation-related operations. It aims to be an easy-to-use and efficient toolbox for machine learning and gradient-based optimization applications. The current version is 1.5.6, with development actively maintained by NAVER Corp..
pip install romaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `roma` and perform fundamental conversions between different 3D rotation representations: rotation vectors, unit quaternions, and rotation matrices. It also shows the use of `special_procrustes` to orthonormalize an arbitrary matrix into a valid rotation matrix.
Prefer `roma.rotvec_to_unitquat`, `roma.unitquat_to_rotmat`, or `roma.rotvec_to_rotmat` for internal computations and transformations.
If modifying the output of `rotmat_inverse` or similar functions, ensure to call `.clone()` on the result, e.g., `R_inv = roma.utils.rotmat_inverse(R).clone()`.
Install `torch-batch-svd` via `pip install torch-batch-svd` if using PyTorch < 1.8 and needing fast `special_procrustes` on GPU, or upgrade PyTorch to version 1.8 or newer.