VON复现

[NeurIPS 2018] Visual Object Networks: Image Generation with Disentangled 3D Representation
项目链接:http://von.csail.mit.edu
github:https://github.com/junyanz/VON

根据readme中进行操作

复制到本地

git clone -b master --single-branch https://github.com/junyanz/VON.git
cd VON

只获取master分支并移动到VON文件夹,若网络连接有问题可在github上下载

安装环境

conda create --name von --file pkg_specs.txt
source activate von

这里在anaconda中创建一个新环境叫von,指定安装pkg_specs.txt中包
由于下载连接都是anaconda库的,所有有的下载可能慢且失败
可将连接中的conda.anaconda.org换为清华mirrors.tuna.tsinghua.edu.cn/anaconda/cloud然后激活进入环境

编译文件

Compile our rendering kernel by running the following:
bash install.sh
我在这里遇到了很多问题
首先是权限,可先用chmod -R 777 VON改变
然后是nvcc命令失败
首先应检查使用cuda环境中,/usr/local/cuda/bin,有没有nvcc,若没有则需要重新卸载安装cuda具体操作可见我的另一篇博客:https://blog.csdn.net/qq_35446336/article/details/104612580
然后就成功了
注意:If you need to recompile the kernel, please run bash clean.sh first before you recompile it.
作者还提供了docker的方式,暂未实验

预训练模型

下载

bash ./scripts/download_model.sh

下载失败,打开文件发现是这样的命令

set -ex
wget http://von.csail.mit.edu/final_models/final_models.tar
tar -xvf final_models.tar

-e 脚本中的命令一旦运行失败就终止脚本的执行
-x 用于显示出命令与其执行结果(默认shell脚本中只显示执行结果)

wget失败,然后浏览器下载也很慢。。。

运行

终于下好了,解压然后跑模型

bash ./scripts/figures.sh 0 car df

果然。。。

ModuleNotFoundError: No module named 'vtn'

这是因为之前编译的文件是用的虚拟环境外的cuda9.2编译的,而环境中是原作者cuda8.0的pytorch,也就是编译和运行时pytorch版本不一致,所以将之前环境安装包中与cuda8.0和pytorch相关的包去除

https://conda.anaconda.org/pytorch/linux-64/cuda80-1.0-h205658b_0.tar.bz2
https://repo.continuum.io/pkgs/free/linux-64/cudatoolkit-8.0-3.tar.bz2
https://conda.anaconda.org/pytorch/linux-64/torchvision-0.2.1-py37_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/torchfile-0.1.0-py_0.tar.bz2
https://conda.anaconda.org/pytorch/linux-64/pytorch-0.4.1-py37_cuda8.0.61_cudnn7.1.2_1.tar.bz2

重新创建环境后,先安装cuda:conda install cudatoolkit=9.2 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
这一步也自动安装了torchfile,但是和之前似乎一样

再安装pytorch:conda install pytorch=0.4.1 cuda92
注意添加清华pytorch源
这一步也自动安装了cuda92

最后自动匹配安装conda install torchvision即可

最后一个问题

error in BilinearSampler3D update output: no kernel image is available for execution on the device
设置arch和code与电脑的显卡匹配,就可以解决
我是2080ti,参考https://blog.csdn.net/qq_30024069/article/details/91125900,在之前编译的文件中更新了arch,code的设置,然后重新编译,再运行,最终成功!在./results///index.html中查看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值