mirror of
https://github.com/deepinsight/insightface.git
synced 2025-12-30 08:02:27 +00:00
Added the system resource management and monitoring functions
This commit is contained in:
@@ -69,7 +69,7 @@ if (ISF_ENABLE_RKNN)
|
||||
message(STATUS "Use ${ISF_RKNPU_MAJOR}")
|
||||
endif ()
|
||||
|
||||
|
||||
# Platform configuration
|
||||
option(ISF_BUILD_LINUX_ARM7 "Platform Armv7." OFF)
|
||||
option(ISF_BUILD_LINUX_AARCH64 "Platform Armv8." OFF)
|
||||
option(ISF_GLOBAL_INFERENCE_BACKEND_USE_MNN_CUDA "The global inference backend uses MNN CUDA." OFF)
|
||||
@@ -82,7 +82,10 @@ if (ISF_BUILD_LINUX_AARCH64)
|
||||
set(CPU_ARCH "aarch64")
|
||||
endif()
|
||||
|
||||
# If you want to build the unit-test, you need to set this to ON
|
||||
option(ISF_BUILD_WITH_TEST "Open Build Unit-Test." ON)
|
||||
|
||||
# If you want to build the sample, you need to set this to ON
|
||||
option(ISF_BUILD_WITH_SAMPLE "Open Build Sample Exec." ON)
|
||||
|
||||
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpp/)
|
||||
@@ -143,6 +146,7 @@ else()
|
||||
find_package(OpenCV REQUIRED)
|
||||
endif ()
|
||||
|
||||
# If you need using CUDA-enabled MNN, you need to manually configure the pre-compiled CUDA-enabled MNN library path
|
||||
set(ISF_LINUX_MNN_CUDA "" CACHE STRING "Path to CUDA directory")
|
||||
|
||||
if (ISF_GLOBAL_INFERENCE_BACKEND_USE_MNN_CUDA)
|
||||
@@ -181,16 +185,19 @@ else ()
|
||||
endif ()
|
||||
|
||||
|
||||
# Set install path
|
||||
# Set the installation directory to the build directory
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install")
|
||||
|
||||
add_subdirectory(cpp/inspireface) # Add a child project: InspireFace Source
|
||||
# Add a child project: InspireFace Source
|
||||
add_subdirectory(cpp/inspireface)
|
||||
get_property(InspireFace TARGET InspireFace PROPERTY InspireFace)
|
||||
|
||||
# Add a child project: Samples
|
||||
if (ISF_BUILD_WITH_SAMPLE)
|
||||
add_subdirectory(cpp/sample) # Add a child project: Samples
|
||||
endif ()
|
||||
|
||||
# Add a child project: Unit-Test
|
||||
if (ISF_BUILD_WITH_TEST)
|
||||
add_subdirectory(cpp/test) # Add a child project: Unit-Test
|
||||
endif ()
|
||||
|
||||
@@ -13,6 +13,8 @@ Please contact [contact@insightface.ai](mailto:contact@insightface.ai?subject=In
|
||||
|
||||
## Change Logs
|
||||
|
||||
**`2024-10-09`** Enhanced system-level resource monitoring, added statistical information for session and image stream creation.
|
||||
|
||||
**`2024-09-30`** Fixed some bugs in the feature hub.
|
||||
|
||||
**`2024-08-18`** Updating [Benchmark](doc/Benchmark-Remark(Updating).md): Using CoreML with Apple's Neural Engine (ANE) on the iPhone 13, the combined processes of **Face Detection** + **Alignment** + **Feature Extraction** take less than **2ms**.
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "log.h"
|
||||
#include "herror.h"
|
||||
|
||||
|
||||
namespace inspire {
|
||||
|
||||
std::mutex Launch::mutex_;
|
||||
@@ -24,7 +23,7 @@ std::shared_ptr<Launch> Launch::GetInstance() {
|
||||
return instance_;
|
||||
}
|
||||
|
||||
int32_t Launch::Load(const std::string &path) {
|
||||
int32_t Launch::Load(const std::string& path) {
|
||||
if (!m_load_) {
|
||||
m_archive_.ReLoad(path);
|
||||
if (m_archive_.QueryStatus() == SARC_SUCCESS) {
|
||||
@@ -34,7 +33,8 @@ int32_t Launch::Load(const std::string &path) {
|
||||
return HERR_ARCHIVE_LOAD_MODEL_FAILURE;
|
||||
}
|
||||
} else {
|
||||
INSPIRE_LOGW("There is no need to call launch more than once, as subsequent calls will not affect the initialization.");
|
||||
INSPIRE_LOGW(
|
||||
"There is no need to call launch more than once, as subsequent calls will not affect the initialization.");
|
||||
return HSUCCEED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include <iomanip> // For std::setw and std::left
|
||||
|
||||
#include <vector>
|
||||
#ifndef INSPIRE_API
|
||||
#define INSPIRE_API
|
||||
#endif
|
||||
@@ -16,7 +16,12 @@
|
||||
|
||||
namespace inspire {
|
||||
|
||||
class ResourceManager {
|
||||
/**
|
||||
* @brief ResourceManager is a singleton class that manages the creation and release of sessions and image streams.
|
||||
* It uses hash tables to store session and image stream handles, and provides methods to create, release, and query these resources.
|
||||
* The ResourceManager class is designed to be used in a multi-threaded environment, and it uses a mutex to synchronize access to its data structures.
|
||||
*/
|
||||
class INSPIRE_API ResourceManager {
|
||||
private:
|
||||
// Private static instance pointer
|
||||
static std::unique_ptr<ResourceManager> instance;
|
||||
@@ -79,12 +84,35 @@ public:
|
||||
// released
|
||||
}
|
||||
|
||||
// Gets a list of unreleased session handles
|
||||
std::vector<long> getUnreleasedSessions() {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::vector<long> unreleasedSessions;
|
||||
for (const auto& entry : sessionMap) {
|
||||
if (!entry.second) {
|
||||
unreleasedSessions.push_back(entry.first);
|
||||
}
|
||||
}
|
||||
return unreleasedSessions;
|
||||
}
|
||||
|
||||
// Gets a list of unreleased image stream handles
|
||||
std::vector<long> getUnreleasedStreams() {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::vector<long> unreleasedStreams;
|
||||
for (const auto& entry : streamMap) {
|
||||
if (!entry.second) {
|
||||
unreleasedStreams.push_back(entry.first);
|
||||
}
|
||||
}
|
||||
return unreleasedStreams;
|
||||
}
|
||||
|
||||
// Method to print resource management statistics
|
||||
void printResourceStatistics() {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::cout << std::left << std::setw(15) << "Resource Name" << std::setw(15)
|
||||
<< "Total Created" << std::setw(15) << "Total Released" << std::setw(15)
|
||||
<< "Not Released" << std::endl;
|
||||
std::cout << std::left << std::setw(15) << "Resource Name" << std::setw(15) << "Total Created" << std::setw(15) << "Total Released"
|
||||
<< std::setw(15) << "Not Released" << std::endl;
|
||||
|
||||
// Print session statistics
|
||||
int totalSessionsCreated = sessionMap.size();
|
||||
@@ -96,9 +124,8 @@ public:
|
||||
if (!entry.second)
|
||||
++sessionsNotReleased;
|
||||
}
|
||||
std::cout << std::left << std::setw(15) << "Session" << std::setw(15)
|
||||
<< totalSessionsCreated << std::setw(15) << totalSessionsReleased << std::setw(15)
|
||||
<< sessionsNotReleased << std::endl;
|
||||
std::cout << std::left << std::setw(15) << "Session" << std::setw(15) << totalSessionsCreated << std::setw(15) << totalSessionsReleased
|
||||
<< std::setw(15) << sessionsNotReleased << std::endl;
|
||||
|
||||
// Print stream statistics
|
||||
int totalStreamsCreated = streamMap.size();
|
||||
@@ -110,9 +137,8 @@ public:
|
||||
if (!entry.second)
|
||||
++streamsNotReleased;
|
||||
}
|
||||
std::cout << std::left << std::setw(15) << "Stream" << std::setw(15) << totalStreamsCreated
|
||||
<< std::setw(15) << totalStreamsReleased << std::setw(15) << streamsNotReleased
|
||||
<< std::endl;
|
||||
std::cout << std::left << std::setw(15) << "Stream" << std::setw(15) << totalStreamsCreated << std::setw(15) << totalStreamsReleased
|
||||
<< std::setw(15) << streamsNotReleased << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -128,8 +128,7 @@ HResult HFReleaseInspireFaceSession(HFSession handle) {
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFCreateInspireFaceSession(HFSessionCustomParameter parameter, HFDetectMode detectMode,
|
||||
HInt32 maxDetectFaceNum, HInt32 detectPixelLevel,
|
||||
HResult HFCreateInspireFaceSession(HFSessionCustomParameter parameter, HFDetectMode detectMode, HInt32 maxDetectFaceNum, HInt32 detectPixelLevel,
|
||||
HInt32 trackByDetectModeFPS, HFSession *handle) {
|
||||
inspire::ContextCustomParameter param;
|
||||
param.enable_mask_detect = parameter.enable_mask_detect;
|
||||
@@ -147,8 +146,7 @@ HResult HFCreateInspireFaceSession(HFSessionCustomParameter parameter, HFDetectM
|
||||
}
|
||||
|
||||
HF_FaceAlgorithmSession *ctx = new HF_FaceAlgorithmSession();
|
||||
auto ret = ctx->impl.Configuration(detMode, maxDetectFaceNum, param, detectPixelLevel,
|
||||
trackByDetectModeFPS);
|
||||
auto ret = ctx->impl.Configuration(detMode, maxDetectFaceNum, param, detectPixelLevel, trackByDetectModeFPS);
|
||||
if (ret != HSUCCEED) {
|
||||
delete ctx;
|
||||
*handle = nullptr;
|
||||
@@ -161,8 +159,7 @@ HResult HFCreateInspireFaceSession(HFSessionCustomParameter parameter, HFDetectM
|
||||
return ret;
|
||||
}
|
||||
|
||||
HResult HFCreateInspireFaceSessionOptional(HOption customOption, HFDetectMode detectMode,
|
||||
HInt32 maxDetectFaceNum, HInt32 detectPixelLevel,
|
||||
HResult HFCreateInspireFaceSessionOptional(HOption customOption, HFDetectMode detectMode, HInt32 maxDetectFaceNum, HInt32 detectPixelLevel,
|
||||
HInt32 trackByDetectModeFPS, HFSession *handle) {
|
||||
inspire::ContextCustomParameter param;
|
||||
if (customOption & HF_ENABLE_FACE_RECOGNITION) {
|
||||
@@ -194,8 +191,7 @@ HResult HFCreateInspireFaceSessionOptional(HOption customOption, HFDetectMode de
|
||||
}
|
||||
|
||||
HF_FaceAlgorithmSession *ctx = new HF_FaceAlgorithmSession();
|
||||
auto ret = ctx->impl.Configuration(detMode, maxDetectFaceNum, param, detectPixelLevel,
|
||||
trackByDetectModeFPS);
|
||||
auto ret = ctx->impl.Configuration(detMode, maxDetectFaceNum, param, detectPixelLevel, trackByDetectModeFPS);
|
||||
if (ret != HSUCCEED) {
|
||||
delete ctx;
|
||||
*handle = nullptr;
|
||||
@@ -224,8 +220,7 @@ HResult HFFeatureHubDataDisable() {
|
||||
|
||||
HResult HFFeatureHubDataEnable(HFFeatureHubConfiguration configuration) {
|
||||
inspire::DatabaseConfiguration param;
|
||||
param.db_path =
|
||||
(configuration.dbPath != nullptr) ? std::string(configuration.dbPath) : std::string();
|
||||
param.db_path = (configuration.dbPath != nullptr) ? std::string(configuration.dbPath) : std::string();
|
||||
param.enable_use_db = configuration.enablePersistence;
|
||||
param.feature_block_num = configuration.featureBlockNum;
|
||||
param.recognition_threshold = configuration.searchThreshold;
|
||||
@@ -283,8 +278,7 @@ HResult HFSessionSetFaceDetectThreshold(HFSession session, HFloat threshold) {
|
||||
return ctx->impl.SetFaceDetectThreshold(threshold);
|
||||
}
|
||||
|
||||
HResult HFExecuteFaceTrack(HFSession session, HFImageStream streamHandle,
|
||||
PHFMultipleFaceData results) {
|
||||
HResult HFExecuteFaceTrack(HFSession session, HFImageStream streamHandle, PHFMultipleFaceData results) {
|
||||
if (session == nullptr) {
|
||||
return HERR_INVALID_CONTEXT_HANDLE;
|
||||
}
|
||||
@@ -303,6 +297,7 @@ HResult HFExecuteFaceTrack(HFSession session, HFImageStream streamHandle,
|
||||
results->detectedNum = ctx->impl.GetNumberOfFacesCurrentlyDetected();
|
||||
results->rects = (HFaceRect *)ctx->impl.GetFaceRectsCache().data();
|
||||
results->trackIds = (HInt32 *)ctx->impl.GetTrackIDCache().data();
|
||||
results->detConfidence = (HFloat *)ctx->impl.GetDetConfidenceCache().data();
|
||||
results->angles.pitch = (HFloat *)ctx->impl.GetPitchResultsCache().data();
|
||||
results->angles.roll = (HFloat *)ctx->impl.GetRollResultsCache().data();
|
||||
results->angles.yaw = (HFloat *)ctx->impl.GetYawResultsCache().data();
|
||||
@@ -329,8 +324,7 @@ HResult HFGetNumOfFaceDenseLandmark(HPInt32 num) {
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFGetFaceDenseLandmarkFromFaceToken(HFFaceBasicToken singleFace, HPoint2f *landmarks,
|
||||
HInt32 num) {
|
||||
HResult HFGetFaceDenseLandmarkFromFaceToken(HFFaceBasicToken singleFace, HPoint2f *landmarks, HInt32 num) {
|
||||
if (num != 106) {
|
||||
return HERR_SESS_LANDMARK_NUM_NOT_MATCH;
|
||||
}
|
||||
@@ -356,8 +350,7 @@ HResult HFFeatureHubFaceSearchThresholdSetting(float threshold) {
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFFaceFeatureExtract(HFSession session, HFImageStream streamHandle,
|
||||
HFFaceBasicToken singleFace, PHFFaceFeature feature) {
|
||||
HResult HFFaceFeatureExtract(HFSession session, HFImageStream streamHandle, HFFaceBasicToken singleFace, PHFFaceFeature feature) {
|
||||
if (session == nullptr) {
|
||||
return HERR_INVALID_CONTEXT_HANDLE;
|
||||
}
|
||||
@@ -385,8 +378,7 @@ HResult HFFaceFeatureExtract(HFSession session, HFImageStream streamHandle,
|
||||
return ret;
|
||||
}
|
||||
|
||||
HResult HFFaceFeatureExtractCpy(HFSession session, HFImageStream streamHandle,
|
||||
HFFaceBasicToken singleFace, HPFloat feature) {
|
||||
HResult HFFaceFeatureExtractCpy(HFSession session, HFImageStream streamHandle, HFFaceBasicToken singleFace, HPFloat feature) {
|
||||
if (session == nullptr) {
|
||||
return HERR_INVALID_CONTEXT_HANDLE;
|
||||
}
|
||||
@@ -452,8 +444,7 @@ HResult HFFeatureHubInsertFeature(HFFaceFeatureIdentity featureIdentity) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
HResult HFFeatureHubFaceSearch(HFFaceFeature searchFeature, HPFloat confidence,
|
||||
PHFFaceFeatureIdentity mostSimilar) {
|
||||
HResult HFFeatureHubFaceSearch(HFFaceFeature searchFeature, HPFloat confidence, PHFFaceFeatureIdentity mostSimilar) {
|
||||
if (searchFeature.data == nullptr) {
|
||||
return HERR_INVALID_FACE_FEATURE;
|
||||
}
|
||||
@@ -474,8 +465,7 @@ HResult HFFeatureHubFaceSearch(HFFaceFeature searchFeature, HPFloat confidence,
|
||||
return ret;
|
||||
}
|
||||
|
||||
HResult HFFeatureHubFaceSearchTopK(HFFaceFeature searchFeature, HInt32 topK,
|
||||
PHFSearchTopKResults results) {
|
||||
HResult HFFeatureHubFaceSearchTopK(HFFaceFeature searchFeature, HInt32 topK, PHFSearchTopKResults results) {
|
||||
if (searchFeature.data == nullptr) {
|
||||
return HERR_INVALID_FACE_FEATURE;
|
||||
}
|
||||
@@ -530,9 +520,7 @@ HResult HFFeatureHubGetFaceIdentity(HInt32 customId, PHFFaceFeatureIdentity iden
|
||||
return ret;
|
||||
}
|
||||
|
||||
HResult HFMultipleFacePipelineProcess(HFSession session, HFImageStream streamHandle,
|
||||
PHFMultipleFaceData faces,
|
||||
HFSessionCustomParameter parameter) {
|
||||
HResult HFMultipleFacePipelineProcess(HFSession session, HFImageStream streamHandle, PHFMultipleFaceData faces, HFSessionCustomParameter parameter) {
|
||||
if (session == nullptr) {
|
||||
return HERR_INVALID_CONTEXT_HANDLE;
|
||||
}
|
||||
@@ -580,8 +568,7 @@ HResult HFMultipleFacePipelineProcess(HFSession session, HFImageStream streamHan
|
||||
return ret;
|
||||
}
|
||||
|
||||
HResult HFMultipleFacePipelineProcessOptional(HFSession session, HFImageStream streamHandle,
|
||||
PHFMultipleFaceData faces, HInt32 customOption) {
|
||||
HResult HFMultipleFacePipelineProcessOptional(HFSession session, HFImageStream streamHandle, PHFMultipleFaceData faces, HInt32 customOption) {
|
||||
if (session == nullptr) {
|
||||
return HERR_INVALID_CONTEXT_HANDLE;
|
||||
}
|
||||
@@ -714,10 +701,8 @@ HResult HFGetFaceIntereactionStateResult(HFSession session, PHFFaceIntereactionS
|
||||
return HERR_INVALID_CONTEXT_HANDLE;
|
||||
}
|
||||
result->num = ctx->impl.GetFaceInteractionLeftEyeStatusCache().size();
|
||||
result->leftEyeStatusConfidence =
|
||||
(HFloat *)ctx->impl.GetFaceInteractionLeftEyeStatusCache().data();
|
||||
result->rightEyeStatusConfidence =
|
||||
(HFloat *)ctx->impl.GetFaceInteractionRightEyeStatusCache().data();
|
||||
result->leftEyeStatusConfidence = (HFloat *)ctx->impl.GetFaceInteractionLeftEyeStatusCache().data();
|
||||
result->rightEyeStatusConfidence = (HFloat *)ctx->impl.GetFaceInteractionRightEyeStatusCache().data();
|
||||
|
||||
return HSUCCEED;
|
||||
}
|
||||
@@ -788,3 +773,29 @@ HResult HFDeBugShowResourceStatistics() {
|
||||
RESOURCE_MANAGE->printResourceStatistics();
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFDeBugGetUnreleasedSessionsCount(HInt32 *count) {
|
||||
*count = RESOURCE_MANAGE->getUnreleasedSessions().size();
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFDeBugGetUnreleasedSessions(HFSession *sessions, HInt32 count) {
|
||||
std::vector<long> unreleasedSessions = RESOURCE_MANAGE->getUnreleasedSessions();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
sessions[i] = (HFSession)unreleasedSessions[i];
|
||||
}
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFDeBugGetUnreleasedStreamsCount(HInt32 *count) {
|
||||
*count = RESOURCE_MANAGE->getUnreleasedStreams().size();
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
HResult HFDeBugGetUnreleasedStreams(HFImageStream *streams, HInt32 count) {
|
||||
std::vector<long> unreleasedStreams = RESOURCE_MANAGE->getUnreleasedStreams();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
streams[i] = (HFImageStream)unreleasedStreams[i];
|
||||
}
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ extern "C" {
|
||||
#define HF_ENABLE_NONE 0x00000000 ///< Flag to enable no features.
|
||||
#define HF_ENABLE_FACE_RECOGNITION 0x00000002 ///< Flag to enable face recognition feature.
|
||||
#define HF_ENABLE_LIVENESS 0x00000004 ///< Flag to enable RGB liveness detection feature.
|
||||
#define HF_ENABLE_IR_LIVENESS \
|
||||
0x00000008 ///< Flag to enable IR (Infrared) liveness detection feature.
|
||||
#define HF_ENABLE_IR_LIVENESS 0x00000008 ///< Flag to enable IR (Infrared) liveness detection feature.
|
||||
#define HF_ENABLE_MASK_DETECT 0x00000010 ///< Flag to enable mask detection feature.
|
||||
#define HF_ENABLE_FACE_ATTRIBUTE 0x00000020 ///< Flag to enable face attribute prediction feature.
|
||||
#define HF_ENABLE_PLACEHOLDER_ 0x00000040 ///< -
|
||||
@@ -161,8 +160,7 @@ typedef enum HFDetectMode {
|
||||
* @param handle Pointer to the context handle that will be returned.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFCreateInspireFaceSession(
|
||||
HFSessionCustomParameter parameter, HFDetectMode detectMode, HInt32 maxDetectFaceNum,
|
||||
HYPER_CAPI_EXPORT extern HResult HFCreateInspireFaceSession(HFSessionCustomParameter parameter, HFDetectMode detectMode, HInt32 maxDetectFaceNum,
|
||||
HInt32 detectPixelLevel, HInt32 trackByDetectModeFPS, HFSession *handle);
|
||||
|
||||
/**
|
||||
@@ -179,9 +177,8 @@ HYPER_CAPI_EXPORT extern HResult HFCreateInspireFaceSession(
|
||||
* @param handle Pointer to the context handle that will be returned.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFCreateInspireFaceSessionOptional(
|
||||
HOption customOption, HFDetectMode detectMode, HInt32 maxDetectFaceNum, HInt32 detectPixelLevel,
|
||||
HInt32 trackByDetectModeFPS, HFSession *handle);
|
||||
HYPER_CAPI_EXPORT extern HResult HFCreateInspireFaceSessionOptional(HOption customOption, HFDetectMode detectMode, HInt32 maxDetectFaceNum,
|
||||
HInt32 detectPixelLevel, HInt32 trackByDetectModeFPS, HFSession *handle);
|
||||
|
||||
/**
|
||||
* @brief Release the session.
|
||||
@@ -222,6 +219,7 @@ typedef struct HFMultipleFaceData {
|
||||
HInt32 detectedNum; ///< Number of faces detected.
|
||||
HFaceRect *rects; ///< Array of bounding rectangles for each face.
|
||||
HInt32 *trackIds; ///< Array of track IDs for each face.
|
||||
HFloat *detConfidence; ///< Array of detection confidence for each face.
|
||||
HFFaceEulerAngle angles; ///< Euler angles for each face.
|
||||
PHFFaceBasicToken tokens; ///< Tokens associated with each face.
|
||||
} HFMultipleFaceData, *PHFMultipleFaceData;
|
||||
@@ -234,8 +232,7 @@ typedef struct HFMultipleFaceData {
|
||||
* @param previewSize The size of the preview for tracking.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFSessionSetTrackPreviewSize(HFSession session,
|
||||
HInt32 previewSize);
|
||||
HYPER_CAPI_EXPORT extern HResult HFSessionSetTrackPreviewSize(HFSession session, HInt32 previewSize);
|
||||
|
||||
/**
|
||||
* @brief Set the minimum number of face pixels that the face detector can capture, and people below
|
||||
@@ -245,8 +242,7 @@ HYPER_CAPI_EXPORT extern HResult HFSessionSetTrackPreviewSize(HFSession session,
|
||||
* @param minSize The minimum pixel value, default value is 0.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFSessionSetFilterMinimumFacePixelSize(HFSession session,
|
||||
HInt32 minSize);
|
||||
HYPER_CAPI_EXPORT extern HResult HFSessionSetFilterMinimumFacePixelSize(HFSession session, HInt32 minSize);
|
||||
|
||||
/**
|
||||
* @brief Set the face detect threshold in the session.
|
||||
@@ -255,8 +251,7 @@ HYPER_CAPI_EXPORT extern HResult HFSessionSetFilterMinimumFacePixelSize(HFSessio
|
||||
* @param detectMode The mode of the detection mode for tracking.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFSessionSetFaceDetectThreshold(HFSession session,
|
||||
HFloat threshold);
|
||||
HYPER_CAPI_EXPORT extern HResult HFSessionSetFaceDetectThreshold(HFSession session, HFloat threshold);
|
||||
|
||||
/**
|
||||
* @brief Run face tracking in the session.
|
||||
@@ -266,8 +261,7 @@ HYPER_CAPI_EXPORT extern HResult HFSessionSetFaceDetectThreshold(HFSession sessi
|
||||
* @param results Pointer to the structure where the results will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFExecuteFaceTrack(HFSession session, HFImageStream streamHandle,
|
||||
PHFMultipleFaceData results);
|
||||
HYPER_CAPI_EXPORT extern HResult HFExecuteFaceTrack(HFSession session, HFImageStream streamHandle, PHFMultipleFaceData results);
|
||||
|
||||
/**
|
||||
* @brief Copies the data from a HF_FaceBasicToken to a specified buffer.
|
||||
@@ -284,8 +278,7 @@ HYPER_CAPI_EXPORT extern HResult HFExecuteFaceTrack(HFSession session, HFImageSt
|
||||
* if the operation was successful, or an error code if the buffer was too small
|
||||
* or if any other error occurred.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFCopyFaceBasicToken(HFFaceBasicToken token, HPBuffer buffer,
|
||||
HInt32 bufferSize);
|
||||
HYPER_CAPI_EXPORT extern HResult HFCopyFaceBasicToken(HFFaceBasicToken token, HPBuffer buffer, HInt32 bufferSize);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the size of the data contained in a HF_FaceBasicToken.
|
||||
@@ -316,9 +309,7 @@ HYPER_CAPI_EXPORT extern HResult HFGetNumOfFaceDenseLandmark(HPInt32 num);
|
||||
* @param num Number of landmark points
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceDenseLandmarkFromFaceToken(HFFaceBasicToken singleFace,
|
||||
HPoint2f *landmarks,
|
||||
HInt32 num);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceDenseLandmarkFromFaceToken(HFFaceBasicToken singleFace, HPoint2f *landmarks, HInt32 num);
|
||||
|
||||
/************************************************************************
|
||||
* Face Recognition
|
||||
@@ -343,8 +334,7 @@ typedef struct HFFaceFeature {
|
||||
* @param feature Pointer to the extracted face feature.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceFeatureExtract(HFSession session, HFImageStream streamHandle,
|
||||
HFFaceBasicToken singleFace,
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceFeatureExtract(HFSession session, HFImageStream streamHandle, HFFaceBasicToken singleFace,
|
||||
PHFFaceFeature feature);
|
||||
|
||||
/**
|
||||
@@ -356,10 +346,7 @@ HYPER_CAPI_EXPORT extern HResult HFFaceFeatureExtract(HFSession session, HFImage
|
||||
* @param feature Pointer to the buffer where the extracted feature will be copied.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceFeatureExtractCpy(HFSession session,
|
||||
HFImageStream streamHandle,
|
||||
HFFaceBasicToken singleFace,
|
||||
HPFloat feature);
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceFeatureExtractCpy(HFSession session, HFImageStream streamHandle, HFFaceBasicToken singleFace, HPFloat feature);
|
||||
|
||||
/************************************************************************
|
||||
* Feature Hub
|
||||
@@ -448,8 +435,7 @@ HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceSearchThresholdSetting(float th
|
||||
* @param result Pointer to the floating-point value where the comparison result will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceComparison(HFFaceFeature feature1, HFFaceFeature feature2,
|
||||
HPFloat result);
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceComparison(HFFaceFeature feature1, HFFaceFeature feature2, HPFloat result);
|
||||
|
||||
/**
|
||||
* @brief Get the length of the face feature.
|
||||
@@ -476,9 +462,7 @@ HYPER_CAPI_EXPORT extern HResult HFFeatureHubInsertFeature(HFFaceFeatureIdentity
|
||||
* @param mostSimilar Pointer to the most similar face feature identity found.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceSearch(HFFaceFeature searchFeature,
|
||||
HPFloat confidence,
|
||||
PHFFaceFeatureIdentity mostSimilar);
|
||||
HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceSearch(HFFaceFeature searchFeature, HPFloat confidence, PHFFaceFeatureIdentity mostSimilar);
|
||||
|
||||
/**
|
||||
* @brief Search for the most similar k facial features in the feature group
|
||||
@@ -488,9 +472,7 @@ HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceSearch(HFFaceFeature searchFeat
|
||||
* @param PHFSearchTopKResults Output search result
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceSearchTopK(HFFaceFeature searchFeature,
|
||||
HInt32 topK,
|
||||
PHFSearchTopKResults results);
|
||||
HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceSearchTopK(HFFaceFeature searchFeature, HInt32 topK, PHFSearchTopKResults results);
|
||||
|
||||
/**
|
||||
* @brief Remove a face feature from the features group based on custom ID.
|
||||
@@ -515,8 +497,7 @@ HYPER_CAPI_EXPORT extern HResult HFFeatureHubFaceUpdate(HFFaceFeatureIdentity fe
|
||||
* @param identity Pointer to the face feature identity to be retrieved.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFeatureHubGetFaceIdentity(HInt32 customId,
|
||||
PHFFaceFeatureIdentity identity);
|
||||
HYPER_CAPI_EXPORT extern HResult HFFeatureHubGetFaceIdentity(HInt32 customId, PHFFaceFeatureIdentity identity);
|
||||
|
||||
/**
|
||||
* @brief Get the count of face features in the features group.
|
||||
@@ -549,9 +530,7 @@ HYPER_CAPI_EXPORT extern HResult HFFeatureHubViewDBTable();
|
||||
* @param parameter Custom parameters for processing the faces.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFMultipleFacePipelineProcess(HFSession session,
|
||||
HFImageStream streamHandle,
|
||||
PHFMultipleFaceData faces,
|
||||
HYPER_CAPI_EXPORT extern HResult HFMultipleFacePipelineProcess(HFSession session, HFImageStream streamHandle, PHFMultipleFaceData faces,
|
||||
HFSessionCustomParameter parameter);
|
||||
|
||||
/**
|
||||
@@ -566,9 +545,7 @@ HYPER_CAPI_EXPORT extern HResult HFMultipleFacePipelineProcess(HFSession session
|
||||
* @param customOption An integer representing a custom option for processing.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFMultipleFacePipelineProcessOptional(HFSession session,
|
||||
HFImageStream streamHandle,
|
||||
PHFMultipleFaceData faces,
|
||||
HYPER_CAPI_EXPORT extern HResult HFMultipleFacePipelineProcessOptional(HFSession session, HFImageStream streamHandle, PHFMultipleFaceData faces,
|
||||
HInt32 customOption);
|
||||
|
||||
/**
|
||||
@@ -592,8 +569,7 @@ typedef struct HFRGBLivenessConfidence {
|
||||
* @param confidence Pointer to the structure where RGB liveness confidence data will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetRGBLivenessConfidence(HFSession session,
|
||||
PHFRGBLivenessConfidence confidence);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetRGBLivenessConfidence(HFSession session, PHFRGBLivenessConfidence confidence);
|
||||
|
||||
/**
|
||||
* @brief Struct representing face mask confidence.
|
||||
@@ -616,8 +592,7 @@ typedef struct HFFaceMaskConfidence {
|
||||
* @param confidence Pointer to the structure where face mask confidence data will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceMaskConfidence(HFSession session,
|
||||
PHFFaceMaskConfidence confidence);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceMaskConfidence(HFSession session, PHFFaceMaskConfidence confidence);
|
||||
|
||||
/**
|
||||
* @brief Struct representing face quality predict confidence.
|
||||
@@ -640,8 +615,7 @@ typedef struct HFFaceQualityConfidence {
|
||||
* @param confidence Pointer to the structure where face mask confidence data will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceQualityConfidence(HFSession session,
|
||||
PHFFaceQualityConfidence confidence);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceQualityConfidence(HFSession session, PHFFaceQualityConfidence confidence);
|
||||
|
||||
/**
|
||||
* @brief Detect the quality of a face in an image.
|
||||
@@ -653,8 +627,7 @@ HYPER_CAPI_EXPORT extern HResult HFGetFaceQualityConfidence(HFSession session,
|
||||
* @param confidence Pointer to a floating-point value where the quality confidence will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceQualityDetect(HFSession session, HFFaceBasicToken singleFace,
|
||||
HFloat *confidence);
|
||||
HYPER_CAPI_EXPORT extern HResult HFFaceQualityDetect(HFSession session, HFFaceBasicToken singleFace, HFloat *confidence);
|
||||
|
||||
/**
|
||||
* @brief Facial states in the face interaction module.
|
||||
@@ -672,8 +645,7 @@ typedef struct HFFaceIntereactionState {
|
||||
* @param session Handle to the session.
|
||||
* @param result Facial state prediction results in the face interaction module.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceIntereactionStateResult(HFSession session,
|
||||
PHFFaceIntereactionState result);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceIntereactionStateResult(HFSession session, PHFFaceIntereactionState result);
|
||||
|
||||
/**
|
||||
* @brief Actions detected in the face interaction module.
|
||||
@@ -693,8 +665,7 @@ typedef struct HFFaceIntereactionsActions {
|
||||
* @param actions Facial action prediction results in the face interaction module.
|
||||
* @return HResult indicating success or failure of the function call.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceIntereactionActionsResult(
|
||||
HFSession session, PHFFaceIntereactionsActions actions);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceIntereactionActionsResult(HFSession session, PHFFaceIntereactionsActions actions);
|
||||
/**
|
||||
* @brief Struct representing face attribute results.
|
||||
*
|
||||
@@ -733,8 +704,7 @@ typedef struct HFFaceAttributeResult {
|
||||
* @param results Pointer to the structure where face attribute results will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceAttributeResult(HFSession session,
|
||||
PHFFaceAttributeResult results);
|
||||
HYPER_CAPI_EXPORT extern HResult HFGetFaceAttributeResult(HFSession session, PHFFaceAttributeResult results);
|
||||
|
||||
/************************************************************************
|
||||
* System Function
|
||||
@@ -806,8 +776,7 @@ HYPER_CAPI_EXPORT extern void HFDeBugImageStreamImShow(HFImageStream streamHandl
|
||||
* @param savePath The path to which the image is written.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugImageStreamDecodeSave(HFImageStream streamHandle,
|
||||
HPath savePath);
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugImageStreamDecodeSave(HFImageStream streamHandle, HPath savePath);
|
||||
|
||||
/**
|
||||
* @brief Display current resource management statistics.
|
||||
@@ -824,6 +793,48 @@ HYPER_CAPI_EXPORT extern HResult HFDeBugImageStreamDecodeSave(HFImageStream stre
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugShowResourceStatistics();
|
||||
|
||||
/**
|
||||
* @brief Get the count of unreleased sessions.
|
||||
*
|
||||
* This function retrieves the count of sessions that have not been released yet.
|
||||
*
|
||||
* @param count Pointer to an integer where the count of unreleased sessions will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugGetUnreleasedSessionsCount(HInt32 *count);
|
||||
|
||||
/**
|
||||
* @brief Get the list of unreleased sessions.
|
||||
*
|
||||
* This function retrieves the list of sessions that have not been released yet.
|
||||
*
|
||||
* @param sessions Pointer to an array where the unreleased sessions will be stored.
|
||||
* @param count The number of sessions to retrieve.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugGetUnreleasedSessions(HFSession *sessions, HInt32 count);
|
||||
|
||||
/**
|
||||
* @brief Get the count of unreleased image streams.
|
||||
*
|
||||
* This function retrieves the count of image streams that have not been released yet.
|
||||
*
|
||||
* @param count Pointer to an integer where the count of unreleased image streams will be stored.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugGetUnreleasedStreamsCount(HInt32 *count);
|
||||
|
||||
/**
|
||||
* @brief Get the list of unreleased image streams.
|
||||
*
|
||||
* This function retrieves the list of image streams that have not been released yet.
|
||||
*
|
||||
* @param streams Pointer to an array where the unreleased image streams will be stored.
|
||||
* @param count The number of image streams to retrieve.
|
||||
* @return HResult indicating the success or failure of the operation.
|
||||
*/
|
||||
HYPER_CAPI_EXPORT extern HResult HFDeBugGetUnreleasedStreams(HFImageStream *streams, HInt32 count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,26 +6,43 @@
|
||||
#include <sstream>
|
||||
#include "log.h" // Assume log.h includes the INSPIRE_LOGI macro
|
||||
|
||||
#ifndef INSPIRE_API
|
||||
#define INSPIRE_API
|
||||
#endif
|
||||
|
||||
// Macro definition to control whether time cost calculations are enabled
|
||||
#ifdef ISF_ENABLE_COST_TIME
|
||||
|
||||
// define the macro to calculate the time cost
|
||||
#define COST_TIME(id, precision) inspire::CostTime cost_time_##id(#id, __FILENAME__, __FUNCTION__, __LINE__, precision)
|
||||
|
||||
// define the macro to calculate the time cost without precision
|
||||
#define COST_TIME_SIMPLE(id) inspire::CostTime cost_time_##id(#id, __FILENAME__, __FUNCTION__, __LINE__)
|
||||
|
||||
#else
|
||||
#define COST_TIME(id, precision) // No operation, when ISF_ENABLE_COST_TIME is not defined
|
||||
#define COST_TIME_SIMPLE(id) // No operation, when ISF_ENABLE_COST_TIME is not defined
|
||||
|
||||
// No operation, when ISF_ENABLE_COST_TIME is not defined
|
||||
#define COST_TIME(id, precision)
|
||||
|
||||
// No operation, when ISF_ENABLE_COST_TIME is not defined
|
||||
#define COST_TIME_SIMPLE(id)
|
||||
|
||||
#endif
|
||||
|
||||
namespace inspire {
|
||||
|
||||
class CostTime {
|
||||
/**
|
||||
* @class CostTime
|
||||
* @brief A class for measuring and logging the time taken by a block of code.
|
||||
*
|
||||
* This class is used to measure the time taken by a block of code and log the result.
|
||||
* It uses the std::chrono library to measure the time taken.
|
||||
*/
|
||||
class INSPIRE_API CostTime {
|
||||
public:
|
||||
// Constructor, records the start time
|
||||
explicit CostTime(const char* id, const char* filename, const char* function, int line, int precision = 5)
|
||||
: id_(id), filename_(filename), function_(function), line_(line), precision_(precision),
|
||||
start_time_(std::chrono::steady_clock::now()) {}
|
||||
: id_(id), filename_(filename), function_(function), line_(line), precision_(precision), start_time_(std::chrono::steady_clock::now()) {}
|
||||
|
||||
// Destructor, calculates and logs the time taken
|
||||
~CostTime() {
|
||||
|
||||
@@ -11,14 +11,10 @@
|
||||
|
||||
namespace inspire {
|
||||
|
||||
|
||||
FaceContext::FaceContext() = default;
|
||||
|
||||
int32_t FaceContext::Configuration(DetectMode detect_mode,
|
||||
int32_t max_detect_face,
|
||||
CustomPipelineParameter param,
|
||||
int32_t detect_level_px,
|
||||
int32_t track_by_detect_mode_fps) {
|
||||
int32_t FaceContext::Configuration(DetectMode detect_mode, int32_t max_detect_face, CustomPipelineParameter param,
|
||||
int32_t detect_level_px, int32_t track_by_detect_mode_fps) {
|
||||
m_detect_mode_ = detect_mode;
|
||||
m_max_detect_face_ = max_detect_face;
|
||||
m_parameter_ = param;
|
||||
@@ -29,28 +25,25 @@ int32_t FaceContext::Configuration(DetectMode detect_mode,
|
||||
return HERR_ARCHIVE_LOAD_FAILURE;
|
||||
}
|
||||
|
||||
m_face_track_ = std::make_shared<FaceTrack>(m_detect_mode_, m_max_detect_face_, 20, 192, detect_level_px, track_by_detect_mode_fps);
|
||||
m_face_track_ = std::make_shared<FaceTrack>(m_detect_mode_, m_max_detect_face_, 20, 192, detect_level_px,
|
||||
track_by_detect_mode_fps);
|
||||
m_face_track_->Configuration(INSPIRE_LAUNCH->getMArchive());
|
||||
// SetDetectMode(m_detect_mode_);
|
||||
|
||||
m_face_recognition_ = std::make_shared<FeatureExtraction>(INSPIRE_LAUNCH->getMArchive(), m_parameter_.enable_recognition);
|
||||
m_face_recognition_ =
|
||||
std::make_shared<FeatureExtraction>(INSPIRE_LAUNCH->getMArchive(), m_parameter_.enable_recognition);
|
||||
if (m_face_recognition_->QueryStatus() != HSUCCEED) {
|
||||
return m_face_recognition_->QueryStatus();
|
||||
}
|
||||
|
||||
m_face_pipeline_ = std::make_shared<FacePipeline>(
|
||||
INSPIRE_LAUNCH->getMArchive(),
|
||||
param.enable_liveness,
|
||||
param.enable_mask_detect,
|
||||
param.enable_face_attribute,
|
||||
param.enable_interaction_liveness
|
||||
);
|
||||
m_face_pipeline_ =
|
||||
std::make_shared<FacePipeline>(INSPIRE_LAUNCH->getMArchive(), param.enable_liveness, param.enable_mask_detect,
|
||||
param.enable_face_attribute, param.enable_interaction_liveness);
|
||||
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
|
||||
int32_t FaceContext::FaceDetectAndTrack(CameraStream &image) {
|
||||
int32_t FaceContext::FaceDetectAndTrack(CameraStream& image) {
|
||||
std::lock_guard<std::mutex> lock(m_mtx_);
|
||||
m_detect_cache_.clear();
|
||||
m_face_basic_data_cache_.clear();
|
||||
@@ -73,18 +66,20 @@ int32_t FaceContext::FaceDetectAndTrack(CameraStream &image) {
|
||||
m_quality_score_results_cache_.clear();
|
||||
m_attribute_race_results_cache_.clear();
|
||||
m_attribute_gender_results_cache_.clear();
|
||||
m_det_confidence_cache_.clear();
|
||||
if (m_face_track_ == nullptr) {
|
||||
return HERR_SESS_TRACKER_FAILURE;
|
||||
}
|
||||
m_face_track_->UpdateStream(image);
|
||||
for (int i = 0; i < m_face_track_->trackingFace.size(); ++i) {
|
||||
auto &face = m_face_track_->trackingFace[i];
|
||||
auto& face = m_face_track_->trackingFace[i];
|
||||
HyperFaceData data = FaceObjectToHyperFaceData(face, i);
|
||||
ByteArray byteArray;
|
||||
auto ret = SerializeHyperFaceData(data, byteArray);
|
||||
if (ret != HSUCCEED) {
|
||||
return HERR_INVALID_SERIALIZATION_FAILED;
|
||||
}
|
||||
m_det_confidence_cache_.push_back(face.GetConfidence());
|
||||
m_detect_cache_.push_back(byteArray);
|
||||
m_track_id_cache_.push_back(face.GetTrackingId());
|
||||
m_face_rects_cache_.push_back(data.rect);
|
||||
@@ -104,13 +99,12 @@ int32_t FaceContext::FaceDetectAndTrack(CameraStream &image) {
|
||||
// ptr face_basic
|
||||
m_face_basic_data_cache_.resize(m_face_track_->trackingFace.size());
|
||||
for (int i = 0; i < m_face_basic_data_cache_.size(); ++i) {
|
||||
auto &basic = m_face_basic_data_cache_[i];
|
||||
auto& basic = m_face_basic_data_cache_[i];
|
||||
basic.dataSize = m_detect_cache_[i].size();
|
||||
basic.data = m_detect_cache_[i].data();
|
||||
}
|
||||
|
||||
|
||||
// LOGD("Track COST: %f", m_face_track_->GetTrackTotalUseTime());
|
||||
// LOGD("Track COST: %f", m_face_track_->GetTrackTotalUseTime());
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
@@ -131,12 +125,12 @@ const std::shared_ptr<FacePipeline>& FaceContext::FacePipelineModule() {
|
||||
return m_face_pipeline_;
|
||||
}
|
||||
|
||||
|
||||
const int32_t FaceContext::GetNumberOfFacesCurrentlyDetected() const {
|
||||
return m_face_track_->trackingFace.size();
|
||||
}
|
||||
|
||||
int32_t FaceContext::FacesProcess(CameraStream &image, const std::vector<HyperFaceData> &faces, const CustomPipelineParameter ¶m) {
|
||||
int32_t FaceContext::FacesProcess(CameraStream& image, const std::vector<HyperFaceData>& faces,
|
||||
const CustomPipelineParameter& param) {
|
||||
std::lock_guard<std::mutex> lock(m_mtx_);
|
||||
m_mask_results_cache_.resize(faces.size(), -1.0f);
|
||||
m_rgb_liveness_results_cache_.resize(faces.size(), -1.0f);
|
||||
@@ -151,7 +145,7 @@ int32_t FaceContext::FacesProcess(CameraStream &image, const std::vector<HyperFa
|
||||
m_action_raise_head_results_cache_.resize(faces.size(), -1);
|
||||
m_action_shake_results_cache_.resize(faces.size(), -1);
|
||||
for (int i = 0; i < faces.size(); ++i) {
|
||||
const auto &face = faces[i];
|
||||
const auto& face = faces[i];
|
||||
// RGB Liveness Detect
|
||||
if (param.enable_liveness) {
|
||||
auto ret = m_face_pipeline_->Process(image, face, PROCESS_RGB_LIVENESS);
|
||||
@@ -189,14 +183,15 @@ int32_t FaceContext::FacesProcess(CameraStream &image, const std::vector<HyperFa
|
||||
m_react_left_eye_results_cache_[i] = m_face_pipeline_->eyesStatusCache[0];
|
||||
m_react_right_eye_results_cache_[i] = m_face_pipeline_->eyesStatusCache[1];
|
||||
// Special handling: ff it is a tracking state, it needs to be filtered
|
||||
if (face.trackState > 0)
|
||||
{
|
||||
if (face.trackState > 0) {
|
||||
auto idx = face.inGroupIndex;
|
||||
if (idx < m_face_track_->trackingFace.size()) {
|
||||
auto& target = m_face_track_->trackingFace[idx];
|
||||
if (target.GetTrackingId() == face.trackId) {
|
||||
auto new_eye_left = EmaFilter(m_face_pipeline_->eyesStatusCache[0], target.left_eye_status_, 8, 0.2f);
|
||||
auto new_eye_right = EmaFilter(m_face_pipeline_->eyesStatusCache[1], target.right_eye_status_, 8, 0.2f);
|
||||
auto new_eye_left =
|
||||
EmaFilter(m_face_pipeline_->eyesStatusCache[0], target.left_eye_status_, 8, 0.2f);
|
||||
auto new_eye_right =
|
||||
EmaFilter(m_face_pipeline_->eyesStatusCache[1], target.right_eye_status_, 8, 0.2f);
|
||||
if (face.trackState > 1) {
|
||||
// The filtered value can be obtained only in the tracking state
|
||||
m_react_left_eye_results_cache_[i] = new_eye_left;
|
||||
@@ -209,20 +204,22 @@ int32_t FaceContext::FacesProcess(CameraStream &image, const std::vector<HyperFa
|
||||
m_action_raise_head_results_cache_[i] = actions.raiseHead;
|
||||
m_action_shake_results_cache_[i] = actions.shake;
|
||||
} else {
|
||||
INSPIRE_LOGD("Serialized objects cannot connect to trace objects in memory, and there may be some problems");
|
||||
INSPIRE_LOGD(
|
||||
"Serialized objects cannot connect to trace objects in memory, and there may be some "
|
||||
"problems");
|
||||
}
|
||||
} else {
|
||||
INSPIRE_LOGW("The index of the trace object does not match the trace list in memory, and there may be some problems");
|
||||
INSPIRE_LOGW(
|
||||
"The index of the trace object does not match the trace list in memory, and there may be some "
|
||||
"problems");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<ByteArray>& FaceContext::GetDetectCache() const {
|
||||
return m_detect_cache_;
|
||||
}
|
||||
@@ -279,6 +276,10 @@ const Embedded& FaceContext::GetFaceFeatureCache() const {
|
||||
return m_face_feature_cache_;
|
||||
}
|
||||
|
||||
const std::vector<float>& FaceContext::GetDetConfidenceCache() const {
|
||||
return m_det_confidence_cache_;
|
||||
}
|
||||
|
||||
const std::vector<int>& FaceContext::GetFaceRaceResultsCache() const {
|
||||
return m_attribute_race_results_cache_;
|
||||
}
|
||||
@@ -311,11 +312,11 @@ const std::vector<int>& FaceContext::GetFaceRaiseHeadAactionsResultCache() const
|
||||
return m_action_raise_head_results_cache_;
|
||||
}
|
||||
|
||||
int32_t FaceContext::FaceFeatureExtract(CameraStream &image, FaceBasicData& data) {
|
||||
int32_t FaceContext::FaceFeatureExtract(CameraStream& image, FaceBasicData& data) {
|
||||
std::lock_guard<std::mutex> lock(m_mtx_);
|
||||
int32_t ret;
|
||||
HyperFaceData face = {0};
|
||||
ret = DeserializeHyperFaceData((char* )data.data, data.dataSize, face);
|
||||
ret = DeserializeHyperFaceData((char*)data.data, data.dataSize, face);
|
||||
if (ret != HSUCCEED) {
|
||||
return ret;
|
||||
}
|
||||
@@ -325,17 +326,15 @@ int32_t FaceContext::FaceFeatureExtract(CameraStream &image, FaceBasicData& data
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
const CustomPipelineParameter &FaceContext::getMParameter() const {
|
||||
const CustomPipelineParameter& FaceContext::getMParameter() const {
|
||||
return m_parameter_;
|
||||
}
|
||||
|
||||
|
||||
int32_t FaceContext::FaceQualityDetect(FaceBasicData& data, float &result) {
|
||||
int32_t FaceContext::FaceQualityDetect(FaceBasicData& data, float& result) {
|
||||
int32_t ret;
|
||||
HyperFaceData face = {0};
|
||||
ret = DeserializeHyperFaceData((char* )data.data, data.dataSize, face);
|
||||
// PrintHyperFaceData(face);
|
||||
ret = DeserializeHyperFaceData((char*)data.data, data.dataSize, face);
|
||||
// PrintHyperFaceData(face);
|
||||
if (ret != HSUCCEED) {
|
||||
return ret;
|
||||
}
|
||||
@@ -349,7 +348,6 @@ int32_t FaceContext::FaceQualityDetect(FaceBasicData& data, float &result) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int32_t FaceContext::SetDetectMode(DetectMode mode) {
|
||||
m_detect_mode_ = mode;
|
||||
if (m_detect_mode_ == DetectMode::DETECT_MODE_ALWAYS_DETECT) {
|
||||
@@ -370,4 +368,4 @@ int32_t FaceContext::SetTrackFaceMinimumSize(int32_t minSize) {
|
||||
return HSUCCEED;
|
||||
}
|
||||
|
||||
} // namespace hyper
|
||||
} // namespace inspire
|
||||
@@ -49,11 +49,11 @@ typedef struct CustomPipelineParameter {
|
||||
* @brief Manages the context for face detection, tracking, and feature extraction in the HyperFaceRepo project.
|
||||
*
|
||||
* Provides interfaces to configure face detection modes, manage face tracking, perform recognition,
|
||||
* and handle other face-related features. Integrates with various modules such as FaceTrack, FaceRecognition, and FacePipeline.
|
||||
* and handle other face-related features. Integrates with various modules such as FaceTrack, FaceRecognition, and
|
||||
* FacePipeline.
|
||||
*/
|
||||
class INSPIRE_API FaceContext {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor for the FaceContext class.
|
||||
*/
|
||||
@@ -67,10 +67,7 @@ public:
|
||||
* @param param Custom parameters for the face pipeline.
|
||||
* @return int32_t Returns 0 on success, non-zero for any error.
|
||||
*/
|
||||
int32_t Configuration(DetectMode detect_mode,
|
||||
int32_t max_detect_face,
|
||||
CustomPipelineParameter param,
|
||||
int32_t detect_level_px = -1,
|
||||
int32_t Configuration(DetectMode detect_mode, int32_t max_detect_face, CustomPipelineParameter param, int32_t detect_level_px = -1,
|
||||
int32_t track_by_detect_mode_fps = -1);
|
||||
|
||||
/**
|
||||
@@ -78,7 +75,7 @@ public:
|
||||
* @param image The camera stream to process for face detection and tracking.
|
||||
* @return int32_t Returns the number of faces detected and tracked.
|
||||
*/// Method for face detection and tracking
|
||||
int32_t FaceDetectAndTrack(CameraStream &image);
|
||||
int32_t FaceDetectAndTrack(CameraStream& image);
|
||||
|
||||
/**
|
||||
* @brief Set the threshold of face detection function, which only acts on the detection model
|
||||
@@ -100,7 +97,7 @@ public:
|
||||
* @param param Custom pipeline parameters.
|
||||
* @return int32_t Status code of the processing.
|
||||
*/
|
||||
int32_t FacesProcess(CameraStream &image, const std::vector<HyperFaceData> &faces, const CustomPipelineParameter& param);
|
||||
int32_t FacesProcess(CameraStream& image, const std::vector<HyperFaceData>& faces, const CustomPipelineParameter& param);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the face recognition module.
|
||||
@@ -126,13 +123,13 @@ public:
|
||||
* @param data FaceBasicData to store extracted features.
|
||||
* @return int32_t Status code of the feature extraction.
|
||||
*/
|
||||
int32_t FaceFeatureExtract(CameraStream &image, FaceBasicData& data);
|
||||
int32_t FaceFeatureExtract(CameraStream& image, FaceBasicData& data);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the custom pipeline parameters.
|
||||
* @return CustomPipelineParameter Current custom pipeline parameters.
|
||||
*/
|
||||
const CustomPipelineParameter &getMParameter() const;
|
||||
const CustomPipelineParameter& getMParameter() const;
|
||||
|
||||
/**
|
||||
* @brief Static method for detecting face quality.
|
||||
@@ -140,7 +137,7 @@ public:
|
||||
* @param result Float to store the face quality result.
|
||||
* @return int32_t Status code of the quality detection.
|
||||
*/
|
||||
static int32_t FaceQualityDetect(FaceBasicData& data, float &result);
|
||||
static int32_t FaceQualityDetect(FaceBasicData& data, float& result);
|
||||
|
||||
/**
|
||||
* @brief Sets the preview size for face tracking.
|
||||
@@ -201,7 +198,6 @@ public:
|
||||
*/
|
||||
const std::vector<float>& GetYawResultsCache() const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gets the cache of pitch results from face pose estimation.
|
||||
* @return A const reference to a vector containing pitch results.
|
||||
@@ -298,6 +294,11 @@ public:
|
||||
*/
|
||||
const Embedded& GetFaceFeatureCache() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the cache of face detection confidence.
|
||||
* @return A const reference to a vector containing face detection confidence.
|
||||
*/
|
||||
const std::vector<float>& GetDetConfidenceCache() const;
|
||||
|
||||
private:
|
||||
// Private member variables
|
||||
@@ -316,6 +317,7 @@ private:
|
||||
std::vector<FaceBasicData> m_face_basic_data_cache_; ///< Cache for basic face data extracted from detection
|
||||
std::vector<FaceRect> m_face_rects_cache_; ///< Cache for face rectangle data from detection
|
||||
std::vector<int32_t> m_track_id_cache_; ///< Cache for tracking IDs of detected faces
|
||||
std::vector<float> m_det_confidence_cache_; ///< Cache for face detection confidence of detected faces
|
||||
std::vector<float> m_roll_results_cache_; ///< Cache for storing roll results from face pose estimation
|
||||
std::vector<float> m_yaw_results_cache_; ///< Cache for storing yaw results from face pose estimation
|
||||
std::vector<float> m_pitch_results_cache_; ///< Cache for storing pitch results from face pose estimation
|
||||
@@ -338,9 +340,8 @@ private:
|
||||
Embedded m_face_feature_cache_; ///< Cache for current face feature data
|
||||
|
||||
std::mutex m_mtx_; ///< Mutex for thread safety.
|
||||
|
||||
};
|
||||
|
||||
} // namespace hyper
|
||||
} // namespace inspire
|
||||
|
||||
#endif //HYPERFACEREPO_FACE_CONTEXT_H
|
||||
#endif // HYPERFACEREPO_FACE_CONTEXT_H
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
|
||||
#define INSPIRE_FACE_VERSION_MAJOR_STR "1"
|
||||
#define INSPIRE_FACE_VERSION_MINOR_STR "1"
|
||||
#define INSPIRE_FACE_VERSION_PATCH_STR "6"
|
||||
#define INSPIRE_FACE_VERSION_PATCH_STR "7"
|
||||
|
||||
#endif //HYPERFACEREPO_INFORMATION_H
|
||||
|
||||
@@ -32,22 +32,21 @@
|
||||
#define INSPIRE_LOGF(...) inspire::LogManager::getInstance()->logStandard(inspire::ISF_LOG_FATAL, __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
|
||||
// Macro to set the global log level
|
||||
#define INSPIRE_SET_LOG_LEVEL(level) inspire::LogManager::getInstance()->setLogLevel(level)
|
||||
|
||||
namespace inspire {
|
||||
|
||||
// Log levels
|
||||
enum LogLevel {
|
||||
ISF_LOG_NONE = 0,
|
||||
ISF_LOG_DEBUG,
|
||||
ISF_LOG_INFO,
|
||||
ISF_LOG_WARN,
|
||||
ISF_LOG_ERROR,
|
||||
ISF_LOG_FATAL
|
||||
};
|
||||
enum LogLevel { ISF_LOG_NONE = 0, ISF_LOG_DEBUG, ISF_LOG_INFO, ISF_LOG_WARN, ISF_LOG_ERROR, ISF_LOG_FATAL };
|
||||
|
||||
/**
|
||||
* @class LogManager
|
||||
* @brief A singleton class for logging messages to the console or Android logcat.
|
||||
*
|
||||
* This class provides methods to log messages of different severity levels (DEBUG, INFO, WARN, ERROR, FATAL)
|
||||
* to the console or Android logcat based on the current log level setting.
|
||||
*/
|
||||
class INSPIRE_API LogManager {
|
||||
private:
|
||||
LogLevel currentLevel;
|
||||
@@ -84,16 +83,28 @@ public:
|
||||
#ifdef ANDROID
|
||||
// Method for logging on the Android platform
|
||||
void logAndroid(LogLevel level, const char* tag, const char* format, ...) const {
|
||||
if (currentLevel == ISF_LOG_NONE || level < currentLevel) return;
|
||||
if (currentLevel == ISF_LOG_NONE || level < currentLevel)
|
||||
return;
|
||||
|
||||
int androidLevel;
|
||||
switch (level) {
|
||||
case ISF_LOG_DEBUG: androidLevel = ANDROID_LOG_DEBUG; break;
|
||||
case ISF_LOG_INFO: androidLevel = ANDROID_LOG_INFO; break;
|
||||
case ISF_LOG_WARN: androidLevel = ANDROID_LOG_WARN; break;
|
||||
case ISF_LOG_ERROR: androidLevel = ANDROID_LOG_ERROR; break;
|
||||
case ISF_LOG_FATAL: androidLevel = ANDROID_LOG_FATAL; break;
|
||||
default: androidLevel = ANDROID_LOG_DEFAULT;
|
||||
case ISF_LOG_DEBUG:
|
||||
androidLevel = ANDROID_LOG_DEBUG;
|
||||
break;
|
||||
case ISF_LOG_INFO:
|
||||
androidLevel = ANDROID_LOG_INFO;
|
||||
break;
|
||||
case ISF_LOG_WARN:
|
||||
androidLevel = ANDROID_LOG_WARN;
|
||||
break;
|
||||
case ISF_LOG_ERROR:
|
||||
androidLevel = ANDROID_LOG_ERROR;
|
||||
break;
|
||||
case ISF_LOG_FATAL:
|
||||
androidLevel = ANDROID_LOG_FATAL;
|
||||
break;
|
||||
default:
|
||||
androidLevel = ANDROID_LOG_DEFAULT;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
@@ -105,7 +116,8 @@ public:
|
||||
// Method for standard platform logging
|
||||
void logStandard(LogLevel level, const char* filename, const char* function, int line, const char* format, ...) const {
|
||||
// Check whether the current level is LOG NONE or the log level is not enough to log
|
||||
if (currentLevel == ISF_LOG_NONE || level < currentLevel) return;
|
||||
if (currentLevel == ISF_LOG_NONE || level < currentLevel)
|
||||
return;
|
||||
|
||||
// Build log prefix dynamically based on available data
|
||||
bool hasPrintedPrefix = false;
|
||||
@@ -148,9 +160,7 @@ public:
|
||||
printf("\n"); // New line after log message
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace inspire
|
||||
|
||||
@@ -15,17 +15,13 @@
|
||||
|
||||
namespace inspire {
|
||||
|
||||
FaceTrack::FaceTrack(DetectMode mode,
|
||||
int max_detected_faces,
|
||||
int detection_interval,
|
||||
int track_preview_size,
|
||||
int dynamic_detection_input_level,
|
||||
int TbD_mode_fps) :
|
||||
m_mode_(mode),
|
||||
FaceTrack::FaceTrack(DetectMode mode, int max_detected_faces, int detection_interval,
|
||||
int track_preview_size, int dynamic_detection_input_level, int TbD_mode_fps)
|
||||
: m_mode_(mode),
|
||||
max_detected_faces_(max_detected_faces),
|
||||
detection_interval_(detection_interval),
|
||||
track_preview_size_(track_preview_size),
|
||||
m_dynamic_detection_input_level_(dynamic_detection_input_level){
|
||||
m_dynamic_detection_input_level_(dynamic_detection_input_level) {
|
||||
detection_index_ = -1;
|
||||
tracking_idx_ = 0;
|
||||
if (TbD_mode_fps < 0) {
|
||||
@@ -37,16 +33,17 @@ FaceTrack::FaceTrack(DetectMode mode,
|
||||
m_TbD_tracker_ = std::make_shared<BYTETracker>(TbD_mode_fps, 30);
|
||||
#else
|
||||
m_mode_ = DETECT_MODE_ALWAYS_DETECT;
|
||||
INSPIRE_LOGW("If you want to use tracking-by-detection in this release, you must turn on the option symbol ISF_ENABLE_TRACKING_BY_DETECTION at compile time");
|
||||
INSPIRE_LOGW(
|
||||
"If you want to use tracking-by-detection in this release, you must turn on the option "
|
||||
"symbol ISF_ENABLE_TRACKING_BY_DETECTION at compile time");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FaceTrack::SparseLandmarkPredict(const cv::Mat &raw_face_crop, std::vector<cv::Point2f> &landmarks_output,
|
||||
float &score, float size) {
|
||||
// LOGD("ready to landmark predict");
|
||||
void FaceTrack::SparseLandmarkPredict(const cv::Mat &raw_face_crop,
|
||||
std::vector<cv::Point2f> &landmarks_output, float &score,
|
||||
float size) {
|
||||
// LOGD("ready to landmark predict");
|
||||
landmarks_output.resize(FaceLandmark::NUM_OF_LANDMARK);
|
||||
std::vector<float> lmk_out = (*m_landmark_predictor_)(raw_face_crop);
|
||||
for (int i = 0; i < FaceLandmark::NUM_OF_LANDMARK; ++i) {
|
||||
@@ -56,17 +53,16 @@ void FaceTrack::SparseLandmarkPredict(const cv::Mat &raw_face_crop, std::vector<
|
||||
}
|
||||
score = (*m_refine_net_)(raw_face_crop);
|
||||
|
||||
// LOGD("predict ok ,score: %f", score);
|
||||
|
||||
// LOGD("predict ok ,score: %f", score);
|
||||
}
|
||||
|
||||
bool FaceTrack::TrackFace(CameraStream &image, FaceObject &face) {
|
||||
if (face.GetConfidence() < 0.1) {
|
||||
face.DisableTracking();
|
||||
// LOGD("flag disable TrackFace: %f", face.GetConfidence());
|
||||
// LOGD("flag disable TrackFace: %f", face.GetConfidence());
|
||||
return false;
|
||||
}
|
||||
// LOGD("start track one");
|
||||
// LOGD("start track one");
|
||||
cv::Mat affine;
|
||||
std::vector<cv::Point2f> landmark_back;
|
||||
|
||||
@@ -85,9 +81,7 @@ bool FaceTrack::TrackFace(CameraStream &image, FaceObject &face) {
|
||||
std::vector<cv::Point2f> camera_pts =
|
||||
ApplyTransformToPoints(rect_pts, rotation_mode_affine_inv);
|
||||
camera_pts.erase(camera_pts.end() - 1);
|
||||
std::vector<cv::Point2f> dst_pts = {{0, 0},
|
||||
{112, 0},
|
||||
{112, 112}};
|
||||
std::vector<cv::Point2f> dst_pts = {{0, 0}, {112, 0}, {112, 112}};
|
||||
assert(dst_pts.size() == camera_pts.size());
|
||||
affine = cv::getAffineTransform(camera_pts, dst_pts);
|
||||
// affine = GetRectSquareAffine(rect_square);
|
||||
@@ -95,22 +89,21 @@ bool FaceTrack::TrackFace(CameraStream &image, FaceObject &face) {
|
||||
}
|
||||
|
||||
affine = face.getTransMatrix();
|
||||
// cout << affine << endl;
|
||||
// cout << affine << endl;
|
||||
cv::Mat crop;
|
||||
// LOGD("get affine crop ok");
|
||||
double time1 = (double) cv::getTickCount();
|
||||
// LOGD("get affine crop ok");
|
||||
double time1 = (double)cv::getTickCount();
|
||||
crop = image.GetAffineRGBImage(affine, 112, 112);
|
||||
// cv::imshow("w", crop);
|
||||
// cv::waitKey(0);
|
||||
// cv::imshow("w", crop);
|
||||
// cv::waitKey(0);
|
||||
cv::Mat affine_inv;
|
||||
cv::invertAffineTransform(affine, affine_inv);
|
||||
double _diff =
|
||||
(((double) cv::getTickCount() - time1) / cv::getTickFrequency()) * 1000;
|
||||
// LOGD("affine cost %f", _diff);
|
||||
double _diff = (((double)cv::getTickCount() - time1) / cv::getTickFrequency()) * 1000;
|
||||
// LOGD("affine cost %f", _diff);
|
||||
|
||||
std::vector<cv::Point2f> landmark_rawout;
|
||||
std::vector<float> bbox;
|
||||
auto timeStart = (double) cv::getTickCount();
|
||||
auto timeStart = (double)cv::getTickCount();
|
||||
SparseLandmarkPredict(crop, landmark_rawout, score, 112);
|
||||
std::vector<cv::Point2f> lmk_5 = {landmark_rawout[FaceLandmark::LEFT_EYE_CENTER],
|
||||
landmark_rawout[FaceLandmark::RIGHT_EYE_CENTER],
|
||||
@@ -118,21 +111,17 @@ bool FaceTrack::TrackFace(CameraStream &image, FaceObject &face) {
|
||||
landmark_rawout[FaceLandmark::MOUTH_LEFT_CORNER],
|
||||
landmark_rawout[FaceLandmark::MOUTH_RIGHT_CORNER]};
|
||||
face.setAlignMeanSquareError(lmk_5);
|
||||
double nTime =
|
||||
(((double) cv::getTickCount() - timeStart) / cv::getTickFrequency()) *
|
||||
1000;
|
||||
// LOGD("sparse cost %f", nTime);
|
||||
double nTime = (((double)cv::getTickCount() - timeStart) / cv::getTickFrequency()) * 1000;
|
||||
// LOGD("sparse cost %f", nTime);
|
||||
|
||||
landmark_back.resize(landmark_rawout.size());
|
||||
landmark_back = ApplyTransformToPoints(landmark_rawout, affine_inv);
|
||||
int MODE = 1;
|
||||
|
||||
|
||||
if (MODE > 0) {
|
||||
if (face.TrackingState() == DETECT) {
|
||||
face.ReadyTracking();
|
||||
} else if (face.TrackingState() == READY ||
|
||||
face.TrackingState() == TRACKING) {
|
||||
} else if (face.TrackingState() == READY || face.TrackingState() == TRACKING) {
|
||||
cv::Mat trans_m(2, 3, CV_64F);
|
||||
cv::Mat tmp = face.getTransMatrix();
|
||||
std::vector<cv::Point2f> inside_points = landmark_rawout;
|
||||
@@ -162,24 +151,24 @@ bool FaceTrack::TrackFace(CameraStream &image, FaceObject &face) {
|
||||
SimilarityTransformEstimate(landmark_back, inside_points, trans_m);
|
||||
face.setTransMatrix(trans_m);
|
||||
face.EnableTracking();
|
||||
// LOGD("ready face TrackFace state %d ", face.TrackingState());
|
||||
// LOGD("ready face TrackFace state %d ", face.TrackingState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// realloc many times
|
||||
face.SetLandmark(landmark_back, true);
|
||||
|
||||
if (m_face_quality_ != nullptr) {
|
||||
// pose and quality - BUG
|
||||
auto rect = face.bbox_;
|
||||
// std::cout << rect << std::endl;
|
||||
auto affine_scale = ComputeCropMatrix(rect, FacePoseQuality::INPUT_WIDTH, FacePoseQuality::INPUT_HEIGHT);
|
||||
// std::cout << rect << std::endl;
|
||||
auto affine_scale =
|
||||
ComputeCropMatrix(rect, FacePoseQuality::INPUT_WIDTH, FacePoseQuality::INPUT_HEIGHT);
|
||||
affine_scale.convertTo(affine_scale, CV_64F);
|
||||
auto pre_crop = image.GetAffineRGBImage(affine_scale, FacePoseQuality::INPUT_WIDTH,
|
||||
FacePoseQuality::INPUT_HEIGHT);
|
||||
// cv::imshow("crop", crop);
|
||||
// cv::imshow("pre_crop", pre_crop);
|
||||
// cv::imshow("crop", crop);
|
||||
// cv::imshow("pre_crop", pre_crop);
|
||||
cv::Mat rotationMatrix;
|
||||
if (image.getRotationMode() != ROTATION_0) {
|
||||
cv::Point2f center(pre_crop.cols / 2.0, pre_crop.rows / 2.0);
|
||||
@@ -192,60 +181,61 @@ bool FaceTrack::TrackFace(CameraStream &image, FaceObject &face) {
|
||||
cv::Mat invRotationMatrix;
|
||||
cv::invertAffineTransform(rotationMatrix, invRotationMatrix);
|
||||
invRotationMatrix.convertTo(invRotationMatrix, CV_32F);
|
||||
for (auto &p: res.lmk) {
|
||||
for (auto &p : res.lmk) {
|
||||
cv::Vec3f tmp = {p.x, p.y, 1};
|
||||
cv::Mat result;
|
||||
cv::gemm(invRotationMatrix, tmp, 1.0, cv::Mat(), 0.0, result);
|
||||
p.x = result.at<float>(0);
|
||||
p.y = result.at<float>(1);
|
||||
// cv::circle(pre_crop, p, 0, cv::Scalar(0, 0, 255), 2);
|
||||
// cv::circle(pre_crop, p, 0, cv::Scalar(0, 0, 255), 2);
|
||||
}
|
||||
}
|
||||
|
||||
cv::Mat inv_affine_scale;
|
||||
cv::invertAffineTransform(affine_scale, inv_affine_scale);
|
||||
inv_affine_scale.convertTo(inv_affine_scale, CV_32F);
|
||||
for (auto &p: res.lmk) {
|
||||
for (auto &p : res.lmk) {
|
||||
cv::Vec3f tmp = {p.x, p.y, 1};
|
||||
cv::Mat result;
|
||||
cv::gemm(inv_affine_scale, tmp, 1.0, cv::Mat(), 0.0, result);
|
||||
p.x = result.at<float>(0);
|
||||
p.y = result.at<float>(1);
|
||||
// cv::circle(pre_crop, p, 0, cv::Scalar(0, 0, 255), 2);
|
||||
// cv::circle(pre_crop, p, 0, cv::Scalar(0, 0, 255), 2);
|
||||
}
|
||||
//
|
||||
// auto img = image.GetScaledImage(1.0f, true);
|
||||
// for (int i = 0; i < 5; ++i) {
|
||||
// auto &p = res.lmk[i];
|
||||
// cv::circle(img, p, 0, cv::Scalar(0, 0, 255), 5);
|
||||
// }
|
||||
// cv::imshow("AAAA", img);
|
||||
// cv::waitKey(0);
|
||||
//
|
||||
// auto img = image.GetScaledImage(1.0f, true);
|
||||
// for (int i = 0; i < 5; ++i) {
|
||||
// auto &p = res.lmk[i];
|
||||
// cv::circle(img, p, 0, cv::Scalar(0, 0, 255), 5);
|
||||
// }
|
||||
// cv::imshow("AAAA", img);
|
||||
// cv::waitKey(0);
|
||||
|
||||
|
||||
// cv::imshow("pre_crop_w", pre_crop);
|
||||
// cv::waitKey(0);
|
||||
// cv::imshow("pre_crop_w", pre_crop);
|
||||
// cv::waitKey(0);
|
||||
|
||||
face.high_result = res;
|
||||
}
|
||||
|
||||
// If the face is already tracked, replace the confidence with the tracking result
|
||||
if (face.TrackingState() == TRACKING) {
|
||||
face.SetConfidence(score);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FaceTrack::UpdateStream(CameraStream &image) {
|
||||
auto timeStart = (double) cv::getTickCount();
|
||||
auto timeStart = (double)cv::getTickCount();
|
||||
detection_index_ += 1;
|
||||
if (m_mode_ == DETECT_MODE_ALWAYS_DETECT || m_mode_ == DETECT_MODE_TRACK_BY_DETECT)
|
||||
trackingFace.clear();
|
||||
// LOGD("%d, %d", detection_index_, detection_interval_);
|
||||
if (detection_index_ % detection_interval_ == 0 || m_mode_ == DETECT_MODE_ALWAYS_DETECT || m_mode_ == DETECT_MODE_TRACK_BY_DETECT) {
|
||||
// Timer t_blacking;
|
||||
// LOGD("%d, %d", detection_index_, detection_interval_);
|
||||
if (detection_index_ % detection_interval_ == 0 || m_mode_ == DETECT_MODE_ALWAYS_DETECT ||
|
||||
m_mode_ == DETECT_MODE_TRACK_BY_DETECT) {
|
||||
// Timer t_blacking;
|
||||
image.SetPreviewSize(track_preview_size_);
|
||||
cv::Mat image_detect = image.GetPreviewImage(true);
|
||||
|
||||
|
||||
for (auto const &face: trackingFace) {
|
||||
for (auto const &face : trackingFace) {
|
||||
cv::Rect m_mask_rect = face.GetRectSquare();
|
||||
std::vector<cv::Point2f> pts = Rect2Points(m_mask_rect);
|
||||
cv::Mat rotation_mode_affine = image.GetAffineMatrix();
|
||||
@@ -256,13 +246,13 @@ void FaceTrack::UpdateStream(CameraStream &image) {
|
||||
cv::Rect mask_rect = cv::boundingRect(affine_pts);
|
||||
BlackingTrackingRegion(image_detect, mask_rect);
|
||||
}
|
||||
// LOGD("Blacking Cost %f", t_blacking.GetCostTimeUpdate());
|
||||
// LOGD("Blacking Cost %f", t_blacking.GetCostTimeUpdate());
|
||||
// do detection in thread
|
||||
// LOGD("detect scaled rows: %d cols: %d", image_detect.rows,
|
||||
// image_detect.cols);
|
||||
auto timeStart = (double) cv::getTickCount();
|
||||
// LOGD("detect scaled rows: %d cols: %d", image_detect.rows,
|
||||
// image_detect.cols);
|
||||
auto timeStart = (double)cv::getTickCount();
|
||||
DetectFace(image_detect, image.GetPreviewScale());
|
||||
det_use_time_ = ((double) cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
|
||||
det_use_time_ = ((double)cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
|
||||
}
|
||||
|
||||
if (!candidate_faces_.empty()) {
|
||||
@@ -282,9 +272,9 @@ void FaceTrack::UpdateStream(CameraStream &image) {
|
||||
}
|
||||
|
||||
nms();
|
||||
// LOGD("Track Cost %f", t_track.GetCostTimeUpdate());
|
||||
track_total_use_time_ = ((double) cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
|
||||
|
||||
// LOGD("Track Cost %f", t_track.GetCostTimeUpdate());
|
||||
track_total_use_time_ =
|
||||
((double)cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
|
||||
}
|
||||
|
||||
void FaceTrack::nms(float th) {
|
||||
@@ -325,7 +315,6 @@ void FaceTrack::nms(float th) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FaceTrack::BlackingTrackingRegion(cv::Mat &image, cv::Rect &rect_mask) {
|
||||
int height = image.rows;
|
||||
int width = image.cols;
|
||||
@@ -336,17 +325,16 @@ void FaceTrack::BlackingTrackingRegion(cv::Mat &image, cv::Rect &rect_mask) {
|
||||
|
||||
void FaceTrack::DetectFace(const cv::Mat &input, float scale) {
|
||||
std::vector<FaceLoc> boxes = (*m_face_detector_)(input);
|
||||
// for (auto box: boxes) {
|
||||
// cv::Rect r(cv::Point2f(box.x1, box.y1), cv::Point2f(box.x2, box.y2));
|
||||
// cv::rectangle(input, r, cv::Scalar(255, 0, 0), 3);
|
||||
// }
|
||||
// cv::imshow("w", input);
|
||||
// cv::waitKey(0);
|
||||
// for (auto box: boxes) {
|
||||
// cv::Rect r(cv::Point2f(box.x1, box.y1), cv::Point2f(box.x2, box.y2));
|
||||
// cv::rectangle(input, r, cv::Scalar(255, 0, 0), 3);
|
||||
// }
|
||||
// cv::imshow("w", input);
|
||||
// cv::waitKey(0);
|
||||
if (m_mode_ == DETECT_MODE_TRACK_BY_DETECT) {
|
||||
|
||||
#ifdef ISF_ENABLE_TRACKING_BY_DETECTION
|
||||
std::vector<Object> objects;
|
||||
auto num_of_effective = std::min(boxes.size(), (size_t )max_detected_faces_);
|
||||
auto num_of_effective = std::min(boxes.size(), (size_t)max_detected_faces_);
|
||||
for (size_t i = 0; i < num_of_effective; i++) {
|
||||
Object obj;
|
||||
const auto box = boxes[i];
|
||||
@@ -361,7 +349,8 @@ void FaceTrack::DetectFace(const cv::Mat &input, float scale) {
|
||||
}
|
||||
vector<STrack> output_stracks = m_TbD_tracker_->update(objects);
|
||||
for (const auto &st_track : output_stracks) {
|
||||
cv::Rect rect = cv::Rect_<float>(st_track.tlwh[0], st_track.tlwh[1], st_track.tlwh[2], st_track.tlwh[3]);
|
||||
cv::Rect rect = cv::Rect_<float>(st_track.tlwh[0], st_track.tlwh[1], st_track.tlwh[2],
|
||||
st_track.tlwh[3]);
|
||||
FaceObject faceinfo(st_track.track_id, rect, FaceLandmark::NUM_OF_LANDMARK);
|
||||
faceinfo.detect_bbox_ = rect;
|
||||
candidate_faces_.push_back(faceinfo);
|
||||
@@ -371,7 +360,8 @@ void FaceTrack::DetectFace(const cv::Mat &input, float scale) {
|
||||
std::vector<cv::Rect> bbox;
|
||||
bbox.resize(boxes.size());
|
||||
for (int i = 0; i < boxes.size(); i++) {
|
||||
bbox[i] = cv::Rect(cv::Point(static_cast<int>(boxes[i].x1), static_cast<int>(boxes[i].y1)),
|
||||
bbox[i] =
|
||||
cv::Rect(cv::Point(static_cast<int>(boxes[i].x1), static_cast<int>(boxes[i].y1)),
|
||||
cv::Point(static_cast<int>(boxes[i].x2), static_cast<int>(boxes[i].y2)));
|
||||
|
||||
if (!isShortestSideGreaterThan<float>(bbox[i], filter_minimum_face_px_size, scale)) {
|
||||
@@ -387,17 +377,16 @@ void FaceTrack::DetectFace(const cv::Mat &input, float scale) {
|
||||
|
||||
FaceObject faceinfo(tracking_idx_, bbox[i], FaceLandmark::NUM_OF_LANDMARK);
|
||||
faceinfo.detect_bbox_ = bbox[i];
|
||||
faceinfo.SetConfidence(boxes[i].score);
|
||||
|
||||
// Control that the number of faces detected does not exceed the maximum limit
|
||||
if (candidate_faces_.size() >= max_detected_faces_)
|
||||
{
|
||||
if (candidate_faces_.size() >= max_detected_faces_) {
|
||||
continue;
|
||||
}
|
||||
|
||||
candidate_faces_.push_back(faceinfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int FaceTrack::Configuration(inspire::InspireArchive &archive) {
|
||||
@@ -500,8 +489,7 @@ std::string FaceTrack::ChoiceMultiLevelDetectModel(const int32_t pixel_size) {
|
||||
const std::string scheme_names[] = {"face_detect_160", "face_detect_320", "face_detect_640"};
|
||||
const int32_t num_sizes = sizeof(supported_sizes) / sizeof(supported_sizes[0]);
|
||||
|
||||
if (pixel_size == -1)
|
||||
{
|
||||
if (pixel_size == -1) {
|
||||
return scheme_names[1];
|
||||
}
|
||||
|
||||
@@ -526,10 +514,12 @@ std::string FaceTrack::ChoiceMultiLevelDetectModel(const int32_t pixel_size) {
|
||||
}
|
||||
}
|
||||
|
||||
INSPIRE_LOGW("Input pixel size %d is not supported. Choosing the closest scheme: %s closest_scheme for size %d.",
|
||||
INSPIRE_LOGW(
|
||||
"Input pixel size %d is not supported. Choosing the closest scheme: %s closest_scheme for "
|
||||
"size %d.",
|
||||
pixel_size, closest_scheme.c_str(), closest_size);
|
||||
|
||||
return closest_scheme;
|
||||
}
|
||||
|
||||
} // namespace hyper
|
||||
} // namespace inspire
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
## Tracker Optional
|
||||
|
||||
### Tracking by Landmark
|
||||
|
||||
Tracking by Landmark is a basic tracking mode with high speed but average accuracy. It is recommended to be used in the portrait mode of the front camera of the mobile phone, which is suitable for the case of tracking 1-5 faces.
|
||||
|
||||
### Tracking by Detection
|
||||
|
||||
Tracking by Detection has high accuracy but slow speed. Currently, only bytetrack is implemented. Source code is in [DeepSORT](https://github.com/shaoshengsong/DeepSORT/tree/master/tracker/bytetrack/).
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
InspireFace Version: 1.1.6
|
||||
InspireFace Version: 1.1.7
|
||||
|
||||
@@ -49,8 +49,7 @@ int main(int argc, char* argv[]) {
|
||||
HInt32 detectPixelLevel = 160;
|
||||
// Handle of the current face SDK algorithm context
|
||||
HFSession session = {0};
|
||||
ret = HFCreateInspireFaceSessionOptional(option, detMode, maxDetectNum, detectPixelLevel, -1,
|
||||
&session);
|
||||
ret = HFCreateInspireFaceSessionOptional(option, detMode, maxDetectNum, detectPixelLevel, -1, &session);
|
||||
if (ret != HSUCCEED) {
|
||||
std::cout << "Create FaceContext error: " << ret << std::endl;
|
||||
return ret;
|
||||
@@ -115,9 +114,9 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << "========================================" << std::endl;
|
||||
std::cout << "Token size: " << multipleFaceData.tokens[index].size << std::endl;
|
||||
std::cout << "Process face index: " << index << std::endl;
|
||||
std::cout << "DetConfidence: " << multipleFaceData.detConfidence[index] << std::endl;
|
||||
// Use OpenCV's Rect to receive face bounding boxes
|
||||
auto rect =
|
||||
cv::Rect(multipleFaceData.rects[index].x, multipleFaceData.rects[index].y,
|
||||
auto rect = cv::Rect(multipleFaceData.rects[index].x, multipleFaceData.rects[index].y,
|
||||
multipleFaceData.rects[index].width, multipleFaceData.rects[index].height);
|
||||
cv::rectangle(draw, rect, cv::Scalar(0, 100, 255), 4);
|
||||
|
||||
@@ -126,15 +125,13 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Print Head euler angle, It can often be used to judge the quality of a face by the Angle
|
||||
// of the head
|
||||
std::cout << "Roll: " << multipleFaceData.angles.roll[index]
|
||||
<< ", Yaw: " << multipleFaceData.angles.yaw[index]
|
||||
std::cout << "Roll: " << multipleFaceData.angles.roll[index] << ", Yaw: " << multipleFaceData.angles.yaw[index]
|
||||
<< ", Pitch: " << multipleFaceData.angles.pitch[index] << std::endl;
|
||||
|
||||
HInt32 numOfLmk;
|
||||
HFGetNumOfFaceDenseLandmark(&numOfLmk);
|
||||
HPoint2f denseLandmarkPoints[numOfLmk];
|
||||
ret = HFGetFaceDenseLandmarkFromFaceToken(multipleFaceData.tokens[index],
|
||||
denseLandmarkPoints, numOfLmk);
|
||||
ret = HFGetFaceDenseLandmarkFromFaceToken(multipleFaceData.tokens[index], denseLandmarkPoints, numOfLmk);
|
||||
if (ret != HSUCCEED) {
|
||||
std::cerr << "HFGetFaceDenseLandmarkFromFaceToken error!!" << std::endl;
|
||||
return -1;
|
||||
@@ -154,8 +151,7 @@ int main(int argc, char* argv[]) {
|
||||
// when FaceContext is created!
|
||||
auto pipelineOption = HF_ENABLE_QUALITY | HF_ENABLE_MASK_DETECT | HF_ENABLE_LIVENESS;
|
||||
// In this loop, all faces are processed
|
||||
ret = HFMultipleFacePipelineProcessOptional(session, imageHandle, &multipleFaceData,
|
||||
pipelineOption);
|
||||
ret = HFMultipleFacePipelineProcessOptional(session, imageHandle, &multipleFaceData, pipelineOption);
|
||||
if (ret != HSUCCEED) {
|
||||
std::cout << "Execute Pipeline error: " << ret << std::endl;
|
||||
return ret;
|
||||
|
||||
@@ -2,9 +2,12 @@ cmake_minimum_required(VERSION 3.10)
|
||||
project(HyperFaceTest)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
# If you want to test the benchmark, you need to set this to ON
|
||||
option(ISF_ENABLE_BENCHMARK "Enable the benchmark test cases." ON)
|
||||
option(ISF_ENABLE_USE_LFW_DATA "Enable test cases for LFW data sets." ON)
|
||||
option(ISF_ENABLE_TEST_EVALUATION "Enable evaluation function test cases." ON)
|
||||
# If you want to test the LFW data set, you need to set this to ON
|
||||
option(ISF_ENABLE_USE_LFW_DATA "Enable test cases for LFW data sets." OFF)
|
||||
# If you want to test the evaluation function, you need to set this to ON, need LFW data set.
|
||||
option(ISF_ENABLE_TEST_EVALUATION "Enable evaluation function test cases." OFF)
|
||||
|
||||
if (ISF_ENABLE_BENCHMARK)
|
||||
add_definitions("-DISF_ENABLE_BENCHMARK")
|
||||
|
||||
@@ -7,35 +7,53 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @class Enviro
|
||||
* @brief A singleton class for managing environment-specific configurations.
|
||||
*
|
||||
* This class provides methods to set and get various environment-specific configurations
|
||||
* such as the resource pack name, test result directory, and runtime full path.
|
||||
*/
|
||||
class Enviro {
|
||||
public:
|
||||
static Enviro& getInstance() {
|
||||
static Enviro &getInstance() {
|
||||
static Enviro instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
Enviro(Enviro const&) = delete;
|
||||
void operator=(Enviro const&) = delete;
|
||||
Enviro(Enviro const &) = delete;
|
||||
void operator=(Enviro const &) = delete;
|
||||
|
||||
std::string getPackName() const { return packName; }
|
||||
std::string getPackName() const {
|
||||
return packName;
|
||||
}
|
||||
|
||||
void setPackName(const std::string& name) { packName = name; }
|
||||
void setPackName(const std::string &name) {
|
||||
packName = name;
|
||||
}
|
||||
|
||||
const std::string &getTestResDir() const { return testResDir; }
|
||||
const std::string &getTestResDir() const {
|
||||
return testResDir;
|
||||
}
|
||||
|
||||
void setTestResDir(const std::string &dir) { Enviro::testResDir = dir; }
|
||||
void setTestResDir(const std::string &dir) {
|
||||
Enviro::testResDir = dir;
|
||||
}
|
||||
|
||||
const std::string &getTestRuntimeFullPath() const { return runtimeFullPath; }
|
||||
const std::string &getTestRuntimeFullPath() const {
|
||||
return runtimeFullPath;
|
||||
}
|
||||
|
||||
void setTestRuntimeFullPath(const std::string &path) { Enviro::runtimeFullPath = path; }
|
||||
void setTestRuntimeFullPath(const std::string &path) {
|
||||
Enviro::runtimeFullPath = path;
|
||||
}
|
||||
|
||||
private:
|
||||
Enviro() {}
|
||||
|
||||
std::string packName = "Pikachu";
|
||||
std::string testResDir = "test_res";
|
||||
|
||||
std::string runtimeFullPath = "";
|
||||
std::string packName{"Pikachu"};
|
||||
std::string testResDir{"test_res"};
|
||||
std::string runtimeFullPath;
|
||||
};
|
||||
|
||||
#endif //INSPIREFACE_ENVIRO_H
|
||||
#endif // INSPIREFACE_ENVIRO_H
|
||||
|
||||
@@ -9,31 +9,56 @@
|
||||
#include <iostream>
|
||||
#include "enviro.h"
|
||||
|
||||
// Define the test model file
|
||||
#define TEST_MODEL_FILE Enviro::getInstance().getPackName()
|
||||
|
||||
#define TEST_MODEL_FILE Enviro::getInstance().getPackName() // Optional model file
|
||||
// Set the pack name
|
||||
#define SET_PACK_NAME(name) Enviro::getInstance().setPackName(name)
|
||||
|
||||
// Set the test directory
|
||||
#define SET_TEST_DIR(dir) Enviro::getInstance().setTestResDir(dir)
|
||||
// Set the runtime full path
|
||||
#define SET_RUNTIME_FULLPATH_NAME(name) Enviro::getInstance().setTestRuntimeFullPath(name)
|
||||
// Get the runtime full path
|
||||
#define GET_RUNTIME_FULLPATH_NAME Enviro::getInstance().getTestRuntimeFullPath()
|
||||
|
||||
#define TEST_LFW_FUNNELED_TXT "valid_lfw_funneled.txt" // LFW Index txt file
|
||||
#define LFW_FUNNELED_DIR "" // LFW funneled data dir
|
||||
// Define the LFW funneled index txt file
|
||||
#define TEST_LFW_FUNNELED_TXT "valid_lfw_funneled.txt"
|
||||
// Define the LFW funneled data directory
|
||||
#define LFW_FUNNELED_DIR ""
|
||||
// Define the LFW evaluation txt file
|
||||
#define TEST_LFW_EVALUATION_TXT "pairs.txt"
|
||||
// Define the benchmark record file
|
||||
#define TEST_BENCHMARK_RECORD "benchmark.csv"
|
||||
// Define the evaluation record file
|
||||
#define TEST_EVALUATION_RECORD "evaluation.csv"
|
||||
|
||||
using namespace Catch::Detail;
|
||||
|
||||
// Print test message
|
||||
#define TEST_PRINT(...) SPDLOG_LOGGER_CALL(spdlog::get("TEST"), spdlog::level::trace, __VA_ARGS__)
|
||||
// Print test message output
|
||||
#define TEST_PRINT_OUTPUT(open) TestMessageBroadcast test_msg_broadcast_##open(open)
|
||||
// Set the log output level
|
||||
#define LOG_OUTPUT_LEVEL(level) LogLevelBroadcast log_level_broadcast_##level(level);
|
||||
|
||||
// Get the test data directory
|
||||
#define GET_DIR getTestDataDir()
|
||||
// Get the test data
|
||||
#define GET_DATA(filename) getTestData(filename)
|
||||
// Get the test models file
|
||||
#define GET_MODEL_FILE() getTestModelsFile()
|
||||
// Get the LFW funneled index txt file
|
||||
#define GET_LFW_FUNNELED_TXT() getTestLFWFunneledTxt()
|
||||
|
||||
// Get the LFW funneled evaluation txt file
|
||||
#define GET_LFW_FUNNELED_EVA_TXT() getTestLFWFunneledEvaTxt()
|
||||
// Get the LFW funneled directory
|
||||
#define GET_LFW_FUNNELED_DIR() getLFWFunneledDir()
|
||||
// Get the benchmark record file
|
||||
#define GET_BENCHMARK_RECORD_FILE() getBenchmarkRecordFile()
|
||||
// Get the evaluation record file
|
||||
#define GET_SAVE_DIR getTestSaveDir()
|
||||
// Get the test save data
|
||||
#define GET_SAVE_DATA(filename) getTestSaveData(filename)
|
||||
|
||||
std::string getTestDataDir();
|
||||
@@ -87,14 +112,22 @@ public:
|
||||
spdlog::get("TEST")->set_level(m_old_level);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
spdlog::level::level_enum m_old_level;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @class LogLevelBroadcast
|
||||
* @brief A class for broadcasting log level changes.
|
||||
*
|
||||
* This class is used to set the log level for the logger.
|
||||
*/
|
||||
class LogLevelBroadcast {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor for LogLevelBroadcast.
|
||||
* @param level The log level to set.
|
||||
*/
|
||||
explicit LogLevelBroadcast(LOG_LEVEL level) {
|
||||
m_oldLevel = level;
|
||||
spdlog::set_level(spdlog::level::level_enum(level));
|
||||
@@ -108,18 +141,12 @@ private:
|
||||
LOG_LEVEL m_oldLevel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct test_case_split {
|
||||
~test_case_split() {
|
||||
std::cout
|
||||
<< "==============================================================================="
|
||||
<< std::endl;
|
||||
std::cout << "===============================================================================" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
#define DRAW_SPLIT_LINE test_case_split split_line_x;
|
||||
|
||||
};
|
||||
|
||||
#endif //BIGGUYSMAIN_TEST_SETTINGS_H
|
||||
#endif // BIGGUYSMAIN_TEST_SETTINGS_H
|
||||
|
||||
@@ -58,8 +58,7 @@ int main(int argc, char* argv[]) {
|
||||
std::string packPath;
|
||||
|
||||
// Add command line options
|
||||
auto cli =
|
||||
session.cli() | Catch::clara::Opt(pack, "value")["--pack"]("Resource pack filename") |
|
||||
auto cli = session.cli() | Catch::clara::Opt(pack, "value")["--pack"]("Resource pack filename") |
|
||||
Catch::clara::Opt(testDir, "value")["--test_dir"]("Test dir resource") |
|
||||
Catch::clara::Opt(packPath, "value")["--pack_path"]("The specified path to the pack file");
|
||||
|
||||
@@ -105,8 +104,14 @@ int main(int argc, char* argv[]) {
|
||||
// Set log level
|
||||
HFSetLogLevel(HF_LOG_INFO);
|
||||
|
||||
// Run the test
|
||||
ret = session.run();
|
||||
|
||||
// Terminate the InspireFace instance
|
||||
HFTerminateInspireFace();
|
||||
|
||||
// Show resource statistics
|
||||
HFDeBugShowResourceStatistics();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "unit/test_helper/test_help.h"
|
||||
#include "unit/test_helper/test_tools.h"
|
||||
|
||||
|
||||
TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
DRAW_SPLIT_LINE
|
||||
TEST_PRINT_OUTPUT(true);
|
||||
@@ -67,7 +66,6 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
|
||||
SECTION("Face tracking stability from frames") {
|
||||
@@ -92,7 +90,7 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
// CHECK(multipleFaceData.detectedNum == 1);
|
||||
// CHECK(multipleFaceData.detectedNum == 1);
|
||||
if (multipleFaceData.detectedNum != 1) {
|
||||
count_loss++;
|
||||
continue;
|
||||
@@ -103,7 +101,7 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
std::string save = GET_SAVE_DATA("data/video_frames") + "/" + std::to_string(i) + ".jpg";
|
||||
cv::imwrite(save, image);
|
||||
auto id = multipleFaceData.trackIds[0];
|
||||
// TEST_PRINT("{}", id);
|
||||
// TEST_PRINT("{}", id);
|
||||
if (id != expectedId) {
|
||||
count_loss++;
|
||||
}
|
||||
@@ -111,9 +109,9 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
ret = HFReleaseImageStream(imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
float loss = (float )count_loss / filenames.size();
|
||||
float loss = (float)count_loss / filenames.size();
|
||||
// The face track loss is allowed to have an error of 5%
|
||||
// CHECK(loss == Approx(0.0f).epsilon(0.05));
|
||||
// CHECK(loss == Approx(0.0f).epsilon(0.05));
|
||||
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
@@ -220,7 +218,6 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
// finish
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
|
||||
#ifdef ISF_ENABLE_BENCHMARK
|
||||
@@ -243,11 +240,11 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
auto start = (double) cv::getTickCount();
|
||||
auto start = (double)cv::getTickCount();
|
||||
for (int i = 0; i < loop; ++i) {
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
}
|
||||
auto cost = ((double) cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
auto cost = ((double)cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(multipleFaceData.detectedNum == 1);
|
||||
TEST_PRINT("<Benchmark> Face Detect@160 -> Loop: {}, Total Time: {:.5f}ms, Average Time: {:.5f}ms", loop, cost, cost / loop);
|
||||
@@ -258,7 +255,6 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
|
||||
SECTION("Face detection benchmark@320") {
|
||||
@@ -280,11 +276,11 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
auto start = (double) cv::getTickCount();
|
||||
auto start = (double)cv::getTickCount();
|
||||
for (int i = 0; i < loop; ++i) {
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
}
|
||||
auto cost = ((double) cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
auto cost = ((double)cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(multipleFaceData.detectedNum == 1);
|
||||
TEST_PRINT("<Benchmark> Face Detect@320 -> Loop: {}, Total Time: {:.5f}ms, Average Time: {:.5f}ms", loop, cost, cost / loop);
|
||||
@@ -295,10 +291,8 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTION("Face detection benchmark@640") {
|
||||
int loop = 1000;
|
||||
HResult ret;
|
||||
@@ -318,11 +312,11 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
auto start = (double) cv::getTickCount();
|
||||
auto start = (double)cv::getTickCount();
|
||||
for (int i = 0; i < loop; ++i) {
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
}
|
||||
auto cost = ((double) cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
auto cost = ((double)cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(multipleFaceData.detectedNum == 1);
|
||||
TEST_PRINT("<Benchmark> Face Detect@640 -> Loop: {}, Total Time: {:.5f}ms, Average Time: {:.5f}ms", loop, cost, cost / loop);
|
||||
@@ -333,7 +327,6 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
#else
|
||||
TEST_PRINT("Skip the face detection benchmark test. To run it, you need to turn on the benchmark test.");
|
||||
@@ -359,11 +352,11 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
// Case: Execute the benchmark using the VIDEO mode(Track)
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
auto start = (double) cv::getTickCount();
|
||||
auto start = (double)cv::getTickCount();
|
||||
for (int i = 0; i < loop; ++i) {
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
}
|
||||
auto cost = ((double) cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
auto cost = ((double)cv::getTickCount() - start) / cv::getTickFrequency() * 1000;
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(multipleFaceData.detectedNum > 0);
|
||||
TEST_PRINT("<Benchmark> Face Track -> Loop: {}, Total Time: {:.5f}ms, Average Time: {:.5f}ms", loop, cost, cost / loop);
|
||||
@@ -377,9 +370,7 @@ TEST_CASE("test_FaceTrack", "[face_track]") {
|
||||
#else
|
||||
TEST_PRINT("Skip the face light track benchmark test. To run it, you need to turn on the benchmark test.");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("test_MultipleLevelFaceDetect", "[face_detect]") {
|
||||
@@ -481,8 +472,6 @@ TEST_CASE("test_MultipleLevelFaceDetect", "[face_detect]") {
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("test_FaceShowLandmark", "[face_landmark]") {
|
||||
@@ -505,8 +494,7 @@ TEST_CASE("test_FaceShowLandmark", "[face_landmark]") {
|
||||
HFSessionSetTrackPreviewSize(session, detectPixelLevel);
|
||||
HFSessionSetFilterMinimumFacePixelSize(session, 0);
|
||||
|
||||
for (size_t i = 0; i < images_path.size(); i++)
|
||||
{
|
||||
for (size_t i = 0; i < images_path.size(); i++) {
|
||||
HFImageStream imgHandle;
|
||||
auto image = cv::imread(images_path[i]);
|
||||
ret = CVImageToImageStream(image, imgHandle);
|
||||
@@ -519,7 +507,6 @@ TEST_CASE("test_FaceShowLandmark", "[face_landmark]") {
|
||||
|
||||
REQUIRE(multipleFaceData.detectedNum > 0);
|
||||
|
||||
|
||||
HInt32 numOfLmk;
|
||||
HFGetNumOfFaceDenseLandmark(&numOfLmk);
|
||||
HPoint2f denseLandmarkPoints[numOfLmk];
|
||||
@@ -534,9 +521,111 @@ TEST_CASE("test_FaceShowLandmark", "[face_landmark]") {
|
||||
|
||||
ret = HFReleaseImageStream(imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("test_FaceDetectConfidence", "[face_track]") {
|
||||
DRAW_SPLIT_LINE
|
||||
TEST_PRINT_OUTPUT(true);
|
||||
|
||||
SECTION("DetectConfidenceSchedule-1") {
|
||||
// Schedule 1:
|
||||
HFloat threshold = 0.4f;
|
||||
HInt32 detectPixelLevel = 160;
|
||||
HInt32 maxDetectNum = 20;
|
||||
|
||||
HResult ret;
|
||||
HFSessionCustomParameter parameter = {0};
|
||||
HFDetectMode detMode = HF_DETECT_MODE_ALWAYS_DETECT;
|
||||
HFSession session;
|
||||
ret = HFCreateInspireFaceSession(parameter, detMode, maxDetectNum, detectPixelLevel, -1, &session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
ret = HFSessionSetFaceDetectThreshold(session, threshold);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
// Prepare an image
|
||||
HFImageStream imgHandle;
|
||||
auto image = cv::imread(GET_DATA("data/bulk/pedestrian.png"));
|
||||
ret = CVImageToImageStream(image, imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
// Extract basic face information from photos
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
for (int i = 0; i < multipleFaceData.detectedNum; i++) {
|
||||
CHECK(multipleFaceData.detConfidence[i] >= threshold);
|
||||
}
|
||||
ret = HFReleaseImageStream(imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
SECTION("DetectConfidenceSchedule-2") {
|
||||
// Schedule 2:
|
||||
HFloat threshold = 0.7f;
|
||||
HInt32 detectPixelLevel = 320;
|
||||
HInt32 maxDetectNum = 10;
|
||||
|
||||
HResult ret;
|
||||
HFSessionCustomParameter parameter = {0};
|
||||
HFDetectMode detMode = HF_DETECT_MODE_ALWAYS_DETECT;
|
||||
HFSession session;
|
||||
ret = HFCreateInspireFaceSession(parameter, detMode, maxDetectNum, detectPixelLevel, -1, &session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
ret = HFSessionSetFaceDetectThreshold(session, threshold);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
// Prepare an image
|
||||
HFImageStream imgHandle;
|
||||
auto image = cv::imread(GET_DATA("data/bulk/pedestrian.png"));
|
||||
ret = CVImageToImageStream(image, imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
// Extract basic face information from photos
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
for (int i = 0; i < multipleFaceData.detectedNum; i++) {
|
||||
CHECK(multipleFaceData.detConfidence[i] >= threshold);
|
||||
}
|
||||
ret = HFReleaseImageStream(imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
SECTION("DetectConfidenceSchedule-3") {
|
||||
// Schedule 3:
|
||||
HFloat threshold = 0.80f;
|
||||
HInt32 detectPixelLevel = 640;
|
||||
HInt32 maxDetectNum = 20;
|
||||
|
||||
HResult ret;
|
||||
HFSessionCustomParameter parameter = {0};
|
||||
HFDetectMode detMode = HF_DETECT_MODE_ALWAYS_DETECT;
|
||||
HFSession session;
|
||||
ret = HFCreateInspireFaceSession(parameter, detMode, maxDetectNum, detectPixelLevel, -1, &session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
ret = HFSessionSetFaceDetectThreshold(session, threshold);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
// Prepare an image
|
||||
HFImageStream imgHandle;
|
||||
auto image = cv::imread(GET_DATA("data/bulk/pedestrian.png"));
|
||||
ret = CVImageToImageStream(image, imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
// Extract basic face information from photos
|
||||
HFMultipleFaceData multipleFaceData = {0};
|
||||
ret = HFExecuteFaceTrack(session, imgHandle, &multipleFaceData);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
for (int i = 0; i < multipleFaceData.detectedNum; i++) {
|
||||
CHECK(multipleFaceData.detConfidence[i] >= threshold);
|
||||
}
|
||||
ret = HFReleaseImageStream(imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
ret = HFReleaseInspireFaceSession(session);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "settings/test_settings.h"
|
||||
#include "inspireface/c_api/inspireface.h"
|
||||
#include "inspireface/herror.h"
|
||||
#include "opencv2/opencv.hpp"
|
||||
#include "unit/test_helper/test_tools.h"
|
||||
#include <cstdio>
|
||||
|
||||
TEST_CASE("test_System", "[system]") {
|
||||
@@ -38,3 +40,229 @@ TEST_CASE("test_System", "[system]") {
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("test_SystemSessionReleaseCase", "[system]") {
|
||||
/**
|
||||
* @brief Test the release of sessions
|
||||
* @details Test the release of sessions and check the unreleased sessions count
|
||||
*/
|
||||
DRAW_SPLIT_LINE
|
||||
TEST_PRINT_OUTPUT(true);
|
||||
HResult ret;
|
||||
|
||||
SECTION("CreateSessions") {
|
||||
/**
|
||||
* @brief Create sessions
|
||||
* @details Create 10 sessions and check the unreleased sessions count
|
||||
*/
|
||||
HInt32 count;
|
||||
ret = HFDeBugGetUnreleasedSessionsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 0);
|
||||
|
||||
HInt32 createCount = 10;
|
||||
HFSession sessions[createCount];
|
||||
|
||||
for (int i = 0; i < createCount; ++i) {
|
||||
ret = HFCreateInspireFaceSessionOptional(HF_ENABLE_NONE, HF_DETECT_MODE_ALWAYS_DETECT, 3, -1, -1, &sessions[i]);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
ret = HFDeBugGetUnreleasedSessionsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == createCount);
|
||||
|
||||
HFSession sessionsGet[createCount];
|
||||
ret = HFDeBugGetUnreleasedSessions(sessionsGet, createCount);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
// The session list obtained from the api is also unordered because it is sorted internally using an unordered dictionary
|
||||
for (int i = 0; i < createCount; ++i) {
|
||||
bool found = false;
|
||||
for (int j = 0; j < createCount; ++j) {
|
||||
if (sessions[i] == sessionsGet[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
REQUIRE(found);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("ReleaseSomeSessions") {
|
||||
/**
|
||||
* @brief Release some sessions
|
||||
* @details Release some sessions and check the unreleased sessions count
|
||||
*/
|
||||
HInt32 count;
|
||||
ret = HFDeBugGetUnreleasedSessionsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 10);
|
||||
auto createCount = count;
|
||||
|
||||
HFSession sessionsGet[createCount];
|
||||
ret = HFDeBugGetUnreleasedSessions(sessionsGet, createCount);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
std::vector<int32_t> releaseIndex = {0, 2, 4, 6, 8};
|
||||
for (int i = 0; i < releaseIndex.size(); ++i) {
|
||||
ret = HFReleaseInspireFaceSession(sessionsGet[releaseIndex[i]]);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
ret = HFDeBugGetUnreleasedSessionsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == createCount - releaseIndex.size());
|
||||
|
||||
HFSession sessionsGet2[count];
|
||||
ret = HFDeBugGetUnreleasedSessions(sessionsGet2, count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
bool found = false;
|
||||
for (int j = 0; j < releaseIndex.size(); ++j) {
|
||||
if (sessionsGet2[i] == sessionsGet[releaseIndex[j]]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
REQUIRE(!found);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("ReleaseAllSessions") {
|
||||
/**
|
||||
* @brief Release all sessions
|
||||
* @details Release all sessions and check the unreleased sessions count
|
||||
*/
|
||||
HInt32 count;
|
||||
ret = HFDeBugGetUnreleasedSessionsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 5);
|
||||
|
||||
HFSession sessionsGet[count];
|
||||
ret = HFDeBugGetUnreleasedSessions(sessionsGet, count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
ret = HFReleaseInspireFaceSession(sessionsGet[i]);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
ret = HFDeBugGetUnreleasedSessionsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("test_SystemStreamReleaseCase", "[system]") {
|
||||
/**
|
||||
* @brief Test the release of streams
|
||||
* @details Test the release of streams and check the unreleased streams count
|
||||
*/
|
||||
DRAW_SPLIT_LINE
|
||||
TEST_PRINT_OUTPUT(true);
|
||||
HResult ret;
|
||||
|
||||
SECTION("CreateStreams") {
|
||||
/**
|
||||
* @brief Create streams
|
||||
* @details Create 10 streams and check the unreleased streams count
|
||||
*/
|
||||
HInt32 count;
|
||||
ret = HFDeBugGetUnreleasedStreamsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 0);
|
||||
|
||||
HInt32 createCount = 10;
|
||||
HFImageStream streams[createCount];
|
||||
|
||||
for (int i = 0; i < createCount; ++i) {
|
||||
HFImageStream imgHandle;
|
||||
auto image = cv::imread(GET_DATA("data/bulk/pedestrian.png"));
|
||||
ret = CVImageToImageStream(image, imgHandle);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
streams[i] = imgHandle;
|
||||
}
|
||||
|
||||
ret = HFDeBugGetUnreleasedStreamsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == createCount);
|
||||
|
||||
HFImageStream streamsGet[createCount];
|
||||
ret = HFDeBugGetUnreleasedStreams(streamsGet, createCount);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
for (int i = 0; i < createCount; ++i) {
|
||||
bool found = false;
|
||||
for (int j = 0; j < createCount; ++j) {
|
||||
if (streams[i] == streamsGet[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
REQUIRE(found);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("ReleaseSomeStreams") {
|
||||
/**
|
||||
* @brief Release some streams
|
||||
* @details Release some streams and check the unreleased streams count
|
||||
*/
|
||||
HInt32 count;
|
||||
ret = HFDeBugGetUnreleasedStreamsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 10);
|
||||
auto createCount = count;
|
||||
|
||||
HFImageStream streamsGet[count];
|
||||
ret = HFDeBugGetUnreleasedStreams(streamsGet, count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
std::vector<int32_t> releaseIndex = {0, 2, 4, 6, 8};
|
||||
for (int i = 0; i < releaseIndex.size(); ++i) {
|
||||
ret = HFReleaseImageStream(streamsGet[releaseIndex[i]]);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
ret = HFDeBugGetUnreleasedStreamsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == createCount - releaseIndex.size());
|
||||
|
||||
HFImageStream streamsGet2[count];
|
||||
ret = HFDeBugGetUnreleasedStreams(streamsGet2, count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
bool found = false;
|
||||
for (int j = 0; j < releaseIndex.size(); ++j) {
|
||||
if (streamsGet2[i] == streamsGet[releaseIndex[j]]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
REQUIRE(!found);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("ReleaseAllStreams") {
|
||||
/**
|
||||
* @brief Release all streams
|
||||
* @details Release all streams and check the unreleased streams count
|
||||
*/
|
||||
HInt32 count;
|
||||
ret = HFDeBugGetUnreleasedStreamsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 5);
|
||||
|
||||
HFImageStream streamsGet[count];
|
||||
ret = HFDeBugGetUnreleasedStreams(streamsGet, count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
ret = HFReleaseImageStream(streamsGet[i]);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
}
|
||||
|
||||
ret = HFDeBugGetUnreleasedStreamsCount(&count);
|
||||
REQUIRE(ret == HSUCCEED);
|
||||
REQUIRE(count == 0);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,8 @@ draw = image.copy()
|
||||
for idx, face in enumerate(faces):
|
||||
print(f"{'==' * 20}")
|
||||
print(f"idx: {idx}")
|
||||
# Print detection confidence.
|
||||
print(f"detection confidence: {face.detection_confidence}")
|
||||
# Print Euler angles of the face.
|
||||
print(f"roll: {face.roll}, yaw: {face.yaw}, pitch: {face.pitch}")
|
||||
# Draw bounding box around the detected face.
|
||||
|
||||
@@ -3,5 +3,4 @@ from .inspire_face import ImageStream, FaceExtended, FaceInformation, SessionCus
|
||||
FaceIdentity, feature_hub_set_search_threshold, feature_hub_face_insert, SearchResult, \
|
||||
feature_hub_face_search, feature_hub_face_search_top_k, feature_hub_face_update, feature_hub_face_remove, \
|
||||
feature_hub_get_face_identity, feature_hub_get_face_count, view_table_in_terminal, version, \
|
||||
set_logging_level, disable_logging
|
||||
|
||||
set_logging_level, disable_logging, show_system_resource_statistics
|
||||
@@ -875,6 +875,8 @@ _libs[_LIBRARY_FILENAME] = load_library(_LIBRARY_FILENAME)
|
||||
|
||||
# No modules
|
||||
|
||||
uint8_t = c_ubyte# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types/_uint8_t.h: 31
|
||||
|
||||
HPVoid = POINTER(None)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/intypedef.h: 8
|
||||
|
||||
HFImageStream = POINTER(None)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/intypedef.h: 9
|
||||
@@ -933,35 +935,35 @@ struct_HPoint2f._fields_ = [
|
||||
|
||||
HPoint2f = struct_HPoint2f# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/intypedef.h: 37
|
||||
|
||||
enum_HFImageFormat = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
enum_HFImageFormat = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HF_STREAM_RGB = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HF_STREAM_RGB = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HF_STREAM_BGR = 1# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HF_STREAM_BGR = 1# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HF_STREAM_RGBA = 2# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HF_STREAM_RGBA = 2# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HF_STREAM_BGRA = 3# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HF_STREAM_BGRA = 3# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HF_STREAM_YUV_NV12 = 4# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HF_STREAM_YUV_NV12 = 4# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HF_STREAM_YUV_NV21 = 5# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HF_STREAM_YUV_NV21 = 5# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
HFImageFormat = enum_HFImageFormat# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
HFImageFormat = enum_HFImageFormat# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 47
|
||||
|
||||
enum_HFRotation = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 61
|
||||
enum_HFRotation = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 58
|
||||
|
||||
HF_CAMERA_ROTATION_0 = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 61
|
||||
HF_CAMERA_ROTATION_0 = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 58
|
||||
|
||||
HF_CAMERA_ROTATION_90 = 1# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 61
|
||||
HF_CAMERA_ROTATION_90 = 1# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 58
|
||||
|
||||
HF_CAMERA_ROTATION_180 = 2# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 61
|
||||
HF_CAMERA_ROTATION_180 = 2# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 58
|
||||
|
||||
HF_CAMERA_ROTATION_270 = 3# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 61
|
||||
HF_CAMERA_ROTATION_270 = 3# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 58
|
||||
|
||||
HFRotation = enum_HFRotation# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 61
|
||||
HFRotation = enum_HFRotation# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 58
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 74
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 70
|
||||
class struct_HFImageData(Structure):
|
||||
pass
|
||||
|
||||
@@ -973,36 +975,42 @@ struct_HFImageData.__slots__ = [
|
||||
'rotation',
|
||||
]
|
||||
struct_HFImageData._fields_ = [
|
||||
('data', POINTER(c_uint8)),
|
||||
('data', POINTER(uint8_t)),
|
||||
('width', HInt32),
|
||||
('height', HInt32),
|
||||
('format', HFImageFormat),
|
||||
('rotation', HFRotation),
|
||||
]
|
||||
|
||||
HFImageData = struct_HFImageData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 74
|
||||
HFImageData = struct_HFImageData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 70
|
||||
|
||||
PHFImageData = POINTER(struct_HFImageData)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 74
|
||||
PHFImageData = POINTER(struct_HFImageData)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 70
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 86
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 81
|
||||
if _libs[_LIBRARY_FILENAME].has("HFCreateImageStream", "cdecl"):
|
||||
HFCreateImageStream = _libs[_LIBRARY_FILENAME].get("HFCreateImageStream", "cdecl")
|
||||
HFCreateImageStream.argtypes = [PHFImageData, POINTER(HFImageStream)]
|
||||
HFCreateImageStream.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 97
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 91
|
||||
if _libs[_LIBRARY_FILENAME].has("HFReleaseImageStream", "cdecl"):
|
||||
HFReleaseImageStream = _libs[_LIBRARY_FILENAME].get("HFReleaseImageStream", "cdecl")
|
||||
HFReleaseImageStream.argtypes = [HFImageStream]
|
||||
HFReleaseImageStream.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 110
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 105
|
||||
if _libs[_LIBRARY_FILENAME].has("HFLaunchInspireFace", "cdecl"):
|
||||
HFLaunchInspireFace = _libs[_LIBRARY_FILENAME].get("HFLaunchInspireFace", "cdecl")
|
||||
HFLaunchInspireFace.argtypes = [HPath]
|
||||
HFLaunchInspireFace.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 131
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 113
|
||||
if _libs[_LIBRARY_FILENAME].has("HFTerminateInspireFace", "cdecl"):
|
||||
HFTerminateInspireFace = _libs[_LIBRARY_FILENAME].get("HFTerminateInspireFace", "cdecl")
|
||||
HFTerminateInspireFace.argtypes = []
|
||||
HFTerminateInspireFace.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 134
|
||||
class struct_HFSessionCustomParameter(Structure):
|
||||
pass
|
||||
|
||||
@@ -1025,39 +1033,39 @@ struct_HFSessionCustomParameter._fields_ = [
|
||||
('enable_interaction_liveness', HInt32),
|
||||
]
|
||||
|
||||
HFSessionCustomParameter = struct_HFSessionCustomParameter# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 131
|
||||
HFSessionCustomParameter = struct_HFSessionCustomParameter# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 134
|
||||
|
||||
PHFSessionCustomParameter = POINTER(struct_HFSessionCustomParameter)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 131
|
||||
PHFSessionCustomParameter = POINTER(struct_HFSessionCustomParameter)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 134
|
||||
|
||||
enum_HFDetectMode = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 142
|
||||
enum_HFDetectMode = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 147
|
||||
|
||||
HF_DETECT_MODE_ALWAYS_DETECT = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 142
|
||||
HF_DETECT_MODE_ALWAYS_DETECT = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 147
|
||||
|
||||
HF_DETECT_MODE_LIGHT_TRACK = (HF_DETECT_MODE_ALWAYS_DETECT + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 142
|
||||
HF_DETECT_MODE_LIGHT_TRACK = (HF_DETECT_MODE_ALWAYS_DETECT + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 147
|
||||
|
||||
HF_DETECT_MODE_TRACK_BY_DETECTION = (HF_DETECT_MODE_LIGHT_TRACK + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 142
|
||||
HF_DETECT_MODE_TRACK_BY_DETECTION = (HF_DETECT_MODE_LIGHT_TRACK + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 147
|
||||
|
||||
HFDetectMode = enum_HFDetectMode# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 142
|
||||
HFDetectMode = enum_HFDetectMode# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 147
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 157
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 163
|
||||
if _libs[_LIBRARY_FILENAME].has("HFCreateInspireFaceSession", "cdecl"):
|
||||
HFCreateInspireFaceSession = _libs[_LIBRARY_FILENAME].get("HFCreateInspireFaceSession", "cdecl")
|
||||
HFCreateInspireFaceSession.argtypes = [HFSessionCustomParameter, HFDetectMode, HInt32, HInt32, HInt32, POINTER(HFSession)]
|
||||
HFCreateInspireFaceSession.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 179
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 180
|
||||
if _libs[_LIBRARY_FILENAME].has("HFCreateInspireFaceSessionOptional", "cdecl"):
|
||||
HFCreateInspireFaceSessionOptional = _libs[_LIBRARY_FILENAME].get("HFCreateInspireFaceSessionOptional", "cdecl")
|
||||
HFCreateInspireFaceSessionOptional.argtypes = [HOption, HFDetectMode, HInt32, HInt32, HInt32, POINTER(HFSession)]
|
||||
HFCreateInspireFaceSessionOptional.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 194
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 189
|
||||
if _libs[_LIBRARY_FILENAME].has("HFReleaseInspireFaceSession", "cdecl"):
|
||||
HFReleaseInspireFaceSession = _libs[_LIBRARY_FILENAME].get("HFReleaseInspireFaceSession", "cdecl")
|
||||
HFReleaseInspireFaceSession.argtypes = [HFSession]
|
||||
HFReleaseInspireFaceSession.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 204
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 199
|
||||
class struct_HFFaceBasicToken(Structure):
|
||||
pass
|
||||
|
||||
@@ -1070,11 +1078,11 @@ struct_HFFaceBasicToken._fields_ = [
|
||||
('data', HPVoid),
|
||||
]
|
||||
|
||||
HFFaceBasicToken = struct_HFFaceBasicToken# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 204
|
||||
HFFaceBasicToken = struct_HFFaceBasicToken# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 199
|
||||
|
||||
PHFFaceBasicToken = POINTER(struct_HFFaceBasicToken)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 204
|
||||
PHFFaceBasicToken = POINTER(struct_HFFaceBasicToken)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 199
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 215
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 210
|
||||
class struct_HFFaceEulerAngle(Structure):
|
||||
pass
|
||||
|
||||
@@ -1089,9 +1097,9 @@ struct_HFFaceEulerAngle._fields_ = [
|
||||
('pitch', POINTER(HFloat)),
|
||||
]
|
||||
|
||||
HFFaceEulerAngle = struct_HFFaceEulerAngle# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 215
|
||||
HFFaceEulerAngle = struct_HFFaceEulerAngle# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 210
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 229
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 225
|
||||
class struct_HFMultipleFaceData(Structure):
|
||||
pass
|
||||
|
||||
@@ -1099,6 +1107,7 @@ struct_HFMultipleFaceData.__slots__ = [
|
||||
'detectedNum',
|
||||
'rects',
|
||||
'trackIds',
|
||||
'detConfidence',
|
||||
'angles',
|
||||
'tokens',
|
||||
]
|
||||
@@ -1106,63 +1115,64 @@ struct_HFMultipleFaceData._fields_ = [
|
||||
('detectedNum', HInt32),
|
||||
('rects', POINTER(HFaceRect)),
|
||||
('trackIds', POINTER(HInt32)),
|
||||
('detConfidence', POINTER(HFloat)),
|
||||
('angles', HFFaceEulerAngle),
|
||||
('tokens', PHFFaceBasicToken),
|
||||
]
|
||||
|
||||
HFMultipleFaceData = struct_HFMultipleFaceData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 229
|
||||
HFMultipleFaceData = struct_HFMultipleFaceData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 225
|
||||
|
||||
PHFMultipleFaceData = POINTER(struct_HFMultipleFaceData)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 229
|
||||
PHFMultipleFaceData = POINTER(struct_HFMultipleFaceData)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 225
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 239
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 235
|
||||
if _libs[_LIBRARY_FILENAME].has("HFSessionSetTrackPreviewSize", "cdecl"):
|
||||
HFSessionSetTrackPreviewSize = _libs[_LIBRARY_FILENAME].get("HFSessionSetTrackPreviewSize", "cdecl")
|
||||
HFSessionSetTrackPreviewSize.argtypes = [HFSession, HInt32]
|
||||
HFSessionSetTrackPreviewSize.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 248
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 245
|
||||
if _libs[_LIBRARY_FILENAME].has("HFSessionSetFilterMinimumFacePixelSize", "cdecl"):
|
||||
HFSessionSetFilterMinimumFacePixelSize = _libs[_LIBRARY_FILENAME].get("HFSessionSetFilterMinimumFacePixelSize", "cdecl")
|
||||
HFSessionSetFilterMinimumFacePixelSize.argtypes = [HFSession, HInt32]
|
||||
HFSessionSetFilterMinimumFacePixelSize.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 257
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 254
|
||||
if _libs[_LIBRARY_FILENAME].has("HFSessionSetFaceDetectThreshold", "cdecl"):
|
||||
HFSessionSetFaceDetectThreshold = _libs[_LIBRARY_FILENAME].get("HFSessionSetFaceDetectThreshold", "cdecl")
|
||||
HFSessionSetFaceDetectThreshold.argtypes = [HFSession, HFloat]
|
||||
HFSessionSetFaceDetectThreshold.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 267
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 264
|
||||
if _libs[_LIBRARY_FILENAME].has("HFExecuteFaceTrack", "cdecl"):
|
||||
HFExecuteFaceTrack = _libs[_LIBRARY_FILENAME].get("HFExecuteFaceTrack", "cdecl")
|
||||
HFExecuteFaceTrack.argtypes = [HFSession, HFImageStream, PHFMultipleFaceData]
|
||||
HFExecuteFaceTrack.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 284
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 281
|
||||
if _libs[_LIBRARY_FILENAME].has("HFCopyFaceBasicToken", "cdecl"):
|
||||
HFCopyFaceBasicToken = _libs[_LIBRARY_FILENAME].get("HFCopyFaceBasicToken", "cdecl")
|
||||
HFCopyFaceBasicToken.argtypes = [HFFaceBasicToken, HPBuffer, HInt32]
|
||||
HFCopyFaceBasicToken.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 298
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 295
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceBasicTokenSize", "cdecl"):
|
||||
HFGetFaceBasicTokenSize = _libs[_LIBRARY_FILENAME].get("HFGetFaceBasicTokenSize", "cdecl")
|
||||
HFGetFaceBasicTokenSize.argtypes = [HPInt32]
|
||||
HFGetFaceBasicTokenSize.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 305
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 302
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetNumOfFaceDenseLandmark", "cdecl"):
|
||||
HFGetNumOfFaceDenseLandmark = _libs[_LIBRARY_FILENAME].get("HFGetNumOfFaceDenseLandmark", "cdecl")
|
||||
HFGetNumOfFaceDenseLandmark.argtypes = [HPInt32]
|
||||
HFGetNumOfFaceDenseLandmark.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 315
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 312
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceDenseLandmarkFromFaceToken", "cdecl"):
|
||||
HFGetFaceDenseLandmarkFromFaceToken = _libs[_LIBRARY_FILENAME].get("HFGetFaceDenseLandmarkFromFaceToken", "cdecl")
|
||||
HFGetFaceDenseLandmarkFromFaceToken.argtypes = [HFFaceBasicToken, POINTER(HPoint2f), HInt32]
|
||||
HFGetFaceDenseLandmarkFromFaceToken.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 329
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 326
|
||||
class struct_HFFaceFeature(Structure):
|
||||
pass
|
||||
|
||||
@@ -1175,31 +1185,31 @@ struct_HFFaceFeature._fields_ = [
|
||||
('data', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceFeature = struct_HFFaceFeature# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 329
|
||||
HFFaceFeature = struct_HFFaceFeature# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 326
|
||||
|
||||
PHFFaceFeature = POINTER(struct_HFFaceFeature)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 329
|
||||
PHFFaceFeature = POINTER(struct_HFFaceFeature)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 326
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 341
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 337
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFaceFeatureExtract", "cdecl"):
|
||||
HFFaceFeatureExtract = _libs[_LIBRARY_FILENAME].get("HFFaceFeatureExtract", "cdecl")
|
||||
HFFaceFeatureExtract.argtypes = [HFSession, HFImageStream, HFFaceBasicToken, PHFFaceFeature]
|
||||
HFFaceFeatureExtract.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 353
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 349
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFaceFeatureExtractCpy", "cdecl"):
|
||||
HFFaceFeatureExtractCpy = _libs[_LIBRARY_FILENAME].get("HFFaceFeatureExtractCpy", "cdecl")
|
||||
HFFaceFeatureExtractCpy.argtypes = [HFSession, HFImageStream, HFFaceBasicToken, HPFloat]
|
||||
HFFaceFeatureExtractCpy.restype = HResult
|
||||
|
||||
enum_HFSearchMode = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 366
|
||||
enum_HFSearchMode = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 362
|
||||
|
||||
HF_SEARCH_MODE_EAGER = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 366
|
||||
HF_SEARCH_MODE_EAGER = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 362
|
||||
|
||||
HF_SEARCH_MODE_EXHAUSTIVE = (HF_SEARCH_MODE_EAGER + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 366
|
||||
HF_SEARCH_MODE_EXHAUSTIVE = (HF_SEARCH_MODE_EAGER + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 362
|
||||
|
||||
HFSearchMode = enum_HFSearchMode# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 366
|
||||
HFSearchMode = enum_HFSearchMode# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 362
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 379
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 377
|
||||
class struct_HFFeatureHubConfiguration(Structure):
|
||||
pass
|
||||
|
||||
@@ -1218,21 +1228,21 @@ struct_HFFeatureHubConfiguration._fields_ = [
|
||||
('searchMode', HFSearchMode),
|
||||
]
|
||||
|
||||
HFFeatureHubConfiguration = struct_HFFeatureHubConfiguration# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 379
|
||||
HFFeatureHubConfiguration = struct_HFFeatureHubConfiguration# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 377
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 391
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 389
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubDataEnable", "cdecl"):
|
||||
HFFeatureHubDataEnable = _libs[_LIBRARY_FILENAME].get("HFFeatureHubDataEnable", "cdecl")
|
||||
HFFeatureHubDataEnable.argtypes = [HFFeatureHubConfiguration]
|
||||
HFFeatureHubDataEnable.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 397
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 395
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubDataDisable", "cdecl"):
|
||||
HFFeatureHubDataDisable = _libs[_LIBRARY_FILENAME].get("HFFeatureHubDataDisable", "cdecl")
|
||||
HFFeatureHubDataDisable.argtypes = []
|
||||
HFFeatureHubDataDisable.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 409
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 406
|
||||
class struct_HFFaceFeatureIdentity(Structure):
|
||||
pass
|
||||
|
||||
@@ -1247,11 +1257,11 @@ struct_HFFaceFeatureIdentity._fields_ = [
|
||||
('feature', PHFFaceFeature),
|
||||
]
|
||||
|
||||
HFFaceFeatureIdentity = struct_HFFaceFeatureIdentity# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 409
|
||||
HFFaceFeatureIdentity = struct_HFFaceFeatureIdentity# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 406
|
||||
|
||||
PHFFaceFeatureIdentity = POINTER(struct_HFFaceFeatureIdentity)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 409
|
||||
PHFFaceFeatureIdentity = POINTER(struct_HFFaceFeatureIdentity)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 406
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 418
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 415
|
||||
class struct_HFSearchTopKResults(Structure):
|
||||
pass
|
||||
|
||||
@@ -1266,89 +1276,89 @@ struct_HFSearchTopKResults._fields_ = [
|
||||
('customIds', HPInt32),
|
||||
]
|
||||
|
||||
HFSearchTopKResults = struct_HFSearchTopKResults# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 418
|
||||
HFSearchTopKResults = struct_HFSearchTopKResults# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 415
|
||||
|
||||
PHFSearchTopKResults = POINTER(struct_HFSearchTopKResults)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 418
|
||||
PHFSearchTopKResults = POINTER(struct_HFSearchTopKResults)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 415
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 429
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 427
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubFaceSearchThresholdSetting", "cdecl"):
|
||||
HFFeatureHubFaceSearchThresholdSetting = _libs[_LIBRARY_FILENAME].get("HFFeatureHubFaceSearchThresholdSetting", "cdecl")
|
||||
HFFeatureHubFaceSearchThresholdSetting.argtypes = [c_float]
|
||||
HFFeatureHubFaceSearchThresholdSetting.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 440
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 438
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFaceComparison", "cdecl"):
|
||||
HFFaceComparison = _libs[_LIBRARY_FILENAME].get("HFFaceComparison", "cdecl")
|
||||
HFFaceComparison.argtypes = [HFFaceFeature, HFFaceFeature, HPFloat]
|
||||
HFFaceComparison.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 448
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 446
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFeatureLength", "cdecl"):
|
||||
HFGetFeatureLength = _libs[_LIBRARY_FILENAME].get("HFGetFeatureLength", "cdecl")
|
||||
HFGetFeatureLength.argtypes = [HPInt32]
|
||||
HFGetFeatureLength.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 457
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 454
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubInsertFeature", "cdecl"):
|
||||
HFFeatureHubInsertFeature = _libs[_LIBRARY_FILENAME].get("HFFeatureHubInsertFeature", "cdecl")
|
||||
HFFeatureHubInsertFeature.argtypes = [HFFaceFeatureIdentity]
|
||||
HFFeatureHubInsertFeature.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 467
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 465
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubFaceSearch", "cdecl"):
|
||||
HFFeatureHubFaceSearch = _libs[_LIBRARY_FILENAME].get("HFFeatureHubFaceSearch", "cdecl")
|
||||
HFFeatureHubFaceSearch.argtypes = [HFFaceFeature, HPFloat, PHFFaceFeatureIdentity]
|
||||
HFFeatureHubFaceSearch.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 477
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 475
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubFaceSearchTopK", "cdecl"):
|
||||
HFFeatureHubFaceSearchTopK = _libs[_LIBRARY_FILENAME].get("HFFeatureHubFaceSearchTopK", "cdecl")
|
||||
HFFeatureHubFaceSearchTopK.argtypes = [HFFaceFeature, HInt32, PHFSearchTopKResults]
|
||||
HFFeatureHubFaceSearchTopK.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 485
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 483
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubFaceRemove", "cdecl"):
|
||||
HFFeatureHubFaceRemove = _libs[_LIBRARY_FILENAME].get("HFFeatureHubFaceRemove", "cdecl")
|
||||
HFFeatureHubFaceRemove.argtypes = [HInt32]
|
||||
HFFeatureHubFaceRemove.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 493
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 491
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubFaceUpdate", "cdecl"):
|
||||
HFFeatureHubFaceUpdate = _libs[_LIBRARY_FILENAME].get("HFFeatureHubFaceUpdate", "cdecl")
|
||||
HFFeatureHubFaceUpdate.argtypes = [HFFaceFeatureIdentity]
|
||||
HFFeatureHubFaceUpdate.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 502
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 500
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubGetFaceIdentity", "cdecl"):
|
||||
HFFeatureHubGetFaceIdentity = _libs[_LIBRARY_FILENAME].get("HFFeatureHubGetFaceIdentity", "cdecl")
|
||||
HFFeatureHubGetFaceIdentity.argtypes = [HInt32, PHFFaceFeatureIdentity]
|
||||
HFFeatureHubGetFaceIdentity.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 510
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 508
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubGetFaceCount", "cdecl"):
|
||||
HFFeatureHubGetFaceCount = _libs[_LIBRARY_FILENAME].get("HFFeatureHubGetFaceCount", "cdecl")
|
||||
HFFeatureHubGetFaceCount.argtypes = [POINTER(HInt32)]
|
||||
HFFeatureHubGetFaceCount.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 517
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 515
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFeatureHubViewDBTable", "cdecl"):
|
||||
HFFeatureHubViewDBTable = _libs[_LIBRARY_FILENAME].get("HFFeatureHubViewDBTable", "cdecl")
|
||||
HFFeatureHubViewDBTable.argtypes = []
|
||||
HFFeatureHubViewDBTable.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 536
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 533
|
||||
if _libs[_LIBRARY_FILENAME].has("HFMultipleFacePipelineProcess", "cdecl"):
|
||||
HFMultipleFacePipelineProcess = _libs[_LIBRARY_FILENAME].get("HFMultipleFacePipelineProcess", "cdecl")
|
||||
HFMultipleFacePipelineProcess.argtypes = [HFSession, HFImageStream, PHFMultipleFaceData, HFSessionCustomParameter]
|
||||
HFMultipleFacePipelineProcess.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 552
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 548
|
||||
if _libs[_LIBRARY_FILENAME].has("HFMultipleFacePipelineProcessOptional", "cdecl"):
|
||||
HFMultipleFacePipelineProcessOptional = _libs[_LIBRARY_FILENAME].get("HFMultipleFacePipelineProcessOptional", "cdecl")
|
||||
HFMultipleFacePipelineProcessOptional.argtypes = [HFSession, HFImageStream, PHFMultipleFaceData, HInt32]
|
||||
HFMultipleFacePipelineProcessOptional.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 564
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 560
|
||||
class struct_HFRGBLivenessConfidence(Structure):
|
||||
pass
|
||||
|
||||
@@ -1361,17 +1371,17 @@ struct_HFRGBLivenessConfidence._fields_ = [
|
||||
('confidence', HPFloat),
|
||||
]
|
||||
|
||||
HFRGBLivenessConfidence = struct_HFRGBLivenessConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 564
|
||||
HFRGBLivenessConfidence = struct_HFRGBLivenessConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 560
|
||||
|
||||
PHFRGBLivenessConfidence = POINTER(struct_HFRGBLivenessConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 564
|
||||
PHFRGBLivenessConfidence = POINTER(struct_HFRGBLivenessConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 560
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 577
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 572
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetRGBLivenessConfidence", "cdecl"):
|
||||
HFGetRGBLivenessConfidence = _libs[_LIBRARY_FILENAME].get("HFGetRGBLivenessConfidence", "cdecl")
|
||||
HFGetRGBLivenessConfidence.argtypes = [HFSession, PHFRGBLivenessConfidence]
|
||||
HFGetRGBLivenessConfidence.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 588
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 583
|
||||
class struct_HFFaceMaskConfidence(Structure):
|
||||
pass
|
||||
|
||||
@@ -1384,17 +1394,17 @@ struct_HFFaceMaskConfidence._fields_ = [
|
||||
('confidence', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceMaskConfidence = struct_HFFaceMaskConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 588
|
||||
HFFaceMaskConfidence = struct_HFFaceMaskConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 583
|
||||
|
||||
PHFFaceMaskConfidence = POINTER(struct_HFFaceMaskConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 588
|
||||
PHFFaceMaskConfidence = POINTER(struct_HFFaceMaskConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 583
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 600
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 595
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceMaskConfidence", "cdecl"):
|
||||
HFGetFaceMaskConfidence = _libs[_LIBRARY_FILENAME].get("HFGetFaceMaskConfidence", "cdecl")
|
||||
HFGetFaceMaskConfidence.argtypes = [HFSession, PHFFaceMaskConfidence]
|
||||
HFGetFaceMaskConfidence.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 606
|
||||
class struct_HFFaceQualityConfidence(Structure):
|
||||
pass
|
||||
|
||||
@@ -1407,23 +1417,23 @@ struct_HFFaceQualityConfidence._fields_ = [
|
||||
('confidence', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceQualityConfidence = struct_HFFaceQualityConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
HFFaceQualityConfidence = struct_HFFaceQualityConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 606
|
||||
|
||||
PHFFaceQualityConfidence = POINTER(struct_HFFaceQualityConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
PHFFaceQualityConfidence = POINTER(struct_HFFaceQualityConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 606
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 623
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 618
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceQualityConfidence", "cdecl"):
|
||||
HFGetFaceQualityConfidence = _libs[_LIBRARY_FILENAME].get("HFGetFaceQualityConfidence", "cdecl")
|
||||
HFGetFaceQualityConfidence.argtypes = [HFSession, PHFFaceQualityConfidence]
|
||||
HFGetFaceQualityConfidence.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 635
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 630
|
||||
if _libs[_LIBRARY_FILENAME].has("HFFaceQualityDetect", "cdecl"):
|
||||
HFFaceQualityDetect = _libs[_LIBRARY_FILENAME].get("HFFaceQualityDetect", "cdecl")
|
||||
HFFaceQualityDetect.argtypes = [HFSession, HFFaceBasicToken, POINTER(HFloat)]
|
||||
HFFaceQualityDetect.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 641
|
||||
class struct_HFFaceIntereactionState(Structure):
|
||||
pass
|
||||
|
||||
@@ -1438,17 +1448,17 @@ struct_HFFaceIntereactionState._fields_ = [
|
||||
('rightEyeStatusConfidence', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceIntereactionState = struct_HFFaceIntereactionState# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
HFFaceIntereactionState = struct_HFFaceIntereactionState# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 641
|
||||
|
||||
PHFFaceIntereactionState = POINTER(struct_HFFaceIntereactionState)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
PHFFaceIntereactionState = POINTER(struct_HFFaceIntereactionState)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 641
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 652
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 648
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceIntereactionStateResult", "cdecl"):
|
||||
HFGetFaceIntereactionStateResult = _libs[_LIBRARY_FILENAME].get("HFGetFaceIntereactionStateResult", "cdecl")
|
||||
HFGetFaceIntereactionStateResult.argtypes = [HFSession, PHFFaceIntereactionState]
|
||||
HFGetFaceIntereactionStateResult.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 661
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 660
|
||||
class struct_HFFaceIntereactionsActions(Structure):
|
||||
pass
|
||||
|
||||
@@ -1469,17 +1479,17 @@ struct_HFFaceIntereactionsActions._fields_ = [
|
||||
('blink', HPInt32),
|
||||
]
|
||||
|
||||
HFFaceIntereactionsActions = struct_HFFaceIntereactionsActions# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 661
|
||||
HFFaceIntereactionsActions = struct_HFFaceIntereactionsActions# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 660
|
||||
|
||||
PHFFaceIntereactionsActions = POINTER(struct_HFFaceIntereactionsActions)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 661
|
||||
PHFFaceIntereactionsActions = POINTER(struct_HFFaceIntereactionsActions)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 660
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 663
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 668
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceIntereactionActionsResult", "cdecl"):
|
||||
HFGetFaceIntereactionActionsResult = _libs[_LIBRARY_FILENAME].get("HFGetFaceIntereactionActionsResult", "cdecl")
|
||||
HFGetFaceIntereactionActionsResult.argtypes = [HFSession, PHFFaceIntereactionsActions]
|
||||
HFGetFaceIntereactionActionsResult.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 691
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 695
|
||||
class struct_HFFaceAttributeResult(Structure):
|
||||
pass
|
||||
|
||||
@@ -1496,17 +1506,17 @@ struct_HFFaceAttributeResult._fields_ = [
|
||||
('ageBracket', HPInt32),
|
||||
]
|
||||
|
||||
HFFaceAttributeResult = struct_HFFaceAttributeResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 691
|
||||
HFFaceAttributeResult = struct_HFFaceAttributeResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 695
|
||||
|
||||
PHFFaceAttributeResult = POINTER(struct_HFFaceAttributeResult)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 691
|
||||
PHFFaceAttributeResult = POINTER(struct_HFFaceAttributeResult)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 695
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 703
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 707
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceAttributeResult", "cdecl"):
|
||||
HFGetFaceAttributeResult = _libs[_LIBRARY_FILENAME].get("HFGetFaceAttributeResult", "cdecl")
|
||||
HFGetFaceAttributeResult.argtypes = [HFSession, PHFFaceAttributeResult]
|
||||
HFGetFaceAttributeResult.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 717
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 720
|
||||
class struct_HFInspireFaceVersion(Structure):
|
||||
pass
|
||||
|
||||
@@ -1521,143 +1531,172 @@ struct_HFInspireFaceVersion._fields_ = [
|
||||
('patch', c_int),
|
||||
]
|
||||
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 717
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 720
|
||||
|
||||
PHFInspireFaceVersion = POINTER(struct_HFInspireFaceVersion)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 717
|
||||
PHFInspireFaceVersion = POINTER(struct_HFInspireFaceVersion)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 720
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 727
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 730
|
||||
if _libs[_LIBRARY_FILENAME].has("HFQueryInspireFaceVersion", "cdecl"):
|
||||
HFQueryInspireFaceVersion = _libs[_LIBRARY_FILENAME].get("HFQueryInspireFaceVersion", "cdecl")
|
||||
HFQueryInspireFaceVersion.argtypes = [PHFInspireFaceVersion]
|
||||
HFQueryInspireFaceVersion.restype = HResult
|
||||
|
||||
enum_HFLogLevel = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
enum_HFLogLevel = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HF_LOG_NONE = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HF_LOG_NONE = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HF_LOG_DEBUG = (HF_LOG_NONE + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HF_LOG_DEBUG = (HF_LOG_NONE + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HF_LOG_INFO = (HF_LOG_DEBUG + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HF_LOG_INFO = (HF_LOG_DEBUG + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HF_LOG_WARN = (HF_LOG_INFO + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HF_LOG_WARN = (HF_LOG_INFO + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HF_LOG_ERROR = (HF_LOG_WARN + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HF_LOG_ERROR = (HF_LOG_WARN + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HF_LOG_FATAL = (HF_LOG_ERROR + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HF_LOG_FATAL = (HF_LOG_ERROR + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
HFLogLevel = enum_HFLogLevel# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 739
|
||||
HFLogLevel = enum_HFLogLevel# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 744
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 749
|
||||
if _libs[_LIBRARY_FILENAME].has("HFSetLogLevel", "cdecl"):
|
||||
HFSetLogLevel = _libs[_LIBRARY_FILENAME].get("HFSetLogLevel", "cdecl")
|
||||
HFSetLogLevel.argtypes = [HFLogLevel]
|
||||
HFSetLogLevel.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 749
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 754
|
||||
if _libs[_LIBRARY_FILENAME].has("HFLogDisable", "cdecl"):
|
||||
HFLogDisable = _libs[_LIBRARY_FILENAME].get("HFLogDisable", "cdecl")
|
||||
HFLogDisable.argtypes = []
|
||||
HFLogDisable.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 762
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 767
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugImageStreamImShow", "cdecl"):
|
||||
HFDeBugImageStreamImShow = _libs[_LIBRARY_FILENAME].get("HFDeBugImageStreamImShow", "cdecl")
|
||||
HFDeBugImageStreamImShow.argtypes = [HFImageStream]
|
||||
HFDeBugImageStreamImShow.restype = None
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 773
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 779
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugImageStreamDecodeSave", "cdecl"):
|
||||
HFDeBugImageStreamDecodeSave = _libs[_LIBRARY_FILENAME].get("HFDeBugImageStreamDecodeSave", "cdecl")
|
||||
HFDeBugImageStreamDecodeSave.argtypes = [HFImageStream, HPath]
|
||||
HFDeBugImageStreamDecodeSave.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 794
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugShowResourceStatistics", "cdecl"):
|
||||
HFDeBugShowResourceStatistics = _libs[_LIBRARY_FILENAME].get("HFDeBugShowResourceStatistics", "cdecl")
|
||||
HFDeBugShowResourceStatistics.argtypes = []
|
||||
HFDeBugShowResourceStatistics.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 804
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugGetUnreleasedSessionsCount", "cdecl"):
|
||||
HFDeBugGetUnreleasedSessionsCount = _libs[_LIBRARY_FILENAME].get("HFDeBugGetUnreleasedSessionsCount", "cdecl")
|
||||
HFDeBugGetUnreleasedSessionsCount.argtypes = [POINTER(HInt32)]
|
||||
HFDeBugGetUnreleasedSessionsCount.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 815
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugGetUnreleasedSessions", "cdecl"):
|
||||
HFDeBugGetUnreleasedSessions = _libs[_LIBRARY_FILENAME].get("HFDeBugGetUnreleasedSessions", "cdecl")
|
||||
HFDeBugGetUnreleasedSessions.argtypes = [POINTER(HFSession), HInt32]
|
||||
HFDeBugGetUnreleasedSessions.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 825
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugGetUnreleasedStreamsCount", "cdecl"):
|
||||
HFDeBugGetUnreleasedStreamsCount = _libs[_LIBRARY_FILENAME].get("HFDeBugGetUnreleasedStreamsCount", "cdecl")
|
||||
HFDeBugGetUnreleasedStreamsCount.argtypes = [POINTER(HInt32)]
|
||||
HFDeBugGetUnreleasedStreamsCount.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 836
|
||||
if _libs[_LIBRARY_FILENAME].has("HFDeBugGetUnreleasedStreams", "cdecl"):
|
||||
HFDeBugGetUnreleasedStreams = _libs[_LIBRARY_FILENAME].get("HFDeBugGetUnreleasedStreams", "cdecl")
|
||||
HFDeBugGetUnreleasedStreams.argtypes = [POINTER(HFImageStream), HInt32]
|
||||
HFDeBugGetUnreleasedStreams.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 26
|
||||
try:
|
||||
HF_ENABLE_NONE = 0x00000000
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 27
|
||||
try:
|
||||
HF_ENABLE_NONE = 0
|
||||
HF_ENABLE_FACE_RECOGNITION = 0x00000002
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 28
|
||||
try:
|
||||
HF_ENABLE_FACE_RECOGNITION = 2
|
||||
HF_ENABLE_LIVENESS = 0x00000004
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 29
|
||||
try:
|
||||
HF_ENABLE_LIVENESS = 4
|
||||
HF_ENABLE_IR_LIVENESS = 0x00000008
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 30
|
||||
try:
|
||||
HF_ENABLE_IR_LIVENESS = 8
|
||||
HF_ENABLE_MASK_DETECT = 0x00000010
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 31
|
||||
try:
|
||||
HF_ENABLE_MASK_DETECT = 16
|
||||
HF_ENABLE_FACE_ATTRIBUTE = 0x00000020
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 32
|
||||
try:
|
||||
HF_ENABLE_FACE_ATTRIBUTE = 32
|
||||
HF_ENABLE_PLACEHOLDER_ = 0x00000040
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 33
|
||||
try:
|
||||
HF_ENABLE_PLACEHOLDER_ = 64
|
||||
HF_ENABLE_QUALITY = 0x00000080
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 34
|
||||
try:
|
||||
HF_ENABLE_QUALITY = 128
|
||||
HF_ENABLE_INTERACTION = 0x00000100
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 35
|
||||
try:
|
||||
HF_ENABLE_INTERACTION = 256
|
||||
except:
|
||||
pass
|
||||
HFImageData = struct_HFImageData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 70
|
||||
|
||||
HFImageData = struct_HFImageData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 74
|
||||
HFSessionCustomParameter = struct_HFSessionCustomParameter# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 134
|
||||
|
||||
HFSessionCustomParameter = struct_HFSessionCustomParameter# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 131
|
||||
HFFaceBasicToken = struct_HFFaceBasicToken# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 199
|
||||
|
||||
HFFaceBasicToken = struct_HFFaceBasicToken# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 204
|
||||
HFFaceEulerAngle = struct_HFFaceEulerAngle# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 210
|
||||
|
||||
HFFaceEulerAngle = struct_HFFaceEulerAngle# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 215
|
||||
HFMultipleFaceData = struct_HFMultipleFaceData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 225
|
||||
|
||||
HFMultipleFaceData = struct_HFMultipleFaceData# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 229
|
||||
HFFaceFeature = struct_HFFaceFeature# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 326
|
||||
|
||||
HFFaceFeature = struct_HFFaceFeature# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 329
|
||||
HFFeatureHubConfiguration = struct_HFFeatureHubConfiguration# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 377
|
||||
|
||||
HFFeatureHubConfiguration = struct_HFFeatureHubConfiguration# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 379
|
||||
HFFaceFeatureIdentity = struct_HFFaceFeatureIdentity# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 406
|
||||
|
||||
HFFaceFeatureIdentity = struct_HFFaceFeatureIdentity# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 409
|
||||
HFSearchTopKResults = struct_HFSearchTopKResults# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 415
|
||||
|
||||
HFSearchTopKResults = struct_HFSearchTopKResults# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 418
|
||||
HFRGBLivenessConfidence = struct_HFRGBLivenessConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 560
|
||||
|
||||
HFRGBLivenessConfidence = struct_HFRGBLivenessConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 564
|
||||
HFFaceMaskConfidence = struct_HFFaceMaskConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 583
|
||||
|
||||
HFFaceMaskConfidence = struct_HFFaceMaskConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 588
|
||||
HFFaceQualityConfidence = struct_HFFaceQualityConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 606
|
||||
|
||||
HFFaceQualityConfidence = struct_HFFaceQualityConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
HFFaceIntereactionState = struct_HFFaceIntereactionState# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 641
|
||||
|
||||
HFFaceIntereactionState = struct_HFFaceIntereactionState# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
HFFaceIntereactionsActions = struct_HFFaceIntereactionsActions# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 660
|
||||
|
||||
HFFaceIntereactionsActions = struct_HFFaceIntereactionsActions# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 661
|
||||
HFFaceAttributeResult = struct_HFFaceAttributeResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 695
|
||||
|
||||
HFFaceAttributeResult = struct_HFFaceAttributeResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 691
|
||||
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 717
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 720
|
||||
|
||||
# No inserted files
|
||||
|
||||
# No prefix-stripping
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ class FaceInformation:
|
||||
|
||||
def __init__(self,
|
||||
track_id: int,
|
||||
detection_confidence: float,
|
||||
location: Tuple,
|
||||
roll: float,
|
||||
yaw: float,
|
||||
@@ -186,6 +187,7 @@ class FaceInformation:
|
||||
_token: HFFaceBasicToken,
|
||||
_feature: np.array = None):
|
||||
self.track_id = track_id
|
||||
self.detection_confidence = detection_confidence
|
||||
self.location = location
|
||||
self.roll = roll
|
||||
self.yaw = yaw
|
||||
@@ -312,6 +314,7 @@ class InspireFaceSession(object):
|
||||
pitch = euler_angle[idx][2]
|
||||
track_id = track_ids[idx]
|
||||
_token = tokens[idx]
|
||||
detection_confidence = self.multiple_faces.detConfidence[idx]
|
||||
|
||||
info = FaceInformation(
|
||||
location=(top_left[0], top_left[1], bottom_right[0], bottom_right[1]),
|
||||
@@ -320,6 +323,7 @@ class InspireFaceSession(object):
|
||||
pitch=pitch,
|
||||
track_id=track_id,
|
||||
_token=_token,
|
||||
detection_confidence=detection_confidence,
|
||||
)
|
||||
infos.append(info)
|
||||
|
||||
@@ -342,6 +346,20 @@ class InspireFaceSession(object):
|
||||
|
||||
return np.asarray(landmark).reshape(-1, 2)
|
||||
|
||||
def set_detection_confidence_threshold(self, threshold: float):
|
||||
"""
|
||||
Sets the detection confidence threshold for the face detection session.
|
||||
|
||||
Args:
|
||||
threshold (float): The confidence threshold for face detection.
|
||||
|
||||
Notes:
|
||||
If setting the detection confidence threshold fails, an error is logged with the returned status code.
|
||||
"""
|
||||
ret = HFSessionSetFaceDetectThreshold(self._sess, threshold)
|
||||
if ret != 0:
|
||||
logger.error(f"Set detection confidence threshold error: {ret}")
|
||||
|
||||
def set_track_preview_size(self, size=192):
|
||||
"""
|
||||
Sets the preview size for the face tracking session.
|
||||
@@ -962,3 +980,9 @@ def disable_logging() -> None:
|
||||
Disables all logging from the InspireFace library.
|
||||
"""
|
||||
HFLogDisable()
|
||||
|
||||
def show_system_resource_statistics():
|
||||
"""
|
||||
Displays the system resource information.
|
||||
"""
|
||||
HFDeBugShowResourceStatistics()
|
||||
|
||||
@@ -26,6 +26,9 @@ def case_face_detection_image(resource_path, image_path):
|
||||
opt = HF_ENABLE_FACE_RECOGNITION | HF_ENABLE_QUALITY | HF_ENABLE_MASK_DETECT | HF_ENABLE_LIVENESS | HF_ENABLE_INTERACTION | HF_ENABLE_FACE_ATTRIBUTE
|
||||
session = ifac.InspireFaceSession(opt, HF_DETECT_MODE_ALWAYS_DETECT)
|
||||
|
||||
# Set detection confidence threshold
|
||||
session.set_detection_confidence_threshold(0.5)
|
||||
|
||||
# Load the image using OpenCV.
|
||||
image = cv2.imread(image_path)
|
||||
assert image is not None, "Please check that the image path is correct."
|
||||
@@ -39,6 +42,7 @@ def case_face_detection_image(resource_path, image_path):
|
||||
for idx, face in enumerate(faces):
|
||||
print(f"{'==' * 20}")
|
||||
print(f"idx: {idx}")
|
||||
print(f"detection confidence: {face.detection_confidence}")
|
||||
# Print Euler angles of the face.
|
||||
print(f"roll: {face.roll}, yaw: {face.yaw}, pitch: {face.pitch}")
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
import inspireface as ifac
|
||||
from inspireface.param import *
|
||||
import click
|
||||
|
||||
@click.command()
|
||||
@click.argument("resource_path")
|
||||
def case_show_system_resource_statistics(resource_path):
|
||||
"""
|
||||
This case is used to test the system resource statistics.
|
||||
"""
|
||||
ret = ifac.launch(resource_path)
|
||||
assert ret, "Launch failure. Please ensure the resource path is correct."
|
||||
print("-" * 100)
|
||||
print("Initialization state")
|
||||
print("-" * 100)
|
||||
ifac.show_system_resource_statistics()
|
||||
print("-" * 100)
|
||||
print("Create 10 sessions")
|
||||
print("-" * 100)
|
||||
print("")
|
||||
num_created_sessions = 10
|
||||
sessions = []
|
||||
for i in range(num_created_sessions):
|
||||
session = ifac.InspireFaceSession(HF_ENABLE_FACE_RECOGNITION, HF_DETECT_MODE_ALWAYS_DETECT)
|
||||
sessions.append(session)
|
||||
ifac.show_system_resource_statistics()
|
||||
print("-" * 100)
|
||||
print("Release 10 sessions")
|
||||
print("-" * 100)
|
||||
print()
|
||||
for session in sessions:
|
||||
session.release()
|
||||
ifac.show_system_resource_statistics()
|
||||
|
||||
if __name__ == "__main__":
|
||||
case_show_system_resource_statistics()
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 242 KiB |
Reference in New Issue
Block a user