ubuntu 18.04 caffe build

环境
* ubuntu 18.04
* cuda 9.1
* cudnn 7.1
* g++-4.8

caffe

  • 下载源码

    git clone https://github.com/BVLC/caffe.git
    
  • 安装依赖

    sudo apt-get install libatlas-base-dev  ibsnappy-dev libopencv-dev
    
    • 源码安装glog gflags lmdb libleveldb protocbuf2.6.1
    # glog 
    wget https://github.com/google/glog/archive/v0.3.3.tar.gz 
    tar zxvf v0.3.3.tar.gz cd glog-0.3.3 
    ./configure make && make install 
    
    # gflags 
    wget https://github.com/schuhschuh/gflags/archive/master.zip 
    unzip master.zip cd gflags-master 
    mkdir build && cd build 
    export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 
    make && make install 
    
    # lmdb 
    git clone https://github.com/LMDB/lmdb
    cd lmdb/libraries/liblmdb
    make && make install
    
    # libleveldb
    wget https://github.com/google/leveldb/archive/v1.19.tar.gz
    tar -xzf v1-1.19.tar.gz
    cd leveldb-1.19
    make
    sudo mv out-static/libleveldb.* /usr/local/lib
    sudo mv out-share/libleveldb.* /usr/local/lib
    cd include
    sudo cp -R leveldb /usr/local/include
    sudo ldconfig
    
    #protocbuf
    tar -zxpvf protobuf-2.6.1.tar.gz;
    cd protobuf-2.6.1;
    ./configure && make && make install
    

*python

```
#$(caffe)/python
for req in $(cat requirements.txt); do pip install $req; done
```
  • 编译

    cp Makefile.config.example Makefile.config
    # Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
    make all
    make test
    make runtest
    
  • 环境变量

    sudo vim  ~/.bashrc
    #添加一行
    export PYTHONPATH=/caffe所在的目录/python:$PYTHONPATH
    sudo source ~/.bashrc
    
    

faceboxes caffe

  • 编译boost

    ./bootstrap.sh --with-python=python2
    ./b2
    sudo ./b2 install
    
  • 编译caffe

        make -j8            
        # Make sure to include $CAFFE_ROOT/python to your PYTHONPATH. 
        make pycaffe        
        make test -j8       
        # (Optional)        
        make runtest -j8  
    

bug

## 问题
ImportError: /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Get_Var_Blend_Coordinates

## [解决](https://groups.google.com/forum/?nomobile=true#!topic/diffpy-users/86kXDfpOyoM)
conda install harfbuzz


## 问题
ImportError: /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined symbol: hb_font_funcs_set_variation_glyph_func
## [解决](https://stackoverflow.com/questions/40009184/error-importing-cv2-in-python3-anaconda)
conda install -c asmeurer pango


## 问题
ImportError: /usr/lib/x86_64-linux-gnu/librsvg-2.so.2: undefined symbol: pango_fc_font_map_set_config
## 解决
conda install pango
makefile(网盘)

####参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值