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代碼中文件的路徑或改成傳參的形式,或者將所需的文件硬鏈接到正確的文件夾。