ICLR18 best paper: Spherical CNNs

论文链接:https://arxiv.org/abs/1801.10130

GITHUB地址:https://github.com/jonas-koehler/s2cnn

中文讲解地址:

简介:

In this paper we introduce the building blocks for constructing spherical CNNs. We propose a definition for the spherical cross-correlation that is both expressive and rotation-equivariant. The spherical correlation satisfies a generalized Fourier theorem, which allows us to compute it efficiently using a generalized (non-commutative) Fast Fourier Transform (FFT) algorithm. We demonstrate the computational efficiency, numerical accuracy, and effectiveness of spherical CNNs applied to 3D model recognition and atomization energy regression.

下面是详细的代码配置过程:

1. 运行环境配置

1.1    安装Anaconda

下载地址:https://www.anaconda.com/download/

安装参考:致Python初学者:Anaconda入门使用指南

注意如果你想随时使用conda,就要将anaconda添加到环境变量中(其实在安装的时候会问你是否加入环境变量,选择yes后,还是可能会没有被添加),即在/home/yourname目录下,输入(如果你在使用bash就输入下面的命令,否则改成相应的如.zshrc):

vim .bashrc

然后在文件末尾添加上:

export PATH=/home/yourname/anaconda3/bin:$PATH

再输入以下命令使环境变量立刻生效:

source .bashrc

如果你不想更改系统的python环境变量,就不要把conda加入到系统的环境变量里,

而是每次都在虚拟环境里使用conda

安装虚拟环境,并切换至虚拟环境,参考:https://segmentfault.com/a/1190000005828284

比如这里使用了:

# 创建虚拟环境
~/anaconda3/bin/conda create -n py3 python=3.6 # 激活虚拟环境
source ~/anaconda3/bin/activate py3

1.1.1    为了下载速度更快,更换conda下载源为清华大学镜像

参考:https://blog.csdn.net/huludan/article/details/52711550

运行以下两行命令即可:

conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
conda config --set show_channel_urls yes

1.2    安装Pytorch

地址:http://pytorch.org

请选择适合自己的安装方法,这里我们选择了运行以下命令:

conda install pytorch torchvision cuda91 -c pytorch

1.3    安装CUPY

地址:https://github.com/cupy/cupy

安装方法:

conda install cupy
不要使用!!!!这个可能就是导致一直出BUG的元凶!!!!!
pip install cupy --user

1.4    安装lie_learn

地址:https://github.com/AMLab-Amsterdam/lie_learn.git

输入以下命令:

git clone https://github.com/AMLab-Amsterdam/lie_learn.git
python setup.py install

中间需要从Google Drive获取J_dense_0-278.npy(下载链接),嗯……自己想办法吧

或者手动下载下来,然后将其放在这个路径:(会有路径提示,认真看)

~/anaconda3/lib/python3./site-packages/lie_learn/representations/SO3/pinchon_hoggan

1.5    安装pynvrtc

输入命令:

pip install pynvrtc --user

2. Spherical CNNs

2.1    安装Spherical CNNs

执行以下命令:

git clone https://github.com/jonas-koehler/s2cnn
cd s2cnn
vim setup.py [怎么修改请看下面,需要删除一个'r']
python setup.py install

在setup.py中有一行是读取README.md文件,但是报错说编码格式错误,

请参考:https://github.com/jonas-koehler/s2cnn/issues/3

adding , encoding='utf-8' instead of 'r', encoding='utf8' in open() function in setup.py file

这个如果不解决,之后会出现报错:module 's2cnn.ops.gpu.lib_cufft' has no attribute 'destroy'

作者已经把源代码改了,无需关注此问题

2.2    运行equivariance_error 的例子来测试是否真正安装成功

运行命令:

python main.py

如果出现返回以下结果,则证明安装成功:

main.py:: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead.
x = torch.autograd.Variable(torch.randn(, , , ), volatile=True).cuda() # [batch, feature, beta, alpha]
relative error = 0.022134914994239807

2.2.1    如果出现module 's2cnn.ops.gpu.lib_cufft' has no attribute 'destroy'

参见我的提问:https://github.com/jonas-koehler/s2cnn/issues/5

我尝试在不同的3个服务器上安装了7、8次,最终有一次安装成功了,没有报出这个错误。但是和之前的安装方案并没有什么区别,所以这里也很迷茫。

有一位网友说在s2cnn/setup.py中,修改为

long_description=open(os.path.join(os.path.dirname(__file__), "README.md"), 'r', encoding='utf8').read()

而目前(20180502)作者将这里修改为了

long_description=open(os.path.join(os.path.dirname(__file__), "README.md"), encoding='utf8').read()

实测网友给出的方案后,会出现新的BUG,详见https://github.com/jonas-koehler/s2cnn/issues/3

所以,目前只能多试试了

下面给出作者的安装流程:https://github.com/jonas-koehler/s2cnn/issues/5

I created a new anaconda environment and I installed everything.
I didn't manage to install cupy with cuda9 so I did all with cuda8.

Create new env:
conda create --name s2cnn_test python=3.6
conda activate s2cnn_test
Compile s2cnn:
conda install pytorch torchvision -c pytorch (version0.4.0-py36_cuda8.0.61_cudnn7.1.2_1)
pip install cupy-cuda80 (version cupy-cuda80-4.0.0)
pip install pynvrtc
python setup.py install
Install lie_learn:
conda install -c anaconda cython
conda install -c anaconda requests
git clone https://github.com/AMLab-Amsterdam/lie_learn.git
python setup.py install
Run the equivariance_error example
conda install -c anaconda scipy
python main.py

2.3    运行example之shrec17

例子地址:https://github.com/jonas-koehler/s2cnn/tree/master/examples/shrec17

2.3.1    安装trimesh和pyembree

仓库地址:https://github.com/mikedh/trimesh

# install modules for spatial indexing and  polygon manipulation
# these generally install cleanly on Linux, Windows, and OSX
conda install -c conda-forge rtree shapely # install pyembree for fast ray queries
# Linux and OSX only
conda install -c conda-forge pyembree
# install Trimesh and soft dependencies that are easy to install
# these generally install cleanly on Linux, Windows, and OSX
pip install trimesh[easy]

2.3.2    训练网络

python train.py --model_path model.py --log_dir my_run --dataset train --batch_size  --augmentation 

这行命令执行过程中会下载一个很大很大的数据集,数据集的主页:https://shapenet.cs.stanford.edu/shrec17/

2.3.3    验证训练后的网络

在运行之前,先安装nodejs才行,

这里使用了以下命令来进行安装

conda install nodejs

然后执行验证程序

python test.py --log_dir my_run --dataset val --batch_size  --augmentation
cat my_run/summary.csv | grep micro

2.3.4    报错处理

如果出现这个错误:No such file or directory: 'nodejs': 'nodejs'

解决方案:通过conda,在虚拟环境中安装的包,都在虚拟环境下能够找到,比如这里,我的包的路径在:

~/anaconda3/envs/s2cnn_test/bin

在bin目录下能够找到一个文件叫做node,所以,执行以下命令:

cd ~/anaconda3/envs/s2cnn_test/bin
cp -r node nodejs

就可以解决这个报错了

如果出现找不到scipy:

不要使用 conda install scipy,

这行命令会把pytorch降级到0.1.0版本。

应该使用如下命令:

conda install -c anaconda scipy 

