Ubuntu16.04下SeetaFace配置

本文详细介绍了SeetaFace人脸识别引擎的搭建过程,包括FaceDetection、FaceAlignment和FaceIdentification三个模块的编译与测试。从环境配置到具体步骤,为开发者提供了全面的指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SeetaFace简介

seetaface是中科院计算所山世光老师组的开源人脸识别项目
https://github.com/seetaface/SeetaFaceEngine

配置要求

CMake版本需超过3.1,本教程使用3.13.2
需配置过opencv
本教程ubuntu版本:16.04

参考教程

https://blog.youkuaiyun.com/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 #比较两个图像相似度

即可输出相似度分数
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值