Vector Neurons: A General Framework for SO(3)-Equivariant Networks

Related tags

Deep Learning vnn
Overview

Vector Neurons: A General Framework for SO(3)-Equivariant Networks

Created by Congyue Deng, Or Litany, Yueqi Duan, Adrien Poulenard, Andrea Tagliasacchi, and Leonidas Guibas.

We introduce a general framework built on top of what we call Vector Neurons for creating SO(3) equivariant neural networks. Extending neurons from single scalars to 3D vectors, our vector neurons transport SO(3) actions to latent spaces and provide a framework for building equivariance in common neural operations including linear layers, non-linearities, pooling, and normalization.

[Project] [Paper]

Overview

vnn is the author's implementation of Vector Neuron Networks with PointNet and DGCNN backbones. The current version only supports input data without normals.

      

Data Preparation

  • Classification: Download ModelNet40 and save in data/modelnet40_normal_resampled/.
  • Part Segmentation: Download ShapeNet and save in data/shapenetcore_partanno_segmentation_benchmark_v0_normal/.

Usage

Classification on ModelNet40

Training

python train_cls.py --model vn_pointnet_cls --rot ROTATION --log_dir LOG_DIR
python train_cls.py --model vn_dgcnn_cls --rot ROTATION --log_dir LOG_DIR

Evaluation

python test_cls.py --model vn_pointnet_cls --rot ROTATION --log_dir LOG_DIR
python test_cls.py --model vn_dgcnn_cls --rot ROTATION --log_dir LOG_DIR

Here ROTATION should be chosen from aligned, z, so3. For instance, to train a VN-DGCNN on aligned shapes and test it on SO(3)-rotated shapes, run

python train_cls.py --model vn_dgcnn_cls --rot aligned --log_dir vn_dgcnn/aligned/
python test_cls.py --model vn_dgcnn_cls --rot so3 --log_dir vn_dgcnn/aligned/

Part Segmentation on ShapeNet

Training

python train_partseg.py --model vn_pointnet_partseg --rot ROTATION --log_dir LOG_DIR
python train_partseg.py --model vn_dgcnn_partseg --rot ROTATION --log_dir LOG_DIR

Evaluation

python test_partseg.py --model vn_pointnet_partseg --rot ROTATION --log_dir LOG_DIR
python test_partseg.py --model vn_dgcnn_partseg --rot ROTATION --log_dir LOG_DIR

For instance, to train a VN-DGCNN on aligned shapes and test it on SO(3)-rotated shapes, run

python train_partseg.py --model vn_dgcnn_partseg --rot aligned --log_dir vn_dgcnn/aligned/
python test_partseg.py --model vn_dgcnn_partseg --rot so3 --log_dir vn_dgcnn/aligned/

Citation

Please cite this paper if you want to use it in your work,

@misc{deng2021vn,
  title={Vector Neurons: a general framework for SO(3)-equivariant networks},
  author={Congyue Deng, Or Litany, Yueqi Duan, Adrien Poulenard, Andrea Tagliasacchi, Leonidas Guibas},
  year={2021},
  booktitle={arXiv (link available soon)}
} 

License

MIT License

Acknowledgement

The structure of this codebase is borrowed from this pytorch implementataion of PointNet/PointNet++ and DGCNN.