Spherical CNNs代码配置过程的更多相关文章

  1. [转]caffe的配置过程

    caffe的配置过程 转:http://blog.csdn.net/brightming/article/details/51106629   版权声明:本文为博主原创文章,欢迎转载!转载请写明原文链 ...

  2. Sublime Text2配置过程

    今天Sublime Text2不知道为什么突然崩溃了,一直不能运行,没办法只有重装了,重装后按我的用途重新配置了一下,现将配置过程记录下来以备将来不时之需 说明:配置是在windows系统上进行的,其 ...

  3. Win7上Git安装及配置过程

    Win7上Git安装及配置过程 文档名称 Win7上Git安装及配置过程 创建时间 2012/8/20 修改时间 2012/8/20 创建人 Baifx 简介(收获) 1.在win7上安装msysgi ...

  4. WCF分布式开发步步为赢(2)自定义托管宿主WCF解决方案开发配置过程详解

    上一节<WCF分布式框架基础概念>我们介绍了WCF服务的概念和通信框架模型,并给出了基于自定义托管服务的WCF程序的实现代码.考虑到WCF分布式开发项目中关于托管宿主服务配置和客户端添加引 ...

  5. 【转】android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创)

    原文网址:http://www.cnblogs.com/zdz8207/archive/2012/11/27/android-ndk-install.html android 最新 NDK r8 在w ...

  6. 记录jpcap在Ubuntu&Window下的配置过程

    众所周知,Java虽然在TCP/UDP传输方面给予了良好的定义,但是标准库java.net对于网络层以下的控制是无能为力的.Jpcap就是为了处理这一问题而出现的中间件.它调用底层的winpcap/l ...

  7. Struts2 拦截器具体配置过程

    拦截器差点儿遍布每个程序中,所以贴出拦截器配置的具体过程,希望可以帮到大家. Struts2 拦截器具体配置过程 <interceptors> <!-- 先定义拦截器 --> ...

  8. Hadoop的配置过程(虚拟机中的伪分布模式)

    1引言 hadoop如今已经成为大数据处理中不可缺少的关键技术,在如今大数据爆炸的时代,hadoop给我们处理海量数据提供了强有力的技术支撑.因此,了解hadoop的原理与应用方法是必要的技术知识. ...

  9. (4.1)Spring MVC执行原理和基于Java的配置过程

    一.Spring MVC执行原理和基于Java配置的配置过程 (一)Spring MVC执行过程,大致为7步. 所有的请求都会经过Spring的一个单例的DispacherServlet. Dispa ...

随机推荐

  1. 在jsp中如何使用javax.servlet.http.HttpServlet,javax.servlet.GenericServlet, javax.servlet.Servlet

  2. win7安装loadrunner 安装相关问题解决方案

    安装loadrunner缺少2.8 sp1组件解决方案 这是因为注册表缺少FullInstallVer和Version,归根到底是madc安装的的问题 以下是解决方法: 1.运行regedit,打开注 ...

  3. 微信小程序 遇到的问题(新)

    1.调用wx.chooseImage(),调用系统相册,此时相册中的动图被转化成静态图,上传后也是静态图. 2.刚进微信小程序,onShow在安卓机下会调用两遍,iPhone下正常

  4. ORM概念

    ORM概念: 指对象结构和数据库架构间的映射,对象和数据库架构有一定的映射关系,让程序员可以不必编写sql

  5. C++各种优化

    目录 1.快速结束程序 2.register 3.inline 4.位运算 5.少用或不用STL 6.快读快写 准备工作 超慢cin cout 输出 输入 神一般的快读快写 对比 7.小技巧 8.co ...

  6. Spring重要知识点整理

    一.IOC(Inversion of Control):控制反转 (1)Spring Core最核心部分 (2)需要先了解依赖注入(Denpendency Injection)/把底层类作为参数传递给 ...

  7. vue中几种常见技巧

    1.校验延迟:点击进入页面不希望校验必填字段this.$nextTick(() => { this.$refs.formRules.clearValidate() })2.$on $emit $ ...

  8. JAVA常用异常类

    算数异常类:   ArithmeticExecption 空指针异常类:    NullPointerException 指定类不存在:    ClassNotFoundException 字符串转换 ...

  9. egret贝塞尔曲线运动

    class MtwGame { public constructor() { } private static _instance: MtwGame; public static get Instan ...

  10. 使用spring:aop中修改增强方法中的参数

    大家都知道,在增强方法中,使用jp.getArgs()[index]可以获取传进来的参数,但是参数传进来之后,怎么改变它的值呢? 因为jp.getArgs()[index]获取到的只是数据的备份,所以 ...