- Recognizer: adafacerecognizer.onnx (AdaFace, new default) with automatic fallback to ansfacerecognizer.onnx (ArcFace) for pre-v1.4 zips. AdaFace consumes BGR: new AdaFace handler in ONNXEngine skips the BGR2RGB swap, and the TensorRT paths gate their cvtColor on m_swapRB. - New C API: SetANSRFRecognizerModel (0=AdaFace, 1=ArcFace), GetANSRFRecognizerModel, GetANSRFModelInfo. A live switch reloads the recognizer and regenerates all stored embeddings from the enrolled face crops; the generating model is persisted in a new SETTINGS table (EMBEDDING_MODEL) so upgrading an ArcFace database to the AdaFace default migrates automatically on LoadEngine. - Attributes: prefer agegender.onnx (ViT: gender_logits [male,female] + age_pred in years; also handles the single-tensor research export) and emotionsrecognition.onnx (YOLOv11-cls, classes from .names) behind new IAgeGenderEstimator/IEmotionsClassifier interfaces, falling back to the legacy OpenVINO IRs. EP follows hardware: NVIDIA uses TensorRT EP with disk-cached engines, AMD DirectML, Intel OpenVINO. - Emotion JSON mapping: handle the new Fear class and the never-matched surprise label (both map to Attentive). - ANSFR-UnitTest: TestModelSwitchV14 covers default model selection, ONNX attribute backends, enrollment, and adaface<->arcface switching. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
84 lines
2.3 KiB
CMake
84 lines
2.3 KiB
CMake
# ANSFR — Face Recognition DLL (ONNX + TensorRT + FAISS + SQLite)
|
|
# Explicit source list from original vcxproj
|
|
set(ANSFR_SOURCES
|
|
ANSFR.cpp
|
|
ANSFRCommon.cpp
|
|
ANSFaceRecognizer.cpp
|
|
ONNXFaceAttributes.cpp
|
|
ANSGpuFrameRegistry.cpp
|
|
GpuNV12SlotPool.cpp
|
|
FaceDatabase.cpp
|
|
FaceNet.cpp
|
|
dllmain.cpp
|
|
pch.cpp
|
|
sqlite3.c
|
|
# Engine sources compiled into ANSFR
|
|
${CMAKE_SOURCE_DIR}/engines/ONNXEngine/ONNXEngine.cpp
|
|
${CMAKE_SOURCE_DIR}/engines/OpenVINOEngine/src/faceapp/cnn.cpp
|
|
${CMAKE_SOURCE_DIR}/engines/OpenVINOEngine/src/utils/args_helper.cpp
|
|
${CMAKE_SOURCE_DIR}/engines/OpenVINOEngine/src/utils/common.cpp
|
|
)
|
|
file(GLOB ANSFR_HEADERS "*.h")
|
|
|
|
add_library(ANSFR SHARED ${ANSFR_SOURCES} ${ANSFR_HEADERS})
|
|
|
|
target_include_directories(ANSFR PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
|
|
target_include_directories(ANSFR PRIVATE
|
|
${CMAKE_SOURCE_DIR}/engines/ONNXEngine
|
|
${CMAKE_SOURCE_DIR}/engines/OpenVINOEngine/include
|
|
${CMAKE_SOURCE_DIR}/engines/TensorRTAPI/include
|
|
${CMAKE_SOURCE_DIR}/modules/ANSODEngine
|
|
${SHARED_INCLUDE_DIR}
|
|
)
|
|
|
|
target_include_directories(ANSFR PRIVATE
|
|
${CMAKE_SOURCE_DIR}/modules/ANSMOT
|
|
${CMAKE_SOURCE_DIR}/engines/OpenVINOEngine/include/faceapp
|
|
${ANSLIBS_DIR}/faiss
|
|
${ANSLIBS_DIR} # for hnswlib/hnswlib.h
|
|
${ANSLIBS_DIR}/nlohmann
|
|
)
|
|
|
|
target_link_libraries(ANSFR
|
|
PUBLIC ANSLibsLoader
|
|
PRIVATE ANSODEngine
|
|
PUBLIC ANSLicensingSystem # PUBLIC: SPDLogger/FileExist symbols must be re-exported
|
|
PRIVATE labview
|
|
PRIVATE spdlog_dep
|
|
PRIVATE opencv
|
|
PRIVATE onnxruntime
|
|
PRIVATE tensorrt
|
|
PRIVATE openvino
|
|
PRIVATE faiss
|
|
PRIVATE mkl
|
|
PRIVATE boost
|
|
PRIVATE ANSMOT
|
|
PRIVATE CUDA::cudart_static
|
|
PRIVATE CUDA::cublas
|
|
PRIVATE CUDA::cublasLt
|
|
PRIVATE nvinfer_10.lib
|
|
PRIVATE nvonnxparser_10.lib
|
|
PRIVATE bcrypt.lib
|
|
)
|
|
|
|
# Boost asio/beast/uuid headers (already in boost/include/boost/)
|
|
# No extra include needed — covered by the boost interface target
|
|
|
|
target_compile_definitions(ANSFR PRIVATE UNICODE _UNICODE
|
|
ANSFR_EXPORTS
|
|
ENGINE_EXPORTS
|
|
ORT_API_MANUAL_INIT
|
|
_USRDLL
|
|
)
|
|
|
|
target_precompile_headers(ANSFR PRIVATE pch.h)
|
|
|
|
# sqlite3.c is pure C — skip precompiled headers and force C language
|
|
set_source_files_properties(sqlite3.c PROPERTIES
|
|
SKIP_PRECOMPILE_HEADERS ON
|
|
LANGUAGE C
|
|
)
|