ashawen

EBLearn在ubuntu下的编译和使用

最近在搞人脸识别,在http://deeplearning.net/demos/上找到了eblearn这个项目。

按照http://eblearn.cs.nyu.edu:21991/doku.php?id=install上的安装步骤,在我的ubuntu虚拟机上,make core是没有问题的,但在make tools时出现了两个问题,记录一下。

1. make detect时会报Filesystem里的string找不到问题(具体问题记不得了),貌似是因为boost库的版本太低了。换一个高一点的版本,比如boost 1.51,问题消除。如果不想更新boost版本,把报错文件里对string()的调用注释掉,也是可以的。

2. 在tools下make detect时报如下错误:

Linking CXX shared library /home/shaofeng/devel/eblearn_1.2_r2631/bin/libeblearntools.so
/usr/bin/ld: cannot find -lPTHREAD_LIBRARY-NOTFOUND/libpthread.so
collect2: ld returned 1 exit status
make[4]: *** [/home/shaofeng/devel/eblearn_1.2_r2631/bin/libeblearntools.so] Error 1
make[4]: Leaving directory `/home/shaofeng/devel/eblearn_1.2_r2631/tools/build/Release'
make[3]: *** [libeblearntools/CMakeFiles/eblearntools.dir/all] Error 2
make[3]: Leaving directory `/home/shaofeng/devel/eblearn_1.2_r2631/tools/build/Release'
make[2]: *** [tools/CMakeFiles/detect.dir/rule] Error 2
make[2]: Leaving directory `/home/shaofeng/devel/eblearn_1.2_r2631/tools/build/Release'
make[1]: *** [detect] Error 2
make[1]: Leaving directory `/home/shaofeng/devel/eblearn_1.2_r2631/tools/build/Release'
make: *** [detect] Error 2

看一下make过程,发现有如下信息:

-- pthread Found.
-- pthread include path: /usr/include
-- pthread library: PTHREAD_LIBRARY-NOTFOUND/libpthread.so
CMake Warning (dev) at scripts/FindAll.cmake:480 (link_directories):
This command specifies the relative path

PTHREAD_LIBRARY-NOTFOUND

as a link directory.

PTHREAD_LIBRARY-NOTFOUND,看来是找不到pthread库。

查看文件:scripts/FindAll.cmake,找到下面的内容:

# find pthread
################################################################################
if (APPLE OR LINUX)
set(PTHREAD_FOUND TRUE) # present by default on apple and linux
set(PTHREAD_INCLUDE_DIR "/usr/include")
if (APPLE)
set(PTHREAD_LIBRARY_DIR "/usr/lib/")
set(PTHREAD_LIBRARY "/usr/lib/libpthread.dylib")
else (APPLE) # LINUX
find_path(PTHREAD_LIBRARY "libpthread.so" paths
"/usr/lib/"
"/usr/lib64/"
"/lib/x86_64-linux-gnu/"
"/lib/i386-linux-gnu/"
"/usr/lib/x86_64-linux-gnu/")
set(PTHREAD_LIBRARY_DIR ${PTHREAD_LIBRARY})
set(PTHREAD_LIBRARY "${PTHREAD_LIBRARY}/libpthread.so")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif (APPLE)
else (APPLE OR LINUX) # installed manually under windows

endif (APPLE OR LINUX)

在我的ubuntu(32位)下,pthread位于/usr/lib/i386-linux-gnu/目录下,将该目录加到上述红字的位置,detect编译通过。

 编译好后,就可以试用detect了。但用命令:

./bin/detect demos/face/best_dir.conf ~/datasets/img

执行时,报如下错误:

arch 9: Error: cannot find table file declared in variable conv2_table: /home/shaofeng/eblpierre//tools/data/tables//table_6_16_connect_60.mat, in load_table at /home/shaofeng/code/eblearn_1.2_r2631/tools/libeblearntools/src/netconf.cpp:51
Stack:
/home/shaofeng/code/eblearn_1.2_r2631/bin/libeblearntools.so(_ZN3ebl10load_tableERNS_13configurationERKSsRNS_3idxIlEEll+0x7a2)[0xc29d42]
./bin/detect(_ZN3ebl13create_moduleIfEEPNS_10module_1_1IT_EERKSsRNS_9parameterIS2_EERNS_13configurationERiRlRSt3mapISsS4_St4lessISsESaISt4pairIS5_S4_EEESL_i+0x22a8)[0x819d488]
./bin/detect(_ZN3ebl14create_networkIfEEPNS_10module_1_1IT_EERNS_9parameterIS2_EERNS_13configurationERliPKciPSt3mapISsS4_St4lessISsESaISt4pairIKSsS4_EEESL_+0x391)[0x81a5a31]
./bin/detect(_ZN3ebl16detection_threadIfE7executeEv+0x1cb)[0x81a635b]
/home/shaofeng/code/eblearn_1.2_r2631/bin/libeblearntools.so(_ZN3ebl6thread3runEv+0xf)[0xc53a8f]
/home/shaofeng/code/eblearn_1.2_r2631/bin/libeblearntools.so(_ZN3ebl6thread10entrypointEPv+0x22)[0xc53ac2]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d4c)[0x6fcd4c]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e)[0x864d3e]
Aborted (core dumped)

看来是配置文件的问题,检查demos/face/best_dir.conf文件,发现有如下一行:

ebl= ${HOME}/eblpierre/ # eblearn root

将ebl设置为eblearn root的目录即可。

如在我机器上,eblearn root为:

/home/shaofeng/code/eblearn_1.2_r2631

这样就可以将改行修改为:

ebl=/home/shaofeng/code/eblearn_1.2_r2631

posted on 2013-03-26 16:38  shaofeng09999  阅读(2028)  评论(0)    收藏  举报