安装Detectron
1)前提条件:
a) NVIDIA GPU, Linux, Python2
b) Caffe2, various standard Python packages, and the COCO API
2)检查caffe2是否安装
#交互Success,则为正常
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
#返回可用GPU的个数,则为正常
python -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())'
若此步骤返回Failure或GPU个数小于1,则回到博客 中分析出错原因。
3)安装COCO API
# COCOAPI=你想把COCO克隆到本地的路径/cocoapi
git clone https://github.com/cocodataset/cocoapi.git $COCOAPI
cd $COCOAPI/PythonAPI
# Install into global site-packages
make install
# Alternatively, if you do not have permissions or prefer
# not to install the COCO API into global site-packages
python setup.py install --user
COCOAPI=你想把COCO克隆到本地的路径/cocoapi,在ubuntu终端中输入并赋值。
4)安装Detectron
a) 下载一个Detectron项目:
`# DETECTRON=/path/to/clone/detectron
git clone https://github.com/facebookresearch/detectron $DETECTRON
b) 安装你所下载的detectron目录中的requirements.txt
pip install -r $DETECTRON/requirements.txt
c) make
cd $DETECTRON && make
5) 查看是否Detectron安装成功
python $DETECTRON/detectron/tests/test_spatial_narrow_as_op.py
若交互以下内容,则表示detectron安装成功。