SeetaFaceEngine教程For Mac OS X(3)--FaceIdentification编译

重点的事说三遍:

遇到段错误segmentation fault:11、XXX not found之类的报错,(1)检查路径(2)重启。

遇到段错误segmentation fault:11、XXX not found之类的报错,(1)检查路径(2)重启。

遇到段错误segmentation fault:11、XXX not found之类的报错,(1)检查路径(2)重启。

编译FaceIdentification

(1)进入到FaceIdentification文件目录下

mkdir build建立build文件夹

(2)将FaceDetection/include/face_detection.h和FaceAlignment/include/face_alignment.h拷贝到FaceIdentification/include中

(3)将FaceDetection/model/seeta_fd_frontal_v1.0.bin和FaceAlignment/model/seeta_fa_v1.1.bin拷贝到FaceIdentification/build中;将FaceDetection/build/libseeta_facesdet_lib.dylib和FaceAlignment/build/libseeta_fa_lib.dylib拷贝到FaceIdentification/build中


(4)解压缩FaceIdentification/model中的文件


(5)修改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(REGEXREPLACE "[.]cpp" ".bin" BIN ${f})

add_executable(${BIN}${f})

#target_link_libraries(${BIN} viplnet ${OpenCV_LIBS} seeta_facede_libseeta_fa_lib)

target_link_libraries(${BIN} viplnet ${seeta_fi_lib_required_libs})

endforeach ()

修改后结果如图:


(6)修改FaceIdentification/src/test/test_face_recognizer.cpp和test_face_verification.cpp文件,添加如下内容头文件:

#include <opencv2/opencv.hpp>

#include<opencv2/highgui/highgui.hpp>

#include<opencv2/imgproc/imgproc.hpp>



(7)按照自己的保存路径,修改两个文件/model和/data的路径。


(8)编译

cmake ..

make

(9)运行

./build/src/test/test_face_recognizer.bin #3个单元测试函数


./build/src/test/test_face_verification.bin #比较两个图像相似度


测的是/Users/SEU-Li/SeetaFaceEngine/FaceIdentification/data/test_face_recognizer/images/compare_im文件中两幅图片的相似度

推荐阅读更多精彩内容