一.安装OpenCV 依赖
1.Require Packages
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
2.Get OpenCV Source Code
http://opencv.org/downloads.html
3.Building OpenCV from Source code Using Cmake & Command Line
cd ~/opencv #移动到源文件文件夹中
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
#在上面步骤结束之后进行make
make
sudo make install #该命令行必须
4.Test OpenCV
cd opencv_samples
./build_all_sh
.facedetect Pathofimage
二.安装SeetaFace Detection
build on linux
mkdir build #在FaceDetection目录中
cd build
cmake ..
make -j${npoc}
可能出现/usr/bin/ld: cannot find -lopencv_dep_cudart
解决方法,在执行cmake的时候加入下面的参数CUDA_USE_STATIC_CUDA_RUNTIME=OFF,例如cmake -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
run demo
./build/facedet_test imagefilePath ./model/seeta_fd_frontal_V1.0.bin
error: ‘isnan’ was not declared in this scope
解决方法,修改文件中的isnan为“std::isnan”
三.安装SeetaFace Alignment
Build in Linux
mkdir build #在FaceAlignment目录中
然后将FaceDetection中的/include/face_detection.h和/build/libseeta_facedet_lib.so 拷贝到/FaceAlignment/build文件夹下,为了生成test example
cd build
cmake ..
make
如果一切正常,可以用测试程序来测试一下,先要拷贝/FaceDetection/model文件夹下的seeta_fd_frontal_v1.0.bin文件到FaceAlignment的build中
./fa_test
用到测试程序的时候可能出现以下问题
iofread.c没有这个目录或文件
该问题在于生成fa_test中的face_alignment_test.cpp文件中的路径有些问题比如/data和/model文件夹,还有需要用到的图片路径
四.安装SeetaFace Indentification
build on linux
mkdir build
cd build
cmake .. && make
注意以下问题:
1.未定义引用对于之前生成的FaceDetection和FaceAlignment库中定义的函数。
对于前面FaceDetection和FaceAlignment build生成的两个库的libseeta_facedet_lib,libseeta_fa_lib添加到FaceIdentification/build文件夹中。
然后修改src/test/CMakeLists.txt文件,在Cmakelists文件中添加查找的链接库link_directories(${PROJECT_BINARY_DIR})(也就是在当前build文件夹下查找,该命令最好添加循环函数外边)
在循环中补全target_link_libraries(XXXXX seeta_facedet_lib seeta_fa_lib)
#`src/test/CMakeLists.txt`修改之后如下
aux_source_directory (. SRC_LIST)
message(${SRC_LIST})
link_directories(${PROJECT_BINARY_DIR}) #添加lib
# add external libraries
find_package(OpenCV REQUIRED)
enable_testing ()
foreach (f ${SRC_LIST})
string(REGEX REPLACE "[.]cpp" ".bin" BIN ${f})
add_executable(${BIN} ${f})
target_link_libraries(${BIN} viplnet ${OpenCV_LIBS} seeta_facedet_lib seeta_fa_lib) #添加lib
endforeach ()
2.model/seeta_fr_v1.0.bin not found :解决解压缩model中的两个文件
3.face_alignment.h, face_detection.h: No such file or directory,出现这个的原因是sample在编译是需要用到这些头文件。解决方法,将SeetaFaceEngine/FaceDetection/include/face_detection.h和SeetaFaceEngine/FaceAlignment/include/face_alignment.h拷贝到SeetaFaceEngine/FaceIdentification/include/文件夹中
4.分别修改test_face_recognizer.cpp和test_face_verification.cpp中data和model的相对路径,还要修改test_face_verification.cpp文件中查找之前编译过得模块的路径
Run demo
./build/src/test/test_face_recognizer.bin
./build/src/test/test_face_verification.bin #比较两个文件相似度
参考Installation in Linux: