2019-12-28 maskrcnn-benchmark入坑指南

maskrcnn-benchmark入坑指南

https://github.com/facebookresearch/maskrcnn-benchmark

1.环境安装

指定python3.7的版本

conda create --name maskrcnn_benchmark python==3.7

conda remove -n maskrcnn_benchmark --all

https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/INSTALL.md

2.

python3.7

cuda9.0

export PATH=$PATH:/usr/local/cuda-9.0/bin

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64

conda create --name maskrcnn_benchmark -y

conda activate maskrcnn_benchmark

# this installs the right pip and dependencies for the fresh python

conda install ipython pip

# maskrcnn_benchmark and coco api dependencies

pip install ninja yacs cython matplotlib tqdm opencv-python

# follow PyTorch installation in https://pytorch.org/get-started/locally/

# we give the instructions for CUDA 9.0

conda install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0

export INSTALL_DIR=$PWD

# install pycocotools

cd $INSTALL_DIR

git clone https://github.com/cocodataset/cocoapi.git

cd cocoapi/PythonAPI

python setup.py build_ext install

# install cityscapesScripts

cd $INSTALL_DIR

git clone https://github.com/mcordts/cityscapesScripts.git

cd cityscapesScripts/

python setup.py build_ext install

# install apex

cd $INSTALL_DIR

git clone https://github.com/NVIDIA/apex.git

cd apex

python setup.py install --cuda_ext --cpp_ext

# install PyTorch Detection

cd $INSTALL_DIR

git clone https://github.com/facebookresearch/maskrcnn-benchmark.git

cd maskrcnn-benchmark

python setup.py build develop

unset INSTALL_DIR

3.

编译问题

_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c106Device8validateEv

原因的是maskrcnn-benchmark没有编译好

nvcc查看自己的路径

which nvcc

/usr/bin/nvcc 这不是cuda9.0的nvcc所以报错

解决办法

export PATH=/usr/local/cuda-9.0/bin:$PATH

cd /home/v-zhiwwa/HOI/maskrcnn/maskrcnn-benchmark && python setup.py build develop

4. 检测一张图片

export PATH=/usr/local/cuda-9.0/bin:$PATH

export PYTHON=$PYTHON:/home/v-zhiwwa/HOI/maskrcnn/maskrcnn-benchmark/build/lib.linux-x86_64-3.7

cd /home/v-zhiwwa/HOI/maskrcnn/maskrcnn-benchmark/demo && python wzw.py

5.检测结果

图片的目标有bbox和分割的边界

你可能感兴趣的:(2019-12-28 maskrcnn-benchmark入坑指南)