votenet网络运行时pointnet++编译出错的解决方案

源码是:https://github.com/facebookresearch/votenet
参考解决方案:https://github.com/facebookresearch/votenet/issues/108

votenet的网络跑起来真的是头大,数据集的准备就异常复杂繁琐,网路跑起来也更是麻烦。在代码的readme中提到要预先编译pointnet++:

cd pointnet2
python setup.py install

编译时可能会提示AT_CHECK错误,按照之前参考解决方案给出的方法,解决方法如下:
1.把pointnet2/_ext_src/src 和 pointnet2/_ext_src/include所有的文件中的AT_CHECK替换成TORCH_CHECK(由于pytorch的API改变了)
2.把pointnet2/setup.py代码改变成如下:

# Copyright (c) Facebook, Inc. and its affiliates.
# 
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import glob
import os

_ext_src_root = "_ext_src"
_ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob(
    "{}/src/*.cu".format(_ext_src_root)
)
_ext_headers = glob.glob("{}/include/*".format(_ext_src_root))

headers = "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), '_ext_src', 'include')

setup(
    name='pointnet2',
    ext_modules=[
        CUDAExtension(
            name='pointnet2._ext',
            sources=_ext_sources,
            extra_compile_args={
                "cxx": ["-O2", headers],
                "nvcc": ["-O2", headers]
            },
        )
    ],
    cmdclass={
        'build_ext': BuildExtension
    }
)

具体大家还是参考https://github.com/facebookresearch/votenet/issues/108
也希望大家之后调bug时可以把github搬运过来,方便更多人查看(翻这个issue有时候网不好还不一定翻得到)。

你可能感兴趣的:(深度学习,python,pytorch,机器学习,深度学习)