SeetaFace简介
seetaface是中科院计算所山世光老师组的开源人脸识别项目
https://github.com/seetaface/SeetaFaceEngine
配置要求
Cmake:超过3.1版本
opencv:3.14.15
ubuntu:20.04
参考教程:
https://blog.youkuaiyun.com/square_zou/article/details/85855499
搭建步骤:
在分别编译三个模块的时候要先进入对应模块文件夹中
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>src>test中cfan.cpp中添加
using std::isnan;
在/home/lf/SeetaFaceEngine-master/FaceAlignment/src/test/face_alignment_test.cpp中进行修改
修改原因:版本问题不匹配(16.04不需要修改)
109 // Visualize the results
110 //cvRectangle(img_color, cvPoint(faces[0].bbox.x, faces[0].bbox.y), cvPoint(faces[0].bbox.x + faces[0].bbox.width - 1, faces[0].bbox.y + faces[0].bbox.height - 1), CV_RGB(255, 0, 0));
111 cv::Point(faces[0].bbox.x + faces[0].bbox.width - 1, faces[0].bbox.y + faces[0].bbox.height - 1), cv::Scalar(255, 0, 0);
112
113 for (int i = 0; i<pts_num; i++)
114 {
115 //cvCircle(img_color, cvPoint(points[i].x, points[i].y), 2, CV_RGB(0, 255, 0), CV_FILLED);
116 cv::Mat img_mat = cv::cvarrToMat(img_color);
117 cv::circle(img_mat, cv::Point(points[i].x, points[i].y), 2, cv::Scalar(0, 255, 0), cv::FILLED);
118
119 }
120 cvSaveImage("result.jpg", img_color);
回到FaceAlignment文件夹下
cd build #进入到刚才创建的build文件夹
cmake ..
make
拷贝/FaceDetection/build文件夹下的seeta_fd_frontal_v1.0.bin文件到FaceAlignment的build中
cd .. #回到FaceAlignment文件夹下
./build/fa_test #运行人脸关键点检测
结果不会显示,在当前目录会有一个result.jpg
3、编译FaceIdentification
mkdir build
将以下四个文件添加到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
unrar x seeta_fr_v1.0.part1.rar
修改FaceIdentification/src/test/test_face_verification.cpp
需要将.bin文件的路径修改下,否则会报段错误
int main(int argc, char** argv)
{
// Initialize face detection model
//seeta::FaceDetection detector("../../../FaceDetection/model/seeta_fd_frontal_v1.0.bin");
seeta::FaceDetection detector("./build/seeta_fd_frontal_v1.0.bin");
detector.SetMinFaceSize(40);
detector.SetScoreThresh(2.f);
detector.SetImagePyramidScaleFactor(0.8f);
detector.SetWindowStep(4, 4);
进入FaceIdentification\build文件夹下进行编译
cmake ..
make
回到FaceIdentification文件夹中进行测试
./build/src/test/test_face_recognizer.bin #3个单元测试函数
./build/src/test/test_face_verification.bin #比较两个图像相似度
2799

被折叠的 条评论
为什么被折叠?



