1. 程式人生 > >linux下安裝warpctc,mxnet和python介面配置

linux下安裝warpctc,mxnet和python介面配置

nstall baidu warpctc

Build the MXNet core shared library

Step 1 Install build tools and Git.

$ sudo apt-get update
$ sudo apt-get install -y build-essential git

Step 2 Install OpenBLAS.

MXNet uses BLAS library for accelerated numerical computations. There are several flavors of BLAS libraries -OpenBLAS

,ATLAS and MKL. In this step we install OpenBLAS. You can choose to install ATLAS or MKL.

$ sudo apt-get install -y libopenblas-dev

Step 3 Install OpenCV.

MXNet uses OpenCV for efficient image loading and augmentation operations.

$ sudo apt-get install -y libopencv-dev

Step 4 Download MXNet sources and build MXNet core shared library.

$ git clone --recursive https://github.com/dmlc/mxnet
$ cd mxnet
$ make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1

Note - USE_OPENCV, USE_BLAS, USE_CUDA, USE_CUDA_PATH AND USE_CUDNN are make file flags to set compilation options to use opencv, OpenBLAS, CUDA and cuDNN libraries. You can explore and use more compilation options inmake/config.mk

. Make sure to set USE_CUDA_PATH to right CUDA installation path. In most cases it is -/usr/local/cuda.

Build the MXNet Python binding

Step 1 Install prerequisites - python setup tools and numpy.

$ sudo apt-get install -y python-dev python-setuptools python-numpy

Step 2 Build the MXNet Python binding.

$ cd python
$ sudo python setup.py install


cd ~/ git clone https://github.com/baidu-research/warp-ctc cd warp-ctc mkdir build cd build cmake .. make sudo make install

Enable warpctc in mxnet

  comment out following lines in make/config.mk
  WARPCTC_PATH = $(HOME)/warp-ctc
  MXNET_PLUGINS += plugin/warpctc/warpctc.mk
  
  rebuild mxnet by
  make clean && 
make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1