how to install Matlab API in caffe

    In caffe, sometimes, it is convinient to use matlab function to do calculation, like SVD deconposition. But install Matlab API is very annoying.

    1, edit Makefile.configure----MATLAB_DIR

    In my conputer: MATLAB_DIR := /usr/local/MATLAB/R2013b/

    2, compiler matlab API

    make matcaffe

    3, test whether Matlab API can work well

    make mattest

    In this step, many problem will arise. since in my computer, Matlab version is 2013b which only support gcc-4.7.x, but my os is fedora with gcc-5.1 inside. When I run make mattest, the first problem also arise frequently on internet:

    ibstdc++.so.6: version `GLIBCXX_3.4.21'.

    Then I do following the internet:

  export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
    But another problem arised when I run program:

    /home/niuyue/cnn_project/caffe-master/matlab/+caffe/private/caffe_.mexa64: undefined symbol:
    _ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE
 

    I search in the internet for long time, but nothing useful got until I find these:

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

    https://github.com/kyamagu/mexopencv/issues/64

    https://github.com/kyamagu/mexopencv/issues/62#issuecomment-15054244

    http://blog.csdn.net/lien0906/article/details/46816243

    I find the problem is not only libstdc++, and we also need to replace other libs in Matlab.

    export LD_PRELOAD=/usr/lib64/libopencv_highgui.so.2.4:/usr/lib64/libopencv_imgproc.so.2.4:/usr/lib64/libopencv_core.so.2.4:/usr/lib64/libstdc++.so.6:/usr/lib64

    /libfreetype.so.6 matlab

    export LD_LIBRARY_PATH=/usr/lib64/


    Finally, the problem is solved, and I can call caffe function in Matlab.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值