Ubuntu 利用Anaconda3安装detectron (无root权限)

安装detectron需要安装Caffe2

caffe2安装步骤:

可参考:

点击打开链接

caffe2官方链接

caffe2 build from source

打开上述链接

两种方式供你选择:

1.  Pre-Built Binaries

创建名为caffe2_py2conda虚拟环境并激活,以避免与Tensorflow和老版Caffe的干扰(DetectronPython3.x兼容性不佳,注意Python版本):

conda create -n caffe2_py2 python=2.7 && source activate caffe2_py2


此福利仅供cudnn7用户享用

安装CPU:

conda install -c caffe2 caffe2

安装GPU:

1.  CUDA 9 and CuDNN 7 support:

conda install -c caffe2 caffe2-cuda9.0-cudnn7

2.  CUDA 8 and CuDNN 7 support:

conda install -c caffe2 caffe2-cuda8.0-cudnn7

2. Build From Source

install Denpendencies

sudo apt-get update
sudo apt-get install -y --no-install-recommends \
      build-essential \
      cmake \
      git \
      libgoogle-glog-dev \
      libgtest-dev \
      libiomp-dev \
      libleveldb-dev \
      liblmdb-dev \
      libopencv-dev \
      libopenmpi-dev \
      libsnappy-dev \
      libprotobuf-dev \
      openmpi-bin \
      openmpi-doc \
      protobuf-compiler \
      python-dev \
      python-pip                          
sudo pip install \
      future \
      numpy \
      protobuf
# for Ubuntu 14.04
sudo apt-get install -y --no-install-recommends libgflags2
# for Ubuntu 16.04
sudo apt-get install -y --no-install-recommends libgflags-dev

Clone & Build

2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Clone Caffe2's source code from our Github repository
git clone --recursive https://github.com/pytorch/pytorch.git && cd pytorch
git submodule update --init

# Create a directory to put Caffe2's build files in
mkdir build && cd build

# Configure Caffe2's build
# This looks for packages on your machine and figures out which functionality
# to include in the Caffe2 installation. The output of this command is very
# useful in debugging.
cmake ..

# Compile, link, and install Caffe2
sudo make install

选择上述中的一种方式进行安装caffe2

安装完成之后,进行Test

Test the Caffe2 Installation

CPU:

cd ~ && python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"

如果输出Success安装成功


GPU:

python caffe2/python/operator_test/relu_op_test.py

输出OK安装成功



安装Detectron

参考链接: detectron

Other Dependencies

Install Python dependencies:

conda install -y pyyaml=3.12 matplotlib setuptools Cython mock scipy

Installthe COCOAPI:

# COCOAPI=/path/to/clone/cocoapigit clone https://github.com/cocodataset/cocoapi.git $COCOAPIcd $COCOAPI/PythonAPI# Install into global site-packagesmake install# Alternatively, if you do not have permissions or prefer# not to install the COCO API into global site-packagespython2 setup.py install --user

Note that instructions like #COCOAPI=/path/to/install/cocoapi indicatethat you should pick a path where you'd like to have the softwarecloned and then set an environment variable (COCOAPI inthis case) accordingly.

Detectron

Clone the Detectron repository:

# DETECTRON=/path/to/clone/detectrongit clone https://github.com/facebookresearch/detectron $DETECTRON

Install Python dependencies:

pip install -r $DETECTRON/requirements.txt

Set up Python modules:

cd $DETECTRON && make

Check that Detectron tests pass (e.g. for SpatialNarrowAsOp test):

python2 $DETECTRON/detectron/tests/test_spatial_narrow_as_op.py

输出OK说明安装成功


存在一个error:

需要安装pydot包 conda install -y pydot

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值