人脸识别引擎SeetaFace编译 ubuntu
00.SeetaFace简介
SeetaFace Engine is an open source C++ face recognition engine, which can run on CPU with no third-party dependence. It contains three key parts, i.e., SeetaFace Detection, SeetaFace Alignment and SeetaFace Identification, which are necessary and sufficient for building a real-world face recognition applicaiton system.
01.下载SeetaFace
git clone https://github.com/seetaface/SeetaFaceEngine.git
02.安装依赖
安装opencv2
源码编译安装或者sudo apt-get install libopencv-dev
03.工具
构建工具CMake 3.1.0 or higher is required.
而ubuntu官方源版本太低
sudo add-apt-repository ppa:george-edison55/cmake-3.x
sudo apt-get update
sudo apt-get install cmake
(可选)解压工具
sudo apt-get install unrar
04.编译
cd FaceDetection;mkdir build;cd build;
cmake ..; make -j${npoc}
同样方式编译FaceAlignment与FaceIdentification
编译FaceAlignment时报错:
缺face_detection.h,无法连接seeta_facedet_lib
解决:从FaceDetection中拷贝
编译FaceIdentification时报错:
1.缺失face_detection.h与face_alignment.h
将FaceDetection与FaceAlignment include文件夹下的对应文件硬链接(或拷贝,不要用软链接可能找不到)到FaceIdentification include
2.test_face_verification.cpp.o对许多函数未定义的引用
修改src/test/CMakeLists.txt
文件,增加编译时对于前面两个库的引用
将之前生成的libseeta_facedet_lib,libseeta_fa_lib硬链接build文件夹中,然后在CMakeLists.txt文件中添加下面一行,表明在build文件夹下查找链接库
link_directories(${PROJECT_BINARY_DIR})
在循环中的语句target_link_libraries(${BIN} viplnet ${OpenCV_LIBS})中添加两个库:
target_link_libraries(${BIN} viplnet ${OpenCV_LIBS} seeta_facedet_lib seeta_fa_lib)
3.model/seeta_fr_v1.0.bin not found :解压缩model中的两个文件
unrar x seeta_fr_v1.0.part1.rar #合并压缩只需指定第一部分
05.测试
test程序(facedet_test、fa_test、src/test/test_face_recognizer.bin、src/test/test_face_verification.bin)
运行时段错误,修改test代码中文件的路径或改成传参的形式,或者将所需的文件硬链接到正确的文件夹。