• redhat配置caffe


    参考网站:

    http://caffe.berkeleyvision.org/install_yum.html(bvlc官网说明)

    https://www.zybuluo.com/hanxiaoyang/note/364680

    http://blog.sina.com.cn/s/blog_990865340102vewt.html (主要参考)

    http://stackoverflow.com/questions/31395729/how-to-enable-multithreading-with-caffe

    (多核训练)

    redhat配置caffe

    1.安装依赖

    1. $ sudo yum install protobuf-devel   
    2. $ sudo yum install level-devel   
    3. $ sudo yum install snappy-devel   
    4. $ sudo yum install opencv-devel   
    5. $ sudo yum install boost-devel   
    6. $ sudo yum install hdf5-devel   
    7. $ sudo yum install atlas-devel   
    8.  
    9. $ sudo yum install gflags-devel   
    10. $ sudo yum install glog-devel   
    11. $ sudo yum install lmdb-devel   

    某些源可能找不到

    可以先安装以下命令

    1. $ sudo yum install epel-release

    其中glog仍然找不到,则需要进行手动安装

    1. # glog
    2. wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/google-glog/glog-0.3.3.tar.gz
    3. tar zxvf glog-0.3.3.tar.gz
    4. cd glog-0.3.3
    5. ./configure
    6. make && make install

    2.安装opecv-2.4.13

    redhat配置opencv

    3.编译配置boost_1_59_0

    1. Tar –zxvf boost_1_59_0.tar.gz
    2. cd boost boost_1_59_0
    3. ./boostrap.sh
    4. ./b2
    5. sudo ./b2 install –prefix=/usr/local/boost_hy

    配置参数

    /usr/local/include

    /usr/local/lib

    可以将配置文件写到

    1. echo "/usr/local/lib" >> /etc/ld.so.conf
    2. ldconfig

    3.下载源码

    1. $ cd caffe/
    2. $ mv Makefile.config.example Makefile.config

    4.修改Makefile.config

    CPU_ONLY := 1

     

    BLAS := atlas

    BLAS_INCLUDE := /usr/include/atlas

    BLAS_LIB := /usr/lib64/atlas

     

    BOOST_ROOT := /usr/local/boost_hy

     

    INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/boost_hy/include

    LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib64 /usr/local/boost_hy/lib

    5.编译

    1. make all

    问题1:

    ./include/caffe/util/io.hpp: In function 'void caffe::MakeTempDir(std::string_)':

    ./include/caffe/util/io.hpp:27: error: 'temp_directory_path' is not a member of 'boost::filesystem'

    ./include/caffe/util/io.hpp:29: error: 'unique_path' is not a member of 'boost::filesystem'

    应该是boost版本问题,要1.59.0以上的。但说明是1.54以上版本就行。

    明明装了1.59版本的boost还是不行。

    1. rpm –qa boost*

    发现许多包还是1.41版本的,可能是系统依赖的包。因此,重新安装boost,指定安装路径,如果不指定的话,lib会放在 /usr/local/lib, include会放在/usr/local/include

    1. ./b2 install –prefix=/usr/local/boost_hy

    Boost_hy下回出现includelib

    caffe目录下Makefile.config中添加如下配置:

    BOOST_BOOT:=/usr/local/boost_hy

    INCLUDE_DIRS:=/usr/local/boost_hy/include

    LIB_DIRS:=/usr/local/boost_hy/lib

    https://groups.google.com/forum/#!topic/caffe-users/h_hXnUbrurk

    https://github.com/BVLC/caffe/issues/3686

    问题2

    使用命令

    1. sudo make all

    时,出现以下问题:

    .build_release/src/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
    .build_release/src/caffe/proto/caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
    .build_release/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.

    /usr/bin/protoc –version发现是1.4.*版本的。而至少需要1.5版本的。

    如果不用sudo的话,可能用到的是本目录下的protoc

    1. make all //不要用sudo执行

    问题3

    /usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

    /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

    /usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for –lc

    This typically arises due to an architecture mismatch - in this case it seems that the build system attempts to link a 64bit object files with a 32bit library

    问题是64为系统编译,却到32位的lib包中去寻找,解决:

    更改caffe目录下Makelist.config

    将所有的/usr/lib都改为/usr/lib64

    1. make clean
    2. make all

    终于编译成功,截图如下:

     

    6. 训练mnist

    问题:

    [wuhairong@zhsw-ws02 caffe-master]$ make runtest .build_release/tools/caffe ERROR: flag 'tab_completion_word' was defined more than once (in files 'src/gflags_completions.cc' and '/home/wuhairong/gflags-master/src/gflags_completions.cc').make: *** [runtest] 错误 1

    https://groups.google.com/forum/#!msg/caffe-users/bqDam0xuT3E/78wQnx3memAJ

    gflags安装了两次,要将gflags文件卸载之后再安装。利用yum命令即可。

    1. sudo yum remove gflags
    2. sudo yum install gflags

    然后重新编译caffe

    1. make clean
    2. make all
    3. make test
    4. make runtest
    5. make matcaffe
    6. make pycaffe

    开始训练

    caffe目录下执行

    1. sh data/get_mnist.sh
    2. sh examples/mnist/create_mnist.h

    注意:如果出现错误,可能是因为数据下载不正确。

    1. sh examples/mnist/train_lenet.sh

    静候结果。。。

    多核训练

    http://stackoverflow.com/questions/31395729/how-to-enable-multithreading-with-caffe

  • 相关阅读:
    CVPR2020:三维实例分割与目标检测
    CVPR2020:视觉导航的神经拓扑SLAM
    使用现代C++如何避免bugs(下)
    使用现代C++如何避免bugs(上)
    蓝牙mesh网络技术的亮点
    电路功能和优点
    ARM的突破:超级计算机和Mac
    所有处理都走向AI
    Wide-Bandgap宽禁带(WBG)器件(如GaN和SiC)市场将何去何从?
    功率半导体碳化硅(SiC)技术
  • 原文地址:https://www.cnblogs.com/yizhichun/p/6339695.html
Copyright © 2020-2023  润新知