SeetaFace2 Android platform compilation

Keywords: Linux Android OpenCV

SeetaFace2 Android platform compilation

Project address: https://github.com/seetafaceengine/SeetaFace2

SeetaFace2 face recognition engine includes three core modules required to build a full-automatic face recognition system, namely: face detection module FaceDetector, face key point positioning module facelandmark and face feature extraction and comparison module FaceRecognizer. Facial key point positioning supports 5-point and 81-point positioning, and two auxiliary modules facettracker and quality assessor are used for face tracking and quality evaluation.

Android platform compilation instructions

Install ndk compiler

https://developer.android.com/ndk/downloads Download NDK and install it to: / home / Android NDK

Set environment variables:

export ANDROID_NDK=/home/android-ndk
Compiling under linux
cd SeetaFace2
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=install \
	-DCMAKE_BUILD_TYPE=MinSizeRel \
	-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
	-DANDROID_ABI="armeabi-v7a" \
	-DANDROID_PLATFORM=android-24 \
	-DBUILD_EXAMPLE=OFF # Set to ON if OpenCV is present
cmake --build . --config MinSizeRel
armeabi-v7a
cmake .. -DCMAKE_INSTALL_PREFIX=install \
	-DCMAKE_BUILD_TYPE=MinSizeRel \
	-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
	-DANDROID_ABI="armeabi-v7a with NEON" \
	-DBUILD_EXAMPLE=OFF	
arm64-v8a
cmake .. -DCMAKE_INSTALL_PREFIX=install \
	-DCMAKE_BUILD_TYPE=MinSizeRel \
	-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
	-DANDROID_ABI="arm64-v8a" \
	-DBUILD_EXAMPLE=OFF		
x86_64
cmake .. -DCMAKE_INSTALL_PREFIX=install \
	-DCMAKE_BUILD_TYPE=MinSizeRel \
	-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
	-DANDROID_ABI="x86_64" \
	-DBUILD_EXAMPLE=OFF		
x86
cmake .. -DCMAKE_INSTALL_PREFIX=install \
	-DCMAKE_BUILD_TYPE=MinSizeRel \
	-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
	-DANDROID_ABI="x86" \
	-DBUILD_EXAMPLE=OFF		
install

cmake --build . --config MinSizeRel --target install/strip
  • Parameter Description: https://developer.android.google.cn/ndk/guides/cmake

    • ANDROID_ABI: the following values can be taken: target abi. If the target ABI is not specified, CMake defaults to armeabi-v7a.

      Valid target names are:

      • armeabi: CPU with software floating-point operation and based on ARMv5TE.
      • armeabi-v7a: equipment with hardware FPU instruction (VFPv3_D16) and based on ARMv7.
      • armeabi-v7a with NEON: same as armeabi-v7a, but enables neon floating-point instructions. This is equivalent to setting - DANDROID_ABI=armeabi-v7a and - DANDROID_ARM_NEON=ON.
      • arm64-v8a: ARMv8 AArch64 instruction set.
      • x86: IA-32 instruction set.
      • x86_64 - instruction set for x86-64 architecture.
    • ANDROID_ The absolute path to the root directory of the NDK installed on the NDK host

    • ANDROID_PLATFORM: for a complete list of platform names and corresponding Android system images, see Android NDK native API

    • ANDROID_ARM_MODE

    • ANDROID_ARM_NEON

    • ANDROID_STL: Specifies the STL that CMake should use. By default, CMake uses c++_static.

      • c++_shared: using libc + + dynamic library
      • c++_static: using libc + + static library
      • none: no C + + library support
      • System: use the STL of the system
Compilation error
fatal: No names found, cannot describe anything.
-- == BUILD_VERSION: a587833
CMake Error at SeetaNet/CMakeLists.txt:44 (target_link_options):
  Unknown CMake command "target_link_options".


-- Configuring incomplete, errors occurred!
See also "/home/build/workspace/hqq/SeetaFace2/build/CMakeFiles/CMakeOutput.log".

Unknown CMake command "target_link_options".

Solution: https://github.com/seetafaceengine/SeetaFace2/issues/108

Upgrade cmake version, how to upgrade Baidu WOW

Compilation succeeded

The compiled dynamic library is in this directory

SeetaFace2/build/install/


Model Download
  • Face detection module FaceDetector model download link:
    MD5 : E88669E5F1301CA56162DE8AEF1FD5D5
    Baidu online disk: https://pan.baidu.com/s/1Dt0M6LXeSe4a0Pjyz5ifkg Extraction code: fs8r
    Dropbox : https://www.dropbox.com/s/cemt9fl48t5igfh/fd_2_00.dat?dl=0
  • Facial feature 5-point positioning module FaceLandmarker model download link:
    MD5 : 877A44AA6F07CB3064AD2828F50F261A
    Baidu online disk: https://pan.baidu.com/s/1MqofXbmTv8MIxnZTDt3h5A Extraction code: 7861
    Dropbox : https://www.dropbox.com/s/noy8tien1gmw165/pd_2_00_pts5.dat?dl=0
  • Facial feature 81 point positioning module FaceLandmarker model download link:
    MD5 : F3F812F01121B5A80384AF3C35211BDD
    Baidu online disk: https://pan.baidu.com/s/1CCfTGaSg_JSY3cN-R1Myaw extraction code: p8mc
    Dropbox : https://www.dropbox.com/s/v41lmclaxpwow1d/pd_2_00_pts81.dat?dl=0
  • Face feature extraction and comparison module FaceRecognizer model download link:
    MD5 : 2D637AAD8B1B7AE62154A877EC291C99
    Baidu online disk: https://pan.baidu.com/s/1y2vh_BHtYftR24V4xwAVWg extraction code: pim2
    2_00_pts81.dat?dl=0
  • Face feature extraction and comparison module FaceRecognizer model download link:
    MD5 : 2D637AAD8B1B7AE62154A877EC291C99
    Baidu online disk: https://pan.baidu.com/s/1y2vh_BHtYftR24V4xwAVWg extraction code: pim2
    Dropbox : https://www.dropbox.com/s/6aslqcokpljha5j/fr_2_10.dat?dl=0

Posted by iskawt on Wed, 01 Dec 2021 15:02:49 -0800