SeetaFace简介
seetaface是中科院计算所山世光老师组的开源人脸识别项目
https://github.com/seetaface/SeetaFaceEngine
配置要求
CMake版本需超过3.1,本教程使用3.13.2
需配置过opencv
本教程ubuntu版本:16.04
参考教程
https://blog.csdn.net/u012235003/article/details/54576923
步骤
1. 编译FaceDetection
mkdir build #在FaceDetection目录中
cd build
cmake ..
make -j${npoc}
cd ..
配置完成后测试,注意imagefilePath需要自己修改成具体位置
./build/facedet_test imagefilePath ./model/seeta_fd_frontal_V1.0.bin #imagefilePath是640*480图片的路径
2. 编译FaceAlignment
mkdir build #在FaceAlignment目录中
将FaceDetection中的/include/face_detection.h和/build/libseeta_facedet_lib.so 两个文件
拷贝到/FaceAlignment/build文件夹下
然后在FaceAlignment>src>test中face_alignment_test.cpp中进行下列修改
int main(int argc, char** argv)
{
// Initialize face detection model
seeta::FaceDetection detector("./build/seeta_fd_frontal_v1.0.bin"); //修改路径
//修改成这个路径,把seeta_fd_frontal_v1.0.bin放到build中,原版是基于windows
detector.SetMinFaceSize(40);
detector.SetScoreThresh(2.f);
detector.SetImagePyramidScaleFactor(0.8f);
detector.SetWindowStep(4, 4);
回到FaceAlignment文件夹下
cd build #进入到刚才创建的build文件夹
cmake ..
make
拷贝/FaceDetection/build文件夹下的seeta_fd_frontal_v1.0.bin文件到FaceAlignment的build中
cd .. #回到FaceAlignment文件夹下
./build/fa_test #运行人脸关键点检测
3. 编译FaceIdentification
mkdir build #在FaceIdentification目录中
将以下四个文件添加到FaceIndentification/build中
- libseeta_facedet_lib.so(/FaceDetection/build)
- seeta_fd_frontal_v1.0.bin(/FaceDetection/model)
- libseeta_fa_lib.so(FaceAlignment/build)
- seeta_fa_v1.1.bin(FaceAlignment/model)
将以下两个文件添加到FaceIndentification/include中
- face_alignment.h(FaceAlignment/include)
- face_detection.h(/FaceDetection/include)
打开FaceIdentification/src/test/CMakeLists.txt将文件替换成如下内容
aux_source_directory (. SRC_LIST)
link_directories(${PROJECT_BINARY_DIR})
message(${SRC_LIST})
# add external libraries
find_package(OpenCV REQUIRED)
include_directories(${seeta_facedet_lib_INCLUDE_DIRS} ${seeta_fa_lib_INCLUDE_DIRS})
list(APPEND seeta_fi_lib_required_libs ${OpenCV_LIBS} seeta_facedet_lib seeta_fa_lib)
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_facede_lib seeta_fa_lib)
target_link_libraries(${BIN} viplnet ${seeta_fi_lib_required_libs})
endforeach ()
在 FaceIdentification/src/test/test_face_recognizer.cpp文件中添加如下内容头文件
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
在 FaceIdentification/src/test/test_face_verification.cpp文件中添加如下内容头文件
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
解压 FaceIdentification/model/seeta_fr_v1.0.part1.rar
!这里注意要改一下FaceIdentification/src/test/test_face_verification.cpp
不然回头会报Segmentation fault
进入FaceIdentification\build文件夹下进行编译
cmake ..
make
回到FaceIdentification文件夹中进行测试
./build/src/test/test_face_recognizer.bin #3个单元测试函数
./build/src/test/test_face_verification.bin #比较两个图像相似度
即可输出相似度分数