Comments
  • Training detail and performance for VN_DGCNN on ModelNet 40.

    Training detail and performance for VN_DGCNN on ModelNet 40.

    Thanks for the wonderful code!

    With the SGD optimizer (initial lr=0.1) and StepLR scheduler, I achieve the result 73.4% on SO3/SO3. Moreover, I find the training process rather unstable with large fluctuation, comparing to the normal DGCNN and PointNet. Is this usual? I doubt if I run the code correctly. Could you also provide the training log or the environment?

    opened by GostInShell 6
  • Training VN_DGCNN_partseg on own dataset

    Training VN_DGCNN_partseg on own dataset

    Hi there!

    Goal:

    I'm trying to figure out how to train the VN_DGCNN on my own dataset for partial segmentation. I have just one folder (instead of 16 like in the ShapeNet dataset), i.e. one object I'd like to train this model on.

    Problem:

    I assume I just need to alter the dataloader script (which I did; and the train-file naturally), but it's returning an error still. If I interpret the error correctly, it expects weights for 16 objects still?

    If anyone can point me into a certain direction, that'd be much appreciated!

    Error:

    Traceback (most recent call last): File "/home/~/VNN/train_partseg_US.py", line 320, in <module> main(args) File "/home/~/VNN/train_partseg_US.py", line 204, in main seg_pred, trans_feat = classifier(points, to_categorical(label, num_classes)) File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/home/~/VNN/models/vn_dgcnn_partseg.py", line 86, in forward l = self.conv7(l) File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 302, in forward return self._conv_forward(input, self.weight, self.bias) File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 298, in _conv_forward return F.conv1d(input, weight, bias, self.stride, RuntimeError: Given groups=1, weight of size [64, 16, 1], expected input[16, 1, 1] to have 16 channels, but got 1 channels instead

    opened by AdeV-Oly 2
  • Transpose for part segmentation

    Transpose for part segmentation

    Hi, I have a quick question about the different outputs of pointnet and DGCNN for segmentation. It looks like for pointnet you transpose the output of the network (batchsize, number of parts, number of points) -> (batchsize, number of points, number of parts) : https://github.com/FlyingGiraffe/vnn/blob/1300091569252f0a0fbfe78ddea3684a14a7e69d/models/pointnet_partseg.py#L70 But for DGCNN this does not happen despite the output of the network also being (batchsize, number of parts, number of points): https://github.com/FlyingGiraffe/vnn/blob/1300091569252f0a0fbfe78ddea3684a14a7e69d/models/dgcnn_partseg.py#L108 Why is this the case? Is there then not a mismatch with ground truth segmentation labels for one of the networks?

    Thanks for your help!

    opened by EdwardSmith1884 2
  • Accuracy of VN_DGCNN on the ModelNet40

    Accuracy of VN_DGCNN on the ModelNet40

    Hi, Thanks for your work and codes. However, when I reproduce your code with the VN_DGCNN model and default parameters, I just got 80.2% in the I/I case and 78.8% in the z/z case. The results are much less than the accuracy reported in the paper. Are there any details I missed? Could you help us analyze the problem or give more details for discussion? Thanks a lot!

    opened by AkonLau 2
  • Is equation 15 (in chapter 3.5 Invariant Layers of your paper) correctly implemented?

    Is equation 15 (in chapter 3.5 Invariant Layers of your paper) correctly implemented?

    Hi

    The invariant layer defined in chapter 3.5 of your paper (specifically equations 14 and 15) appears to be implemented in the VNStdFeature module defined in vn_layers.py and it is used by the VN-PointNetEncoder in l.92 of vn_pointnet.py. What I do not understand, is that in equation 15 of the paper you write V_n*T_n.transpose(), however, in the code it appears to me that you instead compute [V_n, V_n.mean()]*T_n.transpose() (l.191 of vn_pointnet.py). This is because in the code, x (which is the input to the module VNStdFeature formed in l.91 of vn_pointnet.py) is the concatenated tensor [V_n, V_n.mean()] . Also, for clarification, I understand T_n (defined in equation 14 of the paper) to be the output z0 in l.170 of vn_layers.py.

    An answer as to why equation 15 doesn't appear to be aligned with the code would be be greatly appreciated. Thanks

    opened by lapatric 2
  • Running VNN Partseg on ShapeNet data

    Running VNN Partseg on ShapeNet data

    Hey there!

    I'm interested in using this model for my own project, but I've run into a small problem during training for both the example/Shapenet dataset and my own dataset.

    Example data / ShapeNet data

    So I've tried to run the example part segmentation on the ShapeNet data to see if it would even run on my system. However, during training it returns a RunTimeError. If I remember correctly, the dimensions it returned were the following:

    Traceback (most recent call last):
      File "/home/~/VNN/train_partseg.py", line 321, in <module>
        main(args)
      File "/home/~/VNN/train_partseg.py", line 205, in main
        seg_pred, trans_feat = classifier(points, to_categorical(label, num_classes))
      File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
        return forward_call(*input, **kwargs)
      File "/home/~/VNN/models/vn_dgcnn_partseg.py", line 86, in forward
        l = self.conv7(l)
      File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
        return forward_call(*input, **kwargs)
      File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward
        input = module(input)
      File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
        return forward_call(*input, **kwargs)
      File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 302, in forward
        return self._conv_forward(input, self.weight, self.bias)
      File "/home/~/.conda/envs/VNN/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 298, in _conv_forward
        return F.conv1d(input, weight, bias, self.stride,
    RuntimeError: Given groups=1, weight of size [90, 45, 3, 2], expected input[1, 15, 16, 32] to have 45 channels, but got 15 channels instead
    

    Is this a known error for the example set?

    Kind regards

    opened by AdeV-Oly 1
  • Where can I get the supplementary material?

    Where can I get the supplementary material?

    Hi, Thanks for your work. I am very interested in your work and would like to learn more about your experimental results from the supplementary material. Where can I get the supplementary material?

    opened by danpeng2 1
  • Implementation of VNMaxPooling

    Implementation of VNMaxPooling

    Hi @FlyingGiraffe, In the maxpooling implementation, at this line: https://github.com/FlyingGiraffe/vnn/blob/8e6a45be00c90611311dd4be5d0038ca5d0ee94b/models/vn_layers.py#L141

    In order to get the indices idx, are we suppose to use argmax instead of max operation?

    opened by tranluan 1
  • The use of get_graph_feature_cross in vn_pointnet.py

    The use of get_graph_feature_cross in vn_pointnet.py

    Hi

    Could you please explain the purpose of get_graph_feature_cross in l.76 of vn_pointnet.py? It doesn't seem that this function has any equivalent in the original implementation of pointnet.

    Thanks!

    opened by lapatric 1
  • why using concatenation to replace the multiplication in STN

    why using concatenation to replace the multiplication in STN

    Hi @FlyingGiraffe ,

    Thanks for your amazing work, while I found it quite confusing in vn-pointnet that for STN you concated the features rather than multiplyiny them, which is different than the original PointNet. Can you elaborate on this part?

    opened by Crane-YU 0
  • Question obout training

    Question obout training

    May I ask why the accuracy rate obtained by training the model according to the commands in the readme is only about 60%? I trained for 250 epochs. Training command: python train_cls.py --model vn_dgcnn_cls --rot z --log_dir vn_dgcnn/aligned/

    opened by yueyanghu00 0
  • Questions about VNMaxPool

    Questions about VNMaxPool

    Dear @FlyingGiraffe,

    Thanks for your impressive work.

    I have a question about the VNMaxPool layer. You used the argmax to select the idx of the pooled features. However, the idx is not differentiable, and thus the self.map_to_dir layer will not be updated anyway. https://github.com/FlyingGiraffe/vnn/blob/f3197e210022b5f0015e0da6456adf66bd0cd73e/models/vn_layers.py#L139

    Could you explain this a little bit? Maybe I am wrong.

    Thank you very much!

    opened by guochengqian 0
Owner
Congyue Deng
CS PhD student at Stanford, advised by Leonidas Guibas | Previous: math undergrad at Tsinghua
Congyue Deng
Geometric Vector Perceptron --- a rotation-equivariant GNN for learning from biomolecular structure

Geometric Vector Perceptron Code to accompany Learning from Protein Structure with Geometric Vector Perceptrons by B Jing, S Eismann, P Suriana, RJL T

Dror Lab 85 Dec 29, 2022
Geometric Vector Perceptrons --- a rotation-equivariant GNN for learning from biomolecular structure

Geometric Vector Perceptron Implementation of equivariant GVP-GNNs as described in Learning from Protein Structure with Geometric Vector Perceptrons b

Dror Lab 142 Dec 29, 2022
General Virtual Sketching Framework for Vector Line Art (SIGGRAPH 2021)

General Virtual Sketching Framework for Vector Line Art - SIGGRAPH 2021 Paper | Project Page Outline Dependencies Testing with Trained Weights Trainin

Haoran MO 118 Dec 27, 2022
Vector AI — A platform for building vector based applications. Encode, query and analyse data using vectors.

Vector AI is a framework designed to make the process of building production grade vector based applications as quickly and easily as possible. Create

Vector AI 267 Dec 23, 2022
Code for the paper "Ordered Neurons: Integrating Tree Structures into Recurrent Neural Networks"

ON-LSTM This repository contains the code used for word-level language model and unsupervised parsing experiments in Ordered Neurons: Integrating Tree

Yikang Shen 572 Nov 21, 2022
Neuron Merging: Compensating for Pruned Neurons (NeurIPS 2020)

Neuron Merging: Compensating for Pruned Neurons Pytorch implementation of Neuron Merging: Compensating for Pruned Neurons, accepted at 34th Conference

Woojeong Kim 33 Dec 30, 2022
Binary Stochastic Neurons in PyTorch

Binary Stochastic Neurons in PyTorch http://r2rt.com/binary-stochastic-neurons-in-tensorflow.html https://github.com/pytorch/examples/tree/master/mnis

Onur Kaplan 54 Nov 21, 2022
A library for finding knowledge neurons in pretrained transformer models.

knowledge-neurons An open source repository replicating the 2021 paper Knowledge Neurons in Pretrained Transformers by Dai et al., and extending the t

EleutherAI 96 Dec 21, 2022
WormMovementSimulation - 3D Simulation of Worm Body Movement with Neurons attached to its body

Generate 3D Locomotion Data This module is intended to create 2D video trajector

null 1 Aug 9, 2022
EGNN - Implementation of E(n)-Equivariant Graph Neural Networks, in Pytorch

EGNN - Pytorch Implementation of E(n)-Equivariant Graph Neural Networks, in Pytorch. May be eventually used for Alphafold2 replication. This

Phil Wang 259 Jan 4, 2023
(CVPR2021) ClassSR: A General Framework to Accelerate Super-Resolution Networks by Data Characteristic

ClassSR (CVPR2021) ClassSR: A General Framework to Accelerate Super-Resolution Networks by Data Characteristic Paper Authors: Xiangtao Kong, Hengyuan

Xiangtao Kong 308 Jan 5, 2023
Implementation of Lie Transformer, Equivariant Self-Attention, in Pytorch

Lie Transformer - Pytorch (wip) Implementation of Lie Transformer, Equivariant Self-Attention, in Pytorch. Only the SE3 version will be present in thi

Phil Wang 78 Oct 26, 2022
Implementation of SE3-Transformers for Equivariant Self-Attention, in Pytorch.

SE3 Transformer - Pytorch Implementation of SE3-Transformers for Equivariant Self-Attention, in Pytorch. May be needed for replicating Alphafold2 resu

Phil Wang 207 Dec 23, 2022
Authors implementation of LieTransformer: Equivariant Self-Attention for Lie Groups

LieTransformer This repository contains the implementation of the LieTransformer used for experiments in the paper LieTransformer: Equivariant self-at

null 35 Oct 18, 2022
Implementation of E(n)-Transformer, which extends the ideas of Welling's E(n)-Equivariant Graph Neural Network to attention

E(n)-Equivariant Transformer (wip) Implementation of E(n)-Equivariant Transformer, which extends the ideas from Welling's E(n)-Equivariant G

Phil Wang 132 Jan 2, 2023
Official code of the paper "ReDet: A Rotation-equivariant Detector for Aerial Object Detection" (CVPR 2021)

ReDet: A Rotation-equivariant Detector for Aerial Object Detection ReDet: A Rotation-equivariant Detector for Aerial Object Detection (CVPR2021), Jiam

csuhan 334 Dec 23, 2022
LieTransformer: Equivariant Self-Attention for Lie Groups

LieTransformer This repository contains the implementation of the LieTransformer used for experiments in the paper LieTransformer: Equivariant Self-At

OxCSML (Oxford Computational Statistics and Machine Learning) 50 Dec 28, 2022
This is the codebase for the ICLR 2021 paper Trajectory Prediction using Equivariant Continuous Convolution

Trajectory Prediction using Equivariant Continuous Convolution (ECCO) This is the codebase for the ICLR 2021 paper Trajectory Prediction using Equivar

Spatiotemporal Machine Learning 45 Jul 22, 2022
You Only Hypothesize Once: Point Cloud Registration with Rotation-equivariant Descriptors

You Only Hypothesize Once: Point Cloud Registration with Rotation-equivariant Descriptors In this paper, we propose a novel local descriptor-based fra

Haiping Wang 80 Dec 15, 2022