Update InspireFace to 1.1.4
@@ -552,8 +552,8 @@ class LibraryLoader:
|
||||
# noinspection PyBroadException
|
||||
try:
|
||||
return self.Lookup(path)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
print(err)
|
||||
|
||||
raise ImportError("Could not load %s." % libname)
|
||||
|
||||
@@ -918,6 +918,21 @@ struct_HFaceRect._fields_ = [
|
||||
|
||||
HFaceRect = struct_HFaceRect# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/intypedef.h: 32
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/intypedef.h: 37
|
||||
class struct_HPoint2f(Structure):
|
||||
pass
|
||||
|
||||
struct_HPoint2f.__slots__ = [
|
||||
'x',
|
||||
'y',
|
||||
]
|
||||
struct_HPoint2f._fields_ = [
|
||||
('x', HFloat),
|
||||
('y', HFloat),
|
||||
]
|
||||
|
||||
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
|
||||
|
||||
HF_STREAM_RGB = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 49
|
||||
@@ -987,7 +1002,7 @@ if _libs[_LIBRARY_FILENAME].has("HFLaunchInspireFace", "cdecl"):
|
||||
HFLaunchInspireFace.argtypes = [HPath]
|
||||
HFLaunchInspireFace.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 132
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 131
|
||||
class struct_HFSessionCustomParameter(Structure):
|
||||
pass
|
||||
|
||||
@@ -996,9 +1011,8 @@ struct_HFSessionCustomParameter.__slots__ = [
|
||||
'enable_liveness',
|
||||
'enable_ir_liveness',
|
||||
'enable_mask_detect',
|
||||
'enable_age',
|
||||
'enable_gender',
|
||||
'enable_face_quality',
|
||||
'enable_face_attribute',
|
||||
'enable_interaction_liveness',
|
||||
]
|
||||
struct_HFSessionCustomParameter._fields_ = [
|
||||
@@ -1006,15 +1020,14 @@ struct_HFSessionCustomParameter._fields_ = [
|
||||
('enable_liveness', HInt32),
|
||||
('enable_ir_liveness', HInt32),
|
||||
('enable_mask_detect', HInt32),
|
||||
('enable_age', HInt32),
|
||||
('enable_gender', HInt32),
|
||||
('enable_face_quality', HInt32),
|
||||
('enable_face_attribute', HInt32),
|
||||
('enable_interaction_liveness', HInt32),
|
||||
]
|
||||
|
||||
HFSessionCustomParameter = struct_HFSessionCustomParameter# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 132
|
||||
HFSessionCustomParameter = 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: 132
|
||||
PHFSessionCustomParameter = POINTER(struct_HFSessionCustomParameter)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 131
|
||||
|
||||
enum_HFDetectMode = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 142
|
||||
|
||||
@@ -1137,7 +1150,19 @@ if _libs[_LIBRARY_FILENAME].has("HFGetFaceBasicTokenSize", "cdecl"):
|
||||
HFGetFaceBasicTokenSize.argtypes = [HPInt32]
|
||||
HFGetFaceBasicTokenSize.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 312
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 305
|
||||
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
|
||||
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
|
||||
class struct_HFFaceFeature(Structure):
|
||||
pass
|
||||
|
||||
@@ -1150,31 +1175,31 @@ struct_HFFaceFeature._fields_ = [
|
||||
('data', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceFeature = struct_HFFaceFeature# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 312
|
||||
HFFaceFeature = 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: 312
|
||||
PHFFaceFeature = POINTER(struct_HFFaceFeature)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 329
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 324
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 341
|
||||
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: 336
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 353
|
||||
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: 349
|
||||
enum_HFSearchMode = c_int# /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: 349
|
||||
HF_SEARCH_MODE_EAGER = 0# /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: 349
|
||||
HF_SEARCH_MODE_EXHAUSTIVE = (HF_SEARCH_MODE_EAGER + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 366
|
||||
|
||||
HFSearchMode = enum_HFSearchMode# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 349
|
||||
HFSearchMode = enum_HFSearchMode# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 366
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 362
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 379
|
||||
class struct_HFFeatureHubConfiguration(Structure):
|
||||
pass
|
||||
|
||||
@@ -1193,21 +1218,21 @@ struct_HFFeatureHubConfiguration._fields_ = [
|
||||
('searchMode', HFSearchMode),
|
||||
]
|
||||
|
||||
HFFeatureHubConfiguration = struct_HFFeatureHubConfiguration# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 362
|
||||
HFFeatureHubConfiguration = struct_HFFeatureHubConfiguration# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 379
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 374
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 391
|
||||
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: 380
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 397
|
||||
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: 392
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 409
|
||||
class struct_HFFaceFeatureIdentity(Structure):
|
||||
pass
|
||||
|
||||
@@ -1222,11 +1247,11 @@ struct_HFFaceFeatureIdentity._fields_ = [
|
||||
('feature', PHFFaceFeature),
|
||||
]
|
||||
|
||||
HFFaceFeatureIdentity = struct_HFFaceFeatureIdentity# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 392
|
||||
HFFaceFeatureIdentity = 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: 392
|
||||
PHFFaceFeatureIdentity = POINTER(struct_HFFaceFeatureIdentity)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 409
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 401
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 418
|
||||
class struct_HFSearchTopKResults(Structure):
|
||||
pass
|
||||
|
||||
@@ -1241,89 +1266,89 @@ struct_HFSearchTopKResults._fields_ = [
|
||||
('customIds', HPInt32),
|
||||
]
|
||||
|
||||
HFSearchTopKResults = struct_HFSearchTopKResults# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 401
|
||||
HFSearchTopKResults = 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: 401
|
||||
PHFSearchTopKResults = POINTER(struct_HFSearchTopKResults)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 418
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 412
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 429
|
||||
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: 423
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 440
|
||||
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: 431
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 448
|
||||
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: 440
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 457
|
||||
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: 450
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 467
|
||||
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: 460
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 477
|
||||
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: 468
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 485
|
||||
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: 476
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 493
|
||||
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: 485
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 502
|
||||
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: 493
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 510
|
||||
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: 500
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 517
|
||||
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: 519
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 536
|
||||
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: 535
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 552
|
||||
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: 547
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 564
|
||||
class struct_HFRGBLivenessConfidence(Structure):
|
||||
pass
|
||||
|
||||
@@ -1336,17 +1361,17 @@ struct_HFRGBLivenessConfidence._fields_ = [
|
||||
('confidence', HPFloat),
|
||||
]
|
||||
|
||||
HFRGBLivenessConfidence = struct_HFRGBLivenessConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 547
|
||||
HFRGBLivenessConfidence = 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: 547
|
||||
PHFRGBLivenessConfidence = POINTER(struct_HFRGBLivenessConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 564
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 560
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 577
|
||||
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: 571
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 588
|
||||
class struct_HFFaceMaskConfidence(Structure):
|
||||
pass
|
||||
|
||||
@@ -1359,17 +1384,17 @@ struct_HFFaceMaskConfidence._fields_ = [
|
||||
('confidence', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceMaskConfidence = struct_HFFaceMaskConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 571
|
||||
HFFaceMaskConfidence = 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: 571
|
||||
PHFFaceMaskConfidence = POINTER(struct_HFFaceMaskConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 588
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 583
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 600
|
||||
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: 594
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
class struct_HFFaceQualityConfidence(Structure):
|
||||
pass
|
||||
|
||||
@@ -1382,23 +1407,75 @@ struct_HFFaceQualityConfidence._fields_ = [
|
||||
('confidence', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceQualityConfidence = struct_HFFaceQualityConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 594
|
||||
HFFaceQualityConfidence = 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: 594
|
||||
PHFFaceQualityConfidence = POINTER(struct_HFFaceQualityConfidence)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 606
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 623
|
||||
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: 618
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 635
|
||||
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: 631
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
class struct_HFFaceIntereactionResult(Structure):
|
||||
pass
|
||||
|
||||
struct_HFFaceIntereactionResult.__slots__ = [
|
||||
'num',
|
||||
'leftEyeStatusConfidence',
|
||||
'rightEyeStatusConfidence',
|
||||
]
|
||||
struct_HFFaceIntereactionResult._fields_ = [
|
||||
('num', HInt32),
|
||||
('leftEyeStatusConfidence', HPFloat),
|
||||
('rightEyeStatusConfidence', HPFloat),
|
||||
]
|
||||
|
||||
HFFaceIntereactionResult = struct_HFFaceIntereactionResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
|
||||
PHFFaceIntereactionResult = POINTER(struct_HFFaceIntereactionResult)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 647
|
||||
if _libs[_LIBRARY_FILENAME].has("HFGetFaceIntereactionResult", "cdecl"):
|
||||
HFGetFaceIntereactionResult = _libs[_LIBRARY_FILENAME].get("HFGetFaceIntereactionResult", "cdecl")
|
||||
HFGetFaceIntereactionResult.argtypes = [HFSession, PHFFaceIntereactionResult]
|
||||
HFGetFaceIntereactionResult.restype = HResult
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 675
|
||||
class struct_HFFaceAttributeResult(Structure):
|
||||
pass
|
||||
|
||||
struct_HFFaceAttributeResult.__slots__ = [
|
||||
'num',
|
||||
'race',
|
||||
'gender',
|
||||
'ageBracket',
|
||||
]
|
||||
struct_HFFaceAttributeResult._fields_ = [
|
||||
('num', HInt32),
|
||||
('race', HPInt32),
|
||||
('gender', HPInt32),
|
||||
('ageBracket', HPInt32),
|
||||
]
|
||||
|
||||
HFFaceAttributeResult = struct_HFFaceAttributeResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 675
|
||||
|
||||
PHFFaceAttributeResult = POINTER(struct_HFFaceAttributeResult)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 675
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 687
|
||||
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: 701
|
||||
class struct_HFInspireFaceVersion(Structure):
|
||||
pass
|
||||
|
||||
@@ -1413,50 +1490,56 @@ struct_HFInspireFaceVersion._fields_ = [
|
||||
('patch', c_int),
|
||||
]
|
||||
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 631
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 701
|
||||
|
||||
PHFInspireFaceVersion = POINTER(struct_HFInspireFaceVersion)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 631
|
||||
PHFInspireFaceVersion = POINTER(struct_HFInspireFaceVersion)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 701
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 641
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 711
|
||||
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: 653
|
||||
enum_HFLogLevel = c_int# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HF_LOG_NONE = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HF_LOG_NONE = 0# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HF_LOG_DEBUG = (HF_LOG_NONE + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HF_LOG_DEBUG = (HF_LOG_NONE + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HF_LOG_INFO = (HF_LOG_DEBUG + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HF_LOG_INFO = (HF_LOG_DEBUG + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HF_LOG_WARN = (HF_LOG_INFO + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HF_LOG_WARN = (HF_LOG_INFO + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HF_LOG_ERROR = (HF_LOG_WARN + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HF_LOG_ERROR = (HF_LOG_WARN + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HF_LOG_FATAL = (HF_LOG_ERROR + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HF_LOG_FATAL = (HF_LOG_ERROR + 1)# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
HFLogLevel = enum_HFLogLevel# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 653
|
||||
HFLogLevel = enum_HFLogLevel# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 723
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 658
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 728
|
||||
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: 663
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 733
|
||||
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: 676
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 746
|
||||
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: 757
|
||||
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: 27
|
||||
try:
|
||||
HF_ENABLE_NONE = 0
|
||||
@@ -1489,13 +1572,13 @@ except:
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 32
|
||||
try:
|
||||
HF_ENABLE_AGE_PREDICT = 32
|
||||
HF_ENABLE_FACE_ATTRIBUTE = 32
|
||||
except:
|
||||
pass
|
||||
|
||||
# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 33
|
||||
try:
|
||||
HF_ENABLE_GENDER_PREDICT = 64
|
||||
HF_ENABLE_PLACEHOLDER_ = 64
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -1513,7 +1596,7 @@ except:
|
||||
|
||||
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: 132
|
||||
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: 204
|
||||
|
||||
@@ -1521,21 +1604,25 @@ HFFaceEulerAngle = struct_HFFaceEulerAngle# /Users/tunm/work/InspireFace/cpp/ins
|
||||
|
||||
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: 312
|
||||
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: 362
|
||||
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: 392
|
||||
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: 401
|
||||
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: 547
|
||||
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: 571
|
||||
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: 594
|
||||
HFFaceQualityConfidence = struct_HFFaceQualityConfidence# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 611
|
||||
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 631
|
||||
HFFaceIntereactionResult = struct_HFFaceIntereactionResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 645
|
||||
|
||||
HFFaceAttributeResult = struct_HFFaceAttributeResult# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 675
|
||||
|
||||
HFInspireFaceVersion = struct_HFInspireFaceVersion# /Users/tunm/work/InspireFace/cpp/inspireface/c_api/inspireface.h: 701
|
||||
|
||||
# No inserted files
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import ctypes
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
from .core import *
|
||||
@@ -146,6 +148,11 @@ class FaceExtended:
|
||||
rgb_liveness_confidence: float
|
||||
mask_confidence: float
|
||||
quality_confidence: float
|
||||
left_eye_status_confidence: float
|
||||
right_eye_status_confidence: float
|
||||
race: int
|
||||
gender: int
|
||||
age_bracket: int
|
||||
|
||||
|
||||
class FaceInformation:
|
||||
@@ -208,8 +215,7 @@ class SessionCustomParameter:
|
||||
enable_liveness: bool = False
|
||||
enable_ir_liveness: bool = False
|
||||
enable_mask_detect: bool = False
|
||||
enable_age: bool = False
|
||||
enable_gender: bool = False
|
||||
enable_face_attribute: bool = False
|
||||
enable_face_quality: bool = False
|
||||
enable_interaction_liveness: bool = False
|
||||
|
||||
@@ -225,8 +231,7 @@ class SessionCustomParameter:
|
||||
enable_liveness=int(self.enable_liveness),
|
||||
enable_ir_liveness=int(self.enable_ir_liveness),
|
||||
enable_mask_detect=int(self.enable_mask_detect),
|
||||
enable_age=int(self.enable_age),
|
||||
enable_gender=int(self.enable_gender),
|
||||
enable_face_attribute=int(self.enable_face_attribute),
|
||||
enable_face_quality=int(self.enable_face_quality),
|
||||
enable_interaction_liveness=int(self.enable_interaction_liveness)
|
||||
)
|
||||
@@ -317,6 +322,21 @@ class InspireFaceSession(object):
|
||||
else:
|
||||
return []
|
||||
|
||||
def get_face_dense_landmark(self, single_face: FaceInformation):
|
||||
num_landmarks = HInt32()
|
||||
HFGetNumOfFaceDenseLandmark(byref(num_landmarks))
|
||||
landmarks_array = (HPoint2f * num_landmarks.value)()
|
||||
ret = HFGetFaceDenseLandmarkFromFaceToken(single_face._token, landmarks_array, num_landmarks)
|
||||
if ret != 0:
|
||||
logger.error(f"An error occurred obtaining a dense landmark for a single face: {ret}")
|
||||
|
||||
landmark = []
|
||||
for point in landmarks_array:
|
||||
landmark.append(point.x)
|
||||
landmark.append(point.y)
|
||||
|
||||
return np.asarray(landmark).reshape(-1, 2)
|
||||
|
||||
def set_track_preview_size(self, size=192):
|
||||
"""
|
||||
Sets the preview size for the face tracking session.
|
||||
@@ -367,10 +387,12 @@ class InspireFaceSession(object):
|
||||
logger.error(f"Face pipeline error: {ret}")
|
||||
return []
|
||||
|
||||
extends = [FaceExtended(-1.0, -1.0, -1.0) for _ in range(len(faces))]
|
||||
extends = [FaceExtended(-1.0, -1.0, -1.0, -1.0, -1.0, -1, -1, -1) for _ in range(len(faces))]
|
||||
self._update_mask_confidence(exec_param, flag, extends)
|
||||
self._update_rgb_liveness_confidence(exec_param, flag, extends)
|
||||
self._update_face_quality_confidence(exec_param, flag, extends)
|
||||
self._update_face_attribute_confidence(exec_param, flag, extends)
|
||||
self._update_face_interact_confidence(exec_param, flag, extends)
|
||||
|
||||
return extends
|
||||
|
||||
@@ -431,6 +453,18 @@ class InspireFaceSession(object):
|
||||
else:
|
||||
logger.error(f"Get mask result error: {ret}")
|
||||
|
||||
def _update_face_interact_confidence(self, exec_param, flag, extends):
|
||||
if (flag == "object" and exec_param.enable_interaction_liveness) or (
|
||||
flag == "bitmask" and exec_param & HF_ENABLE_INTERACTION):
|
||||
results = HFFaceIntereactionResult()
|
||||
ret = HFGetFaceIntereactionResult(self._sess, PHFFaceIntereactionResult(results))
|
||||
if ret == 0:
|
||||
for i in range(results.num):
|
||||
extends[i].left_eye_status_confidence = results.leftEyeStatusConfidence[i]
|
||||
extends[i].right_eye_status_confidence = results.rightEyeStatusConfidence[i]
|
||||
else:
|
||||
logger.error(f"Get face interact result error: {ret}")
|
||||
|
||||
def _update_rgb_liveness_confidence(self, exec_param, flag, extends: List[FaceExtended]):
|
||||
if (flag == "object" and exec_param.enable_liveness) or (
|
||||
flag == "bitmask" and exec_param & HF_ENABLE_LIVENESS):
|
||||
@@ -442,6 +476,19 @@ class InspireFaceSession(object):
|
||||
else:
|
||||
logger.error(f"Get rgb liveness result error: {ret}")
|
||||
|
||||
def _update_face_attribute_confidence(self, exec_param, flag, extends: List[FaceExtended]):
|
||||
if (flag == "object" and exec_param.enable_face_attribute) or (
|
||||
flag == "bitmask" and exec_param & HF_ENABLE_FACE_ATTRIBUTE):
|
||||
attribute_results = HFFaceAttributeResult()
|
||||
ret = HFGetFaceAttributeResult(self._sess, PHFFaceAttributeResult(attribute_results))
|
||||
if ret == 0:
|
||||
for i in range(attribute_results.num):
|
||||
extends[i].gender = attribute_results.gender[i]
|
||||
extends[i].age_bracket = attribute_results.ageBracket[i]
|
||||
extends[i].race = attribute_results.race[i]
|
||||
else:
|
||||
logger.error(f"Get face attribute result error: {ret}")
|
||||
|
||||
def _update_face_quality_confidence(self, exec_param, flag, extends: List[FaceExtended]):
|
||||
if (flag == "object" and exec_param.enable_face_quality) or (
|
||||
flag == "bitmask" and exec_param & HF_ENABLE_QUALITY):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Session option
|
||||
from inspireface.modules.core.native import HF_ENABLE_NONE, HF_ENABLE_FACE_RECOGNITION, HF_ENABLE_LIVENESS, HF_ENABLE_IR_LIVENESS, \
|
||||
HF_ENABLE_MASK_DETECT, HF_ENABLE_AGE_PREDICT, HF_ENABLE_GENDER_PREDICT, HF_ENABLE_QUALITY, HF_ENABLE_INTERACTION
|
||||
HF_ENABLE_MASK_DETECT, HF_ENABLE_FACE_ATTRIBUTE, HF_ENABLE_QUALITY, HF_ENABLE_INTERACTION
|
||||
|
||||
# Face track mode
|
||||
from inspireface.modules.core.native import HF_DETECT_MODE_ALWAYS_DETECT, HF_DETECT_MODE_LIGHT_TRACK, HF_DETECT_MODE_TRACK_BY_DETECTION
|
||||
|
||||
@@ -3,6 +3,12 @@ import cv2
|
||||
import inspireface as ifac
|
||||
from inspireface.param import *
|
||||
import click
|
||||
import numpy as np
|
||||
|
||||
race_tags = ["Black", "Asian", "Latino/Hispanic", "Middle Eastern", "White"]
|
||||
gender_tags = ["Female", "Male", ]
|
||||
age_bracket_tags = ["0-2 years old", "3-9 years old", "10-19 years old", "20-29 years old", "30-39 years old",
|
||||
"40-49 years old", "50-59 years old", "60-69 years old", "more than 70 years old"]
|
||||
|
||||
@click.command()
|
||||
@click.argument("resource_path")
|
||||
@@ -17,7 +23,7 @@ def case_face_detection_image(resource_path, image_path):
|
||||
assert ret, "Launch failure. Please ensure the resource path is correct."
|
||||
|
||||
# Optional features, loaded during session creation based on the modules specified.
|
||||
opt = HF_ENABLE_FACE_RECOGNITION | HF_ENABLE_QUALITY | HF_ENABLE_MASK_DETECT | HF_ENABLE_LIVENESS
|
||||
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)
|
||||
|
||||
# Load the image using OpenCV.
|
||||
@@ -35,12 +41,33 @@ def case_face_detection_image(resource_path, image_path):
|
||||
print(f"idx: {idx}")
|
||||
# Print Euler angles of the face.
|
||||
print(f"roll: {face.roll}, yaw: {face.yaw}, pitch: {face.pitch}")
|
||||
# Draw bounding box around the detected face.
|
||||
|
||||
# Get face bounding box
|
||||
x1, y1, x2, y2 = face.location
|
||||
cv2.rectangle(draw, (x1, y1), (x2, y2), (0, 0, 255), 2)
|
||||
|
||||
# Calculate center, size, and angle
|
||||
center = ((x1 + x2) / 2, (y1 + y2) / 2)
|
||||
size = (x2 - x1, y2 - y1)
|
||||
angle = face.roll # 这里使用 roll 角度
|
||||
|
||||
# Get rotation matrix
|
||||
rotation_matrix = cv2.getRotationMatrix2D(center, angle, 1.0)
|
||||
|
||||
# Apply rotation to the bounding box corners
|
||||
rect = ((center[0], center[1]), (size[0], size[1]), angle)
|
||||
box = cv2.boxPoints(rect)
|
||||
box = box.astype(int)
|
||||
|
||||
# Draw the rotated bounding box
|
||||
cv2.drawContours(draw, [box], 0, (100, 180, 29), 2)
|
||||
|
||||
# Draw landmarks
|
||||
lmk = session.get_face_dense_landmark(face)
|
||||
for x, y in lmk.astype(int):
|
||||
cv2.circle(draw, (x, y), 0, (220, 100, 0), 2)
|
||||
|
||||
# Features must be enabled during session creation to use them here.
|
||||
select_exec_func = HF_ENABLE_QUALITY | HF_ENABLE_MASK_DETECT | HF_ENABLE_LIVENESS
|
||||
select_exec_func = HF_ENABLE_QUALITY | HF_ENABLE_MASK_DETECT | HF_ENABLE_LIVENESS | HF_ENABLE_INTERACTION | HF_ENABLE_FACE_ATTRIBUTE
|
||||
# Execute the pipeline to obtain richer face information.
|
||||
extends = session.face_pipeline(image, faces, select_exec_func)
|
||||
for idx, ext in enumerate(extends):
|
||||
@@ -50,6 +77,11 @@ def case_face_detection_image(resource_path, image_path):
|
||||
print(f"quality: {ext.quality_confidence}")
|
||||
print(f"rgb liveness: {ext.rgb_liveness_confidence}")
|
||||
print(f"face mask: {ext.mask_confidence}")
|
||||
print(
|
||||
f"face eyes status: left eye: {ext.left_eye_status_confidence} right eye: {ext.right_eye_status_confidence}")
|
||||
print(f"gender: {gender_tags[ext.gender]}")
|
||||
print(f"race: {race_tags[ext.race]}")
|
||||
print(f"age: {age_bracket_tags[ext.age_bracket]}")
|
||||
|
||||
# Save the annotated image to the 'tmp/' directory.
|
||||
save_path = os.path.join("tmp/", "det.jpg")
|
||||
|
||||
@@ -2,7 +2,7 @@ import click
|
||||
import cv2
|
||||
import inspireface as ifac
|
||||
from inspireface.param import *
|
||||
|
||||
import numpy as np
|
||||
|
||||
@click.command()
|
||||
@click.argument("resource_path")
|
||||
@@ -51,8 +51,34 @@ def case_face_tracker_from_video(resource_path, source, show):
|
||||
# Process frame here (e.g., face detection/tracking).
|
||||
faces = session.face_detection(frame)
|
||||
for idx, face in enumerate(faces):
|
||||
print(f"{'==' * 20}")
|
||||
print(f"idx: {idx}")
|
||||
# Print Euler angles of the face.
|
||||
print(f"roll: {face.roll}, yaw: {face.yaw}, pitch: {face.pitch}")
|
||||
|
||||
# Get face bounding box
|
||||
x1, y1, x2, y2 = face.location
|
||||
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
|
||||
|
||||
# Calculate center, size, and angle
|
||||
center = ((x1 + x2) / 2, (y1 + y2) / 2)
|
||||
size = (x2 - x1, y2 - y1)
|
||||
angle = face.roll # 这里使用 roll 角度
|
||||
|
||||
# Get rotation matrix
|
||||
rotation_matrix = cv2.getRotationMatrix2D(center, angle, 1.0)
|
||||
|
||||
# Apply rotation to the bounding box corners
|
||||
rect = ((center[0], center[1]), (size[0], size[1]), angle)
|
||||
box = cv2.boxPoints(rect)
|
||||
box = box.astype(int)
|
||||
|
||||
# Draw the rotated bounding box
|
||||
cv2.drawContours(frame, [box], 0, (100, 180, 29), 2)
|
||||
|
||||
# Draw landmarks
|
||||
lmk = session.get_face_dense_landmark(face)
|
||||
for x, y in lmk.astype(int):
|
||||
cv2.circle(frame, (x, y), 0, (220, 100, 0), 2)
|
||||
|
||||
if show:
|
||||
cv2.imshow("Face Tracker", frame)
|
||||
|
||||
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 212 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 424 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 296 KiB |
|
Before Width: | Height: | Size: 391 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 165 KiB |
|
Before Width: | Height: | Size: 165 KiB |
|
Before Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 14 KiB |
@@ -8,14 +8,14 @@ import inspireface as ifac
|
||||
ENABLE_BENCHMARK_TEST = True
|
||||
|
||||
# Enabling will run all the CRUD tests, which will take time
|
||||
ENABLE_CRUD_TEST = True
|
||||
ENABLE_CRUD_TEST = False
|
||||
|
||||
# Enabling will run the face search benchmark, which takes time and must be configured with the correct
|
||||
# 'LFW_FUNNELED_DIR_PATH' parameter
|
||||
ENABLE_SEARCH_BENCHMARK_TEST = True
|
||||
|
||||
# Enabling will run the LFW dataset precision test, which will take time
|
||||
ENABLE_LFW_PRECISION_TEST = True
|
||||
ENABLE_LFW_PRECISION_TEST = False
|
||||
|
||||
# Testing model name
|
||||
TEST_MODEL_NAME = "Pikachu"
|
||||
|
||||
@@ -84,24 +84,6 @@ class FaceTrackerCase(unittest.TestCase):
|
||||
right_face_roll = faces[0].roll
|
||||
self.assertEqual(True, right_face_roll > 30)
|
||||
|
||||
def test_face_track_from_video(self):
|
||||
# Read a video file
|
||||
video_gen = read_video_generator(get_test_data("video/810_1684206192.mp4"))
|
||||
results = [self.engine_tk.face_detection(frame) for frame in video_gen]
|
||||
num_of_frame = len(results)
|
||||
num_of_track_loss = len([faces for faces in results if not faces])
|
||||
total_track_ids = [faces[0].track_id for faces in results if faces]
|
||||
num_of_id_switch = len([id_ for id_ in total_track_ids if id_ != 1])
|
||||
|
||||
# Calculate the loss rate of trace loss and switching id
|
||||
track_loss = num_of_track_loss / num_of_frame
|
||||
id_switch_loss = num_of_id_switch / len(total_track_ids)
|
||||
|
||||
# Not rigorous, only for the current test of this video file
|
||||
self.assertEqual(True, track_loss < 0.05)
|
||||
self.assertEqual(True, id_switch_loss < 0.1)
|
||||
|
||||
|
||||
@optional(ENABLE_BENCHMARK_TEST, "All benchmark related tests have been closed.")
|
||||
class FaceTrackerBenchmarkCase(unittest.TestCase):
|
||||
benchmark_results = list()
|
||||
|
||||
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 242 KiB |