Git Product home page Git Product logo

vnn's Introduction

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.

Paper | Project | Short Video

🈶 Other Implementations

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,

@article{deng2021vn,
  title={Vector Neurons: a general framework for SO(3)-equivariant networks},
  author={Deng, Congyue and Litany, Or and Duan, Yueqi and Poulenard, Adrien and Tagliasacchi, Andrea and Guibas, Leonidas},
  journal={arXiv preprint arXiv:2104.12229},
  year={2021}
} 

License

MIT License

Acknowledgement

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

vnn's People

Contributors

flyinggiraffe avatar ray8828 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vnn's Issues

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

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

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) :

net = net.transpose(2, 1).contiguous()
But for DGCNN this does not happen despite the output of the network also being (batchsize, number of parts, number of points):
return x, trans_feat
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!

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.

d = self.map_to_dir(x.transpose(1,-1)).transpose(1,-1)

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

Thank you very much!

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

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!

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/

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?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.