• Stars
    star
    182
  • Rank 211,102 (Top 5 %)
  • Language
    Jupyter Notebook
  • Created about 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Smooth Representation of SO(3) for Deep Rotation Learning with Uncertainty.

A Smooth Representation of SO(3) for Deep Rotation Learning with Uncertainty

Valentin Peretroukhin, Matthew Giamou, David M. Rosen, W. Nicholas Greene, Nicholas Roy, and Jonathan Kelly

Robotics: Science and Systems (2020)

🏆 Best Student Paper Award Winner!🏆

Paper website: https://papers.starslab.ca/bingham-rotation-learning/
arXiv paper: https://arxiv.org/abs/2006.01031

There are many ways to represent rotations including Euler angles, rotation matrices, axis-angle vectors, and unit quaternions. In deep learning applications, it is common to use unit quaternions for their simple geometric and algebraic structure. However, unit quaternions lack an important smoothness property that makes learning 'large' rotations difficult, and other representations are not easily amenable to learning uncertainty. In this work, we address this gap through a symmetric-matrix-based representation that is both smooth and defines a belief (or distribution) over rotations.

This repository contains example code to implement our representation in your work and all of our experiments from the paper (in pytorch).

Get Started

Prerequistes

Standard pip/conda stuff: numpy, scipy, torch, torchvision, argparse, matplotlib

Slightly less standard stuff: tqdm, tensorboardx

Finally we rely on our lab's Lie group library, liegroups (with bindings for pytorch/numpy), available here (unfortunately not yet on pip). You can install it via:

git clone https://github.com/utiasSTARS/liegroups.git

cd liegroups && pip install .

Run the script demo!

The demo will train three models on a synthetic point cloud dataset, with the unit quaternion, six dimensional representation (Zhou et. al, CVPR 2019 -- [41] in the paper), and our symmetric A representation.

python run_rotation_learning_demo.py

Run the rss_demo.ipynb notebook!

Note the additional dependancy lrcurve (for live plotting) You can see a list of options within the script.

Recreate our experiments

See the experiments folder for all of our experimental scripts (you will need to download raw KITTI and ShapeNet files). To regenerate our plots, there are also several readme plots that contain Google Drive links with cached data.

Use Our Representation in Your Work

Our representation is very easy to use for any rotation learning!

  1. Create a network that outputs 10-vectors (i.e., Bx10 matrices for a minibatch size B).

  2. Create a function that converts each 10-vector into a symmetric 4x4 matrix (Bx4x4). We have written a function convert_Avec_to_A() which you can steal! The file qcqp_layers.py contains this function as well as some other (batch-ified) helper functions that may be useful.

  3. To convert each 4x4 symmetric matrix into a unit quaternion, simply apply torch.symeig() and extract the eigenvector corresponding to the smallest eigenvalue. This function can be a simple as:

    def A_vec_to_quat(A_vec):
        A = convert_Avec_to_A(A_vec)
        _, evs = torch.symeig(A, eigenvectors=True)
        return evs[:,:,0].squeeze()

    Our version of this function (see qcqp_layers.py) has a small check for dimensionality but is otherwise identical to the one above. Note that we have also implemented a torch.autograd function with an explicit analytic gradient but the built-in pytorch differentiation of torch.symeig() results in identical performance. Feel free to use either.

This entire procedure can be implemented within your model. For example:

class RotationNet(torch.nn.Module):
    def __init__(self):
        super(RotationNet, self).__init__()
        self.net = GenericNet() #Outputs Bx10
    
    def A_vec_to_quat(self, A_vec):
        A = convert_Avec_to_A(A_vec) #Bx10 -> Bx4x4
        _, evs = torch.symeig(A, eigenvectors=True)
        return evs[:,:,0].squeeze()

    def forward(self, x):
        A_vec = self.net(x) #Bx10
        q = self.A_vec_to_quat(A_vec) #Bx10 -> Bx4
        return q #unit quaternions!

This incurs minimal (but non-zero) overhead and should improve training if you have `large' rotation targets (i.e., rotations close to 180 degrees about any axis).

Citation

If you use this in your work, please cite:

@inproceedings{peretroukhin_so3_2020,
   author={Valentin Peretroukhin and Matthew Giamou and David M. Rosen and W. Nicholas Greene and Nicholas Roy and Jonathan Kelly},
   title={A {S}mooth {R}epresentation of {SO(3)} for {D}eep {R}otation {L}earning with {U}ncertainty},
   booktitle={Proceedings of {R}obotics: {S}cience and {S}ystems {(RSS'20)}},
   year={2020},
   date = {2020-07-12/2020-07-16},
   month = {Jul. 12--16},
}

More Repositories

1

pykitti

Python tools for working with KITTI data.
Python
1,152
star
2

liegroups

Python implementation of SO2, SE2, SO3, and SE3 matrix Lie groups using numpy or pytorch
Python
332
star
3

msckf-swf-comparison

MATLAB code and data for our CRV 2015 paper
MATLAB
132
star
4

GraphIK

A library for solving inverse kinematics with graphical models and distance geometry.
Python
113
star
5

pyshoe

An open source foot-mounted INS accompanied by a comprehensive inertial dataset.
Python
83
star
6

pyslam

Non-linear least-squares SLAM in Python using scipy and numpy. Modelled after Google's Ceres solver.
Python
73
star
7

dpc-net

Deep Pose Correction for Visual Localization
Python
72
star
8

certifiable-calibration

Certifiably globally optimal extrinsic calibration for sensors providing egomotion estimates.
Python
66
star
9

PhoenixDrone

Open-Source Releases of the Phoenix Tail-sitter Drone Project
52
star
10

cat-net

Canonical Appearance Transformations
Python
52
star
11

ss-dpc-net

Supporting Code for "Self-Supervised Deep Pose Corrections for Robust Visual Odometry"
Python
52
star
12

learned_scale_recovery

Accompanying code for 'Self-Supervised Scale Recovery for Monocular Visual Odometry'
Python
47
star
13

sun-bcnn

Bayesian CNN Sun Detector
Python
34
star
14

enav-planetary-dataset

Energy-Aware Planetary Navigation Dataset
Python
34
star
15

sos-rotation-averaging

Certifiably globally optimal unit quaternion rotation averaging via Sparse Bounded-degree sum of squares optimization.
MATLAB
16
star
16

lfgp

Learning from Guided Play: A Scheduled Hierarchical Approach for Improving Exploration in Adversarial Imitation Learning Source Code
Python
15
star
17

pyb-sim-models

PyBullet simulation models repository
Python
15
star
18

sos-ik

Inverse kinematics using sum of squares optimization.
MATLAB
14
star
19

tightly-coupled-SfM

Python
14
star
20

matchable-image-transforms

Learning Matchable Image Transformations
Python
12
star
21

manipulator-learning

Manipulation OpenAI Gym environments to simulate robots at the STARS lab, as well as compatible imitation learning tools
Python
11
star
22

cslam-resource

MATLAB
11
star
23

Phoenix-Simulink

Phoenix Tailsitter MATLAB Simulink Models
10
star
24

inertial-identification-with-part-segmentation

Source code implementing our visual part-segmentation pipeline and inertial identification algorithms, and our contributed dataset of objects used to test the whole pipeline.
C++
9
star
25

so3_learning

Learning deep probabilistic estimates of SO(3)
Python
9
star
26

learned-camera-controller

Python
8
star
27

visual-haptic-dynamics

Visual-Haptic Latent Dynamics
Jupyter Notebook
8
star
28

multiview-manipulation

Seeing All the Angles: Learning Multiview Manipulation Policies for Contact-Rich Tasks from Demonstrations
Jupyter Notebook
8
star
29

generative-graphik

Generative and Graphical Inverse Kinematics
Python
8
star
30

PX4-PhoenixDrone

PX4 Source Code for Phoenix Tail-sitter
C++
7
star
31

ceres-slam

A Ceres-based SLAM system.
C++
7
star
32

robust-latent-srl

Heteroscedastic Uncertainty for Robust Generative Latent Dynamics
Python
6
star
33

panda-rl-envs

Reinforcement Learning on a Panda Manipulator using FAIR's Polymetis
Python
4
star
34

vpace

Scripts for running VPACE experiments.
Python
3
star
35

ROB498-support

Materials for ROB498 Capstone Design Course.
2
star
36

ROB498-flight

ROB498 flight software repository (for Jetson, etc.).
Dockerfile
2
star
37

panda-polymetis

Tools for working with a panda robot using FAIR's polymetis library.
Python
2
star
38

transform-utils

Common SO3 and SE3 functionalities that can be used across repos.
Python
2
star
39

ros-np-tools

A set of reusable functions and classes for reducing boilerplate ROS and related numpy code.
Python
2
star
40

ALLO

The Anomaly Localization in Lunar Orbit (ALLO) data generation code and benchmark evaluation
Python
2
star
41

thing-gym-ros

A repository containing OpenAI gym-based envs built on ROS to be combined with the Thing mobile manipulation platform at UTIAS.
Python
1
star
42

Phoenix-MCAD

Mechanical CAD files for construction of Phoenix Tailsitter
1
star
43

PhoenixDrone-sitl_gazebo

Gazebo Plugins for SITL Simulation with Phoenix Drone
C++
1
star