roma


Nameroma JSON
Version 1.5.1 PyPI version JSON
download
home_pagehttps://github.com/naver/roma
SummaryA lightweight library to deal with 3D rotations in PyTorch.
upload_time2024-10-31 13:30:30
maintainerNone
docs_urlNone
authorRomain Brégier
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements torch numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # *RoMa*: A lightweight library to deal with 3D rotations in PyTorch.
[![Documentation](https://img.shields.io/badge/Documentation--33cb56)](https://naver.github.io/roma/)
[![PyPI version](https://badge.fury.io/py/roma.svg)](https://badge.fury.io/py/roma)
[![ArXiv](https://img.shields.io/badge/arXiv-2103.16317-33cb56)](https://arxiv.org/abs/2103.16317)
[![Unit tests](https://github.com/naver/roma/actions/workflows/main.yml/badge.svg)](https://github.com/naver/roma/actions/workflows/main.yml)
[![Downloads](https://static.pepy.tech/badge/roma)](https://pepy.tech/project/roma)

*RoMa* (which stands for Rotation Manipulation) provides differentiable mappings between 3D rotation representations, mappings from Euclidean to rotation space, and various utilities related to rotations.

It is implemented in PyTorch and aims to be an easy-to-use and reasonably efficient toolbox for Machine Learning and gradient-based optimization.

## Documentation
Latest documentation is available here: https://naver.github.io/roma/.

Below are some examples of use of *RoMa*:
```python
import torch
import roma

# Arbitrary numbers of batch dimensions are supported, for convenience.
batch_shape = (2, 3)

# Conversion between rotation representations
rotvec = torch.randn(batch_shape + (3,))
q = roma.rotvec_to_unitquat(rotvec)
R = roma.unitquat_to_rotmat(q)
Rbis = roma.rotvec_to_rotmat(rotvec)
euler_angles = roma.unitquat_to_euler('xyz', q, degrees=True)

# Regression of a rotation from an arbitrary input:
# Special Procrustes orthonormalization of a 3x3 matrix
R1 = roma.special_procrustes(torch.randn(batch_shape + (3, 3)))
# Conversion from a 6D representation
R2 = roma.special_gramschmidt(torch.randn(batch_shape + (3, 2)))
# From the 10 coefficients of a 4x4 symmetric matrix
q = roma.symmatrixvec_to_unitquat(torch.randn(batch_shape + (10,)))

# Metrics on the rotation space
R1, R2 = roma.random_rotmat(size=5), roma.random_rotmat(size=5)
theta = roma.utils.rotmat_geodesic_distance(R1, R2)
cos_theta = roma.utils.rotmat_cosine_angle(R1.transpose(-2, -1) @ R2)

# Operations on quaternions
q_identity = roma.quat_product(roma.quat_conjugation(q), q)

# Spherical interpolation between rotation vectors (shortest path)
rotvec0, rotvec1 = torch.randn(batch_shape + (3,)), torch.randn(batch_shape + (3,))
rotvec_interpolated = roma.rotvec_slerp(rotvec0, rotvec1, steps)

# Rigid transformation T composed of a rotation part R and a translation part t
t = torch.randn(batch_shape + (3,))
T = roma.Rigid(R, t)
# Composing and inverting transformations
identity = T @ T.inverse()
# Casting the result to a batch of 4x4 homogeneous matrices
M = identity.to_homogeneous()
```

## Installation
The easiest way to install *RoMa* is to use pip:
```
pip install roma
```

Alternatively one can install the latest version of *RoMa* directly from the source repository:
```
pip install git+https://github.com/naver/roma
```

**With old pytorch versions (torch<1.8)**, we recommend installing [torch-batch-svd](https://github.com/KinglittleQ/torch-batch-svd)
to achieve a significant speed-up with `special_procrustes` on CUDA GPUs.
You can check that this module is properly loaded using the function `roma.utils.is_torch_batch_svd_available()`.
**With recent pytorch installations (torch>=1.8), `torch-batch-svd` is no longer needed or used.**


## License
*RoMa*, Copyright (c) 2020 NAVER Corp., is licensed under the 3-Clause BSD License (see [license](https://github.com/naver/roma/blob/master/LICENSE)).

Bits of code were adapted from SciPy. Documentation is generated, distributed and displayed with the support of Sphinx and other materials (see [notice](https://github.com/naver/roma/blob/master/NOTICE)).

## References
For a more in-depth discussion regarding differentiable mappings on the rotation space, please refer to:
- [__Romain Brégier, Deep Regression on Manifolds: a 3D Rotation Case Study.__ in _2021 International Conference on 3D Vision (3DV)_, 2021.](https://arxiv.org/abs/2103.16317)

Please cite this work in your publications:
```
@inproceedings{bregier2021deepregression,
	title={Deep Regression on Manifolds: a {3D} Rotation Case Study},
	author={Br{\'e}gier, Romain},
	journal={2021 International Conference on 3D Vision (3DV)},
	year={2021}
}
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/naver/roma",
    "name": "roma",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Romain Br\u00e9gier",
    "author_email": "romain.bregier@naverlabs.com",
    "download_url": "https://files.pythonhosted.org/packages/21/bb/3a8e83b0a02bd8c4dd4ac1e4bc825632bff5c5b84ae871b50118a03bfa53/roma-1.5.1.tar.gz",
    "platform": null,
    "description": "# *RoMa*: A lightweight library to deal with 3D rotations in PyTorch.\n[![Documentation](https://img.shields.io/badge/Documentation--33cb56)](https://naver.github.io/roma/)\n[![PyPI version](https://badge.fury.io/py/roma.svg)](https://badge.fury.io/py/roma)\n[![ArXiv](https://img.shields.io/badge/arXiv-2103.16317-33cb56)](https://arxiv.org/abs/2103.16317)\n[![Unit tests](https://github.com/naver/roma/actions/workflows/main.yml/badge.svg)](https://github.com/naver/roma/actions/workflows/main.yml)\n[![Downloads](https://static.pepy.tech/badge/roma)](https://pepy.tech/project/roma)\n\n*RoMa* (which stands for Rotation Manipulation) provides differentiable mappings between 3D rotation representations, mappings from Euclidean to rotation space, and various utilities related to rotations.\n\nIt is implemented in PyTorch and aims to be an easy-to-use and reasonably efficient toolbox for Machine Learning and gradient-based optimization.\n\n## Documentation\nLatest documentation is available here: https://naver.github.io/roma/.\n\nBelow are some examples of use of *RoMa*:\n```python\nimport torch\nimport roma\n\n# Arbitrary numbers of batch dimensions are supported, for convenience.\nbatch_shape = (2, 3)\n\n# Conversion between rotation representations\nrotvec = torch.randn(batch_shape + (3,))\nq = roma.rotvec_to_unitquat(rotvec)\nR = roma.unitquat_to_rotmat(q)\nRbis = roma.rotvec_to_rotmat(rotvec)\neuler_angles = roma.unitquat_to_euler('xyz', q, degrees=True)\n\n# Regression of a rotation from an arbitrary input:\n# Special Procrustes orthonormalization of a 3x3 matrix\nR1 = roma.special_procrustes(torch.randn(batch_shape + (3, 3)))\n# Conversion from a 6D representation\nR2 = roma.special_gramschmidt(torch.randn(batch_shape + (3, 2)))\n# From the 10 coefficients of a 4x4 symmetric matrix\nq = roma.symmatrixvec_to_unitquat(torch.randn(batch_shape + (10,)))\n\n# Metrics on the rotation space\nR1, R2 = roma.random_rotmat(size=5), roma.random_rotmat(size=5)\ntheta = roma.utils.rotmat_geodesic_distance(R1, R2)\ncos_theta = roma.utils.rotmat_cosine_angle(R1.transpose(-2, -1) @ R2)\n\n# Operations on quaternions\nq_identity = roma.quat_product(roma.quat_conjugation(q), q)\n\n# Spherical interpolation between rotation vectors (shortest path)\nrotvec0, rotvec1 = torch.randn(batch_shape + (3,)), torch.randn(batch_shape + (3,))\nrotvec_interpolated = roma.rotvec_slerp(rotvec0, rotvec1, steps)\n\n# Rigid transformation T composed of a rotation part R and a translation part t\nt = torch.randn(batch_shape + (3,))\nT = roma.Rigid(R, t)\n# Composing and inverting transformations\nidentity = T @ T.inverse()\n# Casting the result to a batch of 4x4 homogeneous matrices\nM = identity.to_homogeneous()\n```\n\n## Installation\nThe easiest way to install *RoMa* is to use pip:\n```\npip install roma\n```\n\nAlternatively one can install the latest version of *RoMa* directly from the source repository:\n```\npip install git+https://github.com/naver/roma\n```\n\n**With old pytorch versions (torch<1.8)**, we recommend installing [torch-batch-svd](https://github.com/KinglittleQ/torch-batch-svd)\nto achieve a significant speed-up with `special_procrustes` on CUDA GPUs.\nYou can check that this module is properly loaded using the function `roma.utils.is_torch_batch_svd_available()`.\n**With recent pytorch installations (torch>=1.8), `torch-batch-svd` is no longer needed or used.**\n\n\n## License\n*RoMa*, Copyright (c) 2020 NAVER Corp., is licensed under the 3-Clause BSD License (see [license](https://github.com/naver/roma/blob/master/LICENSE)).\n\nBits of code were adapted from SciPy. Documentation is generated, distributed and displayed with the support of Sphinx and other materials (see [notice](https://github.com/naver/roma/blob/master/NOTICE)).\n\n## References\nFor a more in-depth discussion regarding differentiable mappings on the rotation space, please refer to:\n- [__Romain Br\u00e9gier, Deep Regression on Manifolds: a 3D Rotation Case Study.__ in _2021 International Conference on 3D Vision (3DV)_, 2021.](https://arxiv.org/abs/2103.16317)\n\nPlease cite this work in your publications:\n```\n@inproceedings{bregier2021deepregression,\n\ttitle={Deep Regression on Manifolds: a {3D} Rotation Case Study},\n\tauthor={Br{\\'e}gier, Romain},\n\tjournal={2021 International Conference on 3D Vision (3DV)},\n\tyear={2021}\n}\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A lightweight library to deal with 3D rotations in PyTorch.",
    "version": "1.5.1",
    "project_urls": {
        "Homepage": "https://github.com/naver/roma"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d474ade75bc096bd4db0583a7bec6169cc26f04898983ce3d88aefb31140681",
                "md5": "a03c619d83d9d1c157ebf85320603401",
                "sha256": "0b48a83c8dbe582d5458f371782386a0dbbd47b014811e20df3784129a7e6ab5"
            },
            "downloads": -1,
            "filename": "roma-1.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a03c619d83d9d1c157ebf85320603401",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 24436,
            "upload_time": "2024-10-31T13:30:28",
            "upload_time_iso_8601": "2024-10-31T13:30:28.804446Z",
            "url": "https://files.pythonhosted.org/packages/1d/47/4ade75bc096bd4db0583a7bec6169cc26f04898983ce3d88aefb31140681/roma-1.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21bb3a8e83b0a02bd8c4dd4ac1e4bc825632bff5c5b84ae871b50118a03bfa53",
                "md5": "cf4f34e4c1f712e138f8852a0adf96f4",
                "sha256": "69f4d86d5b3ce1f54b9fe1f4b5a6bf309ab11cd610034fa5032a4efeadd4f21c"
            },
            "downloads": -1,
            "filename": "roma-1.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cf4f34e4c1f712e138f8852a0adf96f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 30738,
            "upload_time": "2024-10-31T13:30:30",
            "upload_time_iso_8601": "2024-10-31T13:30:30.562635Z",
            "url": "https://files.pythonhosted.org/packages/21/bb/3a8e83b0a02bd8c4dd4ac1e4bc825632bff5c5b84ae871b50118a03bfa53/roma-1.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-31 13:30:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "naver",
    "github_project": "roma",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "torch",
            "specs": [
                [
                    ">=",
                    "1.6.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": []
        }
    ],
    "lcname": "roma"
}
        
Elapsed time: 0.30988s