RoMa: A lightweight library to deal with 3D rotations in PyTorch.

Related tags

Deep Learning roma
Overview

RoMa: A lightweight library to deal with 3D rotations in PyTorch.

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/.

Installation

The easiest way to install RoMa consists in using pip:

pip install roma

We also recommend installing torch-batch-svd to achieve significant speed-up with special_procrustes function on a CUDA GPU.

Alternatively one can install RoMa directly from source repository:

pip install git+https://github.com/naver/roma

or include the source repository (https://github.com/naver/roma) as a Git submodule.

License

RoMa, Copyright (c) 2021 NAVER Corp., is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license (see license).

Bits of code were adapted from SciPy. Documentation is generated, distributed and displayed with the support of Sphinx and other materials (see notice).

References

For a more in-depth discussion regarding differentiable mappings on the rotation space, please refer to:

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}
}
Comments
  • samping unit quaternions

    samping unit quaternions

    The code to sample random unit quaternions in the repo https://github.com/naver/roma/blob/34bd74489369c6c1489b01fc3c51d63a2ecd04e9/roma/utils.py#L57-L58 isn't correct.

    The correct way to sample is mentioned in Algorithm 2 in Kuffner at al. http://pajarito.materials.cmu.edu/documents/kuffner_james_2004_1.pdf

    It might be worth adding that in. PyQuaternion implements it in the correct way: https://github.com/KieranWynn/pyquaternion/blob/master/pyquaternion/quaternion.py#L261

    enhancement 
    opened by ankurhanda 6
  • `shortest_path` bug in `unitquat_to_rotvec()`

    `shortest_path` bug in `unitquat_to_rotvec()`

    https://github.com/naver/roma/blob/22806dfb43329b9bf1dd2cead7e96720330e3151/roma/utils.py#L255-L280

    1. On Line 272, q1 = -torch.sign(torch.sum(q0*q1, dim=-1, keepdim=True)) * q1 should be q1 = torch.sign(torch.sum(q0*q1, dim=-1, keepdim=True)) * q1, since one of the quaternions only need to be flipped when $cos \Omega < 0$, hence dot product $< 0$
    2. The shortest_path flag is actually useless, since unitquat_to_rotvec() (used on L275) always returns rotation vectors with angles within $[0, \pi]$
    opened by low5545 5
  • Unflatten does not work with pytorch 1.6

    Unflatten does not work with pytorch 1.6

    Thanks for this very useful library!

    I'm getting an error in internal.unflatten_batch_dims:

      File "site-packages\roma\mappings.py", line 397, in rotvec_to_rotmat
        return roma.internal.unflatten_batch_dims(R, batch_shape)
      File "site-packages\roma\internal.py", line 33, in unflatten_batch_dims
        return tensor.unflatten(dim=0, sizes=batch_shape) if len(batch_shape) > 0 else tensor.squeeze(0)
    TypeError: unflatten() got an unexpected keyword argument 'sizes'
    

    I think this happens because I'm using pytorch 1.6, which does not yet support this API. I'm not entirely sure when this change was introduced, but with pytorch 1.10 it's not a problem anymore. This fix might be as easy as bumping the pytorch version number in requirements.txt :)

    opened by kaufManu 3
  • `rotvec_to_rotmat` function detach the tensor's gradient

    `rotvec_to_rotmat` function detach the tensor's gradient

    Hi there, I use the rotvec_to_rotmat fucntion, and I found that this function detach the gradient flow. Is there any way to keep gradients flow in this function?

    tvec = torch.randn(1, 3, requires_grad=True)
    rot = roma.rotvec_to_rotmat(rotvec)
    print(rot.requires_grad) # get False
    
    opened by zxiaomzxm 2
  • Variable name error in `roma/mappings.py`

    Variable name error in `roma/mappings.py`

    Something wrong in line 27 of roma/mappings.py.

    https://github.com/naver/roma/blob/fa66d5a9095d330b297905ec67ed273601184792/roma/mappings.py#L13-L27

    https://github.com/naver/roma/blob/fa66d5a9095d330b297905ec67ed273601184792/roma/mappings.py#L27

    It should be SVt = SVt.clone()?

    opened by NatureGeorge 1
Public Implementation of ChIRo from "Learning 3D Representations of Molecular Chirality with Invariance to Bond Rotations"

Learning 3D Representations of Molecular Chirality with Invariance to Bond Rotations This directory contains the model architectures and experimental

null 35 Dec 5, 2022
Lightweight mmm - Lightweight (Bayesian) Media Mix Model

Lightweight (Bayesian) Media Mix Model This is not an official Google product. L

Google 342 Jan 3, 2023
A lightweight library to compare different PyTorch implementations of the same network architecture.

TorchBug is a lightweight library designed to compare two PyTorch implementations of the same network architecture. It allows you to count, and compar

Arjun Krishnakumar 5 Jan 2, 2023
toroidal - a lightweight transformer library for PyTorch

toroidal - a lightweight transformer library for PyTorch Toroidal transformers are of smaller size and lower weight than the more common E-I types. Th

MathInf GmbH 64 Jan 7, 2023
Lightweight, Python library for fast and reproducible experimentation :microscope:

Steppy What is Steppy? Steppy is a lightweight, open-source, Python 3 library for fast and reproducible experimentation. Steppy lets data scientist fo

minerva.ml 134 Jul 10, 2022
Lightweight library to build and train neural networks in Theano

Lasagne Lasagne is a lightweight library to build and train neural networks in Theano. Its main features are: Supports feed-forward networks such as C

Lasagne 3.8k Dec 29, 2022
Lightweight library to build and train neural networks in Theano

Lasagne Lasagne is a lightweight library to build and train neural networks in Theano. Its main features are: Supports feed-forward networks such as C

Lasagne 3.8k Feb 11, 2021
banditml is a lightweight contextual bandit & reinforcement learning library designed to be used in production Python services.

banditml is a lightweight contextual bandit & reinforcement learning library designed to be used in production Python services. This library is developed by Bandit ML and ex-authors of Facebook's applied reinforcement learning platform, Reagent.

Bandit ML 51 Dec 22, 2022
LWCC: A LightWeight Crowd Counting library for Python that includes several pretrained state-of-the-art models.

LWCC: A LightWeight Crowd Counting library for Python LWCC is a lightweight crowd counting framework for Python. It wraps four state-of-the-art models

Matija Teršek 39 Dec 28, 2022
A lightweight python AUTOmatic-arRAY library.

A lightweight python AUTOmatic-arRAY library. Write numeric code that works for: numpy cupy dask autograd jax mars tensorflow pytorch ... and indeed a

Johnnie Gray 62 Dec 27, 2022
Pynomial - a lightweight python library for implementing the many confidence intervals for the risk parameter of a binomial model

Pynomial - a lightweight python library for implementing the many confidence intervals for the risk parameter of a binomial model

Demetri Pananos 9 Oct 4, 2022
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Jan 1, 2023
PIKA: a lightweight speech processing toolkit based on Pytorch and (Py)Kaldi

PIKA: a lightweight speech processing toolkit based on Pytorch and (Py)Kaldi PIKA is a lightweight speech processing toolkit based on Pytorch and (Py)

null 336 Nov 25, 2022
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 11.9k Feb 13, 2021
Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two

512x512 flowers after 12 hours of training, 1 gpu 256x256 flowers after 12 hours of training, 1 gpu Pizza 'Lightweight' GAN Implementation of 'lightwe

Phil Wang 1.5k Jan 2, 2023
This is an official pytorch implementation of Lite-HRNet: A Lightweight High-Resolution Network.

Lite-HRNet: A Lightweight High-Resolution Network Introduction This is an official pytorch implementation of Lite-HRNet: A Lightweight High-Resolution

HRNet 675 Dec 25, 2022
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Jan 8, 2023
Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more

Apache MXNet (incubating) for Deep Learning Apache MXNet is a deep learning framework designed for both efficiency and flexibility. It allows you to m

The Apache Software Foundation 20.2k Jan 8, 2023
lightweight python wrapper for vowpal wabbit

vowpal_porpoise Lightweight python wrapper for vowpal_wabbit. Why: Scalable, blazingly fast machine learning. Install Install vowpal_wabbit. Clone and

Joseph Reisinger 163 Nov 24, 2022