Skip to content

Commit

Permalink
Face SDK v3.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nk2033 committed Apr 15, 2024
1 parent aa23caf commit 9bea2ee
Show file tree
Hide file tree
Showing 27 changed files with 62 additions and 68 deletions.
2 changes: 1 addition & 1 deletion examples/android/demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ android {
"share/faceanalysis/**",
"share/processing_block/age_estimator/**",
"share/processing_block/gender_estimator/**",
"share/age_second/**",
"share/processing_block/mask_estimator/**",
"share/liveness_2d_v2/**",
"share/faceattributes/**",
"share/iris/**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Demo(Activity activity, FacerecService service){
ageGenderEstimator = service.createAgeGenderEstimator("age_gender_estimator_v3.xml");
emotionsEstimator = service.createEmotionsEstimator("emotions_estimator.xml");
faceQualityEstimator = service.createFaceQualityEstimator("face_quality_estimator.xml");
faceMaskEstimator = service.createFaceAttributesEstimator("face_mask_estimator.xml");
faceMaskEstimator = service.createFaceAttributesEstimator("face_mask_estimator_v2.xml");
eyesOpennessEstimator = service.createFaceAttributesEstimator("eyes_openness_estimator_v2.xml");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:id="@+id/aboutText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Video recognition with depth and IR liveness demo for Telpo (v 0.2)\n\nFace SDK version 3.20.1\n"
android:text="Video recognition with depth and IR liveness demo for Telpo (v 0.2)\n\nFace SDK version 3.21.0\n"
android:layout_below="@+id/aboutLogo"
/>

Expand Down
5 changes: 2 additions & 3 deletions examples/android/video_recognition_demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ android {
include (
"conf/**",
"share/fda/**",
"share/facedetectors/config_lbf/**",
"share/facedetectors/blf/**",
"share/quality/**",
"share/quality_iso/**",
"share/face_quality/**",
"share/facerec/recognizers/method12v30/**",
"share/facerec/recognizers/method9v30mask/**",
"share/facerec/recognizers/method8v7/**",
"share/facerec/recognizers/method12v50/**",
"share/facerec/recognizers/method12v100/**",
"share/faceattributes/**",
"share/faceanalysis/**",
"license/**"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ private void init_settings(){
//fastest recognizer
editor.putString ("rec_method0", shared_settings.getString("rec_method0", "method12v30_recognizer.xml"));
//fastest recognizer for mask wearing
editor.putString ("rec_method1", shared_settings.getString("rec_method1", "method9v30mask_recognizer.xml"));
editor.putString ("rec_method1", shared_settings.getString("rec_method1", "method12v50_recognizer.xml"));
//recognizer for fastest loading
editor.putString ("rec_method2", shared_settings.getString("rec_method2", "method8v7_recognizer.xml"));
editor.putString ("rec_method2", shared_settings.getString("rec_method2", "method12v100_recognizer.xml"));

editor.putString ("threshold0", shared_settings.getString("threshold0", "6250"));
editor.putString ("threshold1", shared_settings.getString("threshold1", "3600"));
editor.putString ("threshold2", shared_settings.getString("threshold2", "7000"));
editor.putString ("threshold0", shared_settings.getString("threshold0", "6442"));
editor.putString ("threshold1", shared_settings.getString("threshold1", "11295"));
editor.putString ("threshold2", shared_settings.getString("threshold2", "7297"));
editor.putInt ("method index", shared_settings.getInt("method index", 0));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public VidRecDemo(
switch (method_index){
case 0:
method_recognizer = shared_settings.getString("rec_method0", "recognizer_latest_v30.xml" );
threshold = Float.parseFloat(shared_settings.getString("threshold0", "6250"));
threshold = Float.parseFloat(shared_settings.getString("threshold0", "6442"));
break;
case 1:
method_recognizer = shared_settings.getString("rec_method1", "method9v30mask_recognizer.xml" );
threshold = Float.parseFloat(shared_settings.getString("threshold1", "3600"));
method_recognizer = shared_settings.getString("rec_method1", "recognizer_latest_v50.xml" );
threshold = Float.parseFloat(shared_settings.getString("threshold1", "11295"));
break;
default:
method_recognizer = shared_settings.getString("rec_method2", "method8v7_recognizer.xml" );
threshold = Float.parseFloat(shared_settings.getString("threshold2", "7000" ));
method_recognizer = shared_settings.getString("rec_method2", "recognizer_latest_v100.xml" );
threshold = Float.parseFloat(shared_settings.getString("threshold2", "7297" ));
break;
}

Expand Down
6 changes: 3 additions & 3 deletions examples/cpp/demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,10 @@ void Worker::work(const pbio::InternalImageBuffer::Ptr frame)
{
if(!_face_attributes_estimator_masked_face)
{
#ifdef LEGACY_METASDK
_face_attributes_estimator_masked_face = _service->createFaceAttributesEstimator("face_mask_estimator.xml");
#else
#ifdef PROCESSING_BLOCK_API
_face_attributes_estimator_masked_face = _service->createFaceAttributesEstimator("face_mask_estimator_v2.xml");
#else
_face_attributes_estimator_masked_face = _service->createFaceAttributesEstimator("face_mask_estimator.xml");
#endif
}
pbio::FaceAttributesEstimator::Attribute attr = _face_attributes_estimator_masked_face->estimate(sample);
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/processing_block/processing_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ int main(int argc, char **argv)

pbio::ProcessingBlock processingBlock = service->createProcessingBlock(configCtx);

if(unit_type == "quality" || (unit_type == "liveness" && modification == "2d"))
if(unit_type == "quality" || unit_type == "liveness")
{
// create capturer
const pbio::Capturer::Ptr capturer = service->createCapturer("common_capturer_refa_fda_a.xml");
Expand Down
16 changes: 9 additions & 7 deletions examples/cpp/test_facecut/test_facecut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ int main(int argc, char const *argv[])
const pbio::QualityEstimator::Ptr quality_estimator = service->createQualityEstimator("quality_estimator_iso.xml");

// create age and gender estimator
const pbio::AgeGenderEstimator::Ptr age_gender_estimator = service->createAgeGenderEstimator("age_gender_estimator.xml");
//const pbio::AgeGenderEstimator::Ptr age_gender_estimator = service->createAgeGenderEstimator("age_gender_estimator_v2.xml");
const pbio::AgeGenderEstimator::Ptr age_gender_estimator = service->createAgeGenderEstimator("age_gender_estimator_v3.xml");

// create emotions estimator
const pbio::EmotionsEstimator::Ptr emotions_estimator = service->createEmotionsEstimator("emotions_estimator.xml");
const pbio::EmotionsEstimator::Ptr emotions_estimator = service->createEmotionsEstimator("emotions_estimator_v2.xml");

for(size_t file_i = 0; file_i < image_files.size(); ++file_i)
{
Expand Down Expand Up @@ -148,10 +147,13 @@ int main(int argc, char const *argv[])

switch(emotion)
{
case pbio::EmotionsEstimator::EMOTION_NEUTRAL: std::cout << " neutral"; break;
case pbio::EmotionsEstimator::EMOTION_HAPPY: std::cout << " happy"; break;
case pbio::EmotionsEstimator::EMOTION_ANGRY: std::cout << " angry"; break;
case pbio::EmotionsEstimator::EMOTION_SURPRISE: std::cout << " surprise"; break;
case pbio::EmotionsEstimator::EMOTION_NEUTRAL: std::cout << " neutral"; break;
case pbio::EmotionsEstimator::EMOTION_HAPPY: std::cout << " happy"; break;
case pbio::EmotionsEstimator::EMOTION_ANGRY: std::cout << " angry"; break;
case pbio::EmotionsEstimator::EMOTION_SURPRISE: std::cout << " surprise"; break;
case pbio::EmotionsEstimator::EMOTION_DISGUSTED: std::cout << " disgusted"; break;
case pbio::EmotionsEstimator::EMOTION_SCARED: std::cout << " scared"; break;
case pbio::EmotionsEstimator::EMOTION_SAD: std::cout << " sad"; break;
}

std::cout << " " << int(confidence * 100) << "%" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/test_filecap/test_filecap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main(int argc, char** argv)
if(argc != 5)
{
std::cout << "Usage: '" << argv[0] << " <dll_path> <conf_dir_path> <capturer_config_filename> <image_path>'" << std::endl;
std::cout << "Example: '" << argv[0] << default_dll_path << " ../conf/facerec common_capturer4.xml ~/Pictures/1.png'" << std::endl;
std::cout << "Example: '" << argv[0] << default_dll_path << " ../conf/facerec common_capturer_blf_fda_back.xml ~/Pictures/1.png'" << std::endl;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/video_recognition_demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int main(int argc, char const *argv[])
const Database database(
database_list_filepath,
*recognizer,
*service->createCapturer("common_capturer4_fda_singleface.xml"),
*service->createCapturer("common_capturer_blf_fda_front.xml"),
recognition_distance_threshold);
int active_liveness = enable_active_liveness == "yes" ? 1 : 0;
//std::vector<pbio::ActiveLiveness::CheckType> checks{
Expand Down
7 changes: 3 additions & 4 deletions examples/csharp/demo/vs/demo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ public Worker(string facerec_conf_dir, string capturer_conf, string license_dir)
.overrideParameter("downscale_rawsamples_to_preferred_size", 0)
.overrideParameter("iris_enabled", 1));
_quality_estimator = _service.createQualityEstimator("quality_estimator_iso.xml");
_age_geder_estimator = _service.createAgeGenderEstimator("age_gender_estimator.xml");
//_age_geder_estimator = _service.createAgeGenderEstimator("age_gender_estimator_v2.xml");
_emotions_estimator = _service.createEmotionsEstimator("emotions_estimator.xml");
_age_geder_estimator = _service.createAgeGenderEstimator("age_gender_estimator_v3.xml");
_emotions_estimator = _service.createEmotionsEstimator("emotions_estimator_v2.xml");
_face_quality_estimator = _service.createFaceQualityEstimator("face_quality_estimator.xml");
_liveness_2d_estimator = _service.createLiveness2DEstimator("liveness_2d_estimator_v3.xml");
_face_mask_estimator = _service.createFaceAttributesEstimator("face_mask_estimator.xml");
_face_mask_estimator = _service.createFaceAttributesEstimator("face_mask_estimator_v2.xml");
_eyes_openness_estimator = _service.createFaceAttributesEstimator("eyes_openness_estimator_v2.xml");

_flag_positions = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static int Main(string[] args)
}
);

if (unitType == "quality" || (unitType == "liveness" && options.Modification == "2d"))
if (unitType == "quality" || unitType == "liveness")
{
Capturer capturer = service.createCapturer("common_capturer_refa_fda_a.xml");

Expand Down
2 changes: 1 addition & 1 deletion examples/csharp/video_recognition_demo/vs/src/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int Main(string[] args)
Recognizer recognizer = service.createRecognizer(method_config, true, false, false);
float recognition_distance_threshold = Convert.ToSingle(recognizer.getROCCurvePointByFAR(recognition_far_threshold).distance);

Capturer capturer = service.createCapturer("common_capturer4_lbf_singleface.xml");
Capturer capturer = service.createCapturer("common_capturer_blf_fda_front.xml");
Database database = new Database(
database_dir,
recognizer,
Expand Down
4 changes: 4 additions & 0 deletions examples/flutter/demo/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
AA28C14A268C6A4500C72F3E /* (null) in Embed Frameworks */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
AA491684273284AE00EB280C /* facerec.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AA491682273284AE00EB280C /* facerec.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
AAE94CF62BC6BDF5000E817E /* onnxruntime.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AAE94CF42BC6BDF4000E817E /* onnxruntime.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -25,6 +26,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
AAE94CF62BC6BDF5000E817E /* onnxruntime.framework in Embed Frameworks */,
AA491684273284AE00EB280C /* facerec.framework in Embed Frameworks */,
AA28C14A268C6A4500C72F3E /* (null) in Embed Frameworks */,
);
Expand Down Expand Up @@ -52,6 +54,7 @@
9A1AD7A407B7128AE4698F7D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
AA28C147268C6A2B00C72F3E /* example */ = {isa = PBXFileReference; lastKnownFileType = folder; name = example; path = ..; sourceTree = "<group>"; };
AA491682273284AE00EB280C /* facerec.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = facerec.framework; path = ../assets/lib/facerec.framework; sourceTree = "<group>"; };
AAE94CF42BC6BDF4000E817E /* onnxruntime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = onnxruntime.framework; path = ../assets/lib/onnxruntime.framework; sourceTree = "<group>"; };
D8C7434838098826EA4C0B11 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -115,6 +118,7 @@
A8CC4499A2F02EA6EDAC4ABB /* Frameworks */ = {
isa = PBXGroup;
children = (
AAE94CF42BC6BDF4000E817E /* onnxruntime.framework */,
AA491682273284AE00EB280C /* facerec.framework */,
AA28C147268C6A2B00C72F3E /* example */,
593C6F756B5BFEAEFA2F8748 /* Pods_Runner.framework */,
Expand Down
2 changes: 1 addition & 1 deletion examples/flutter/demo/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class _MyAppState extends State<MyApp> {

setService(service){
_facerecService = service;
_recognizer = _facerecService!.createRecognizer("method10v30_recognizer.xml");
_recognizer = _facerecService!.createRecognizer("method12v30_recognizer.xml");
}

setIDTemplate(idTempl, idPhoto){
Expand Down
5 changes: 2 additions & 3 deletions examples/flutter/demo/lib/photo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ class _DetectPictureState extends State<DetectPicture> {
@override
void initState() {
super.initState();
_capturer = widget._facerecService.createCapturer(Config("common_capturer4_fda_singleface.xml").overrideParameter("score_threshold", 0.4));
// _capturer = widget._facerecService.createCapturer(Config("common_capturer_blf_fda_back.xml"));
// _capturer = widget._facerecService.createCapturer(Config("common_capturer_blf_fda_front.xml"));

_capturer = widget._facerecService.createCapturer(Config("common_capturer_blf_fda_front.xml"));

if (widget.cameras == null || widget.cameras.length < 1) {
print('No camera is found');
Expand Down
2 changes: 1 addition & 1 deletion examples/flutter/demo/lib/verification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _VerifyFacesState extends State<VerifyFaces> {
@override
void initState() {
super.initState();
_recognizer = widget._facerecService.createRecognizer("method10v30_recognizer.xml");
_recognizer = widget._facerecService.createRecognizer("method12v30_recognizer.xml");
setState(() {
res = _recognizer.verifyMatch(widget.templ1, widget.templ2);
widget.callback(res!);
Expand Down
2 changes: 1 addition & 1 deletion examples/flutter/demo/lib/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _VideoProcessingState extends State<VideoProcessing> {

_videoWorker = widget._facerecService.createVideoWorker(
VideoWorkerParams()
.recognizer_ini_file("method10v30_recognizer.xml")
.recognizer_ini_file("method12v30_recognizer.xml")
.video_worker_config(
Config("video_worker_fdatracker_blf_fda_front.xml")
.overrideParameter("enable_active_liveness", 1)
Expand Down
5 changes: 1 addition & 4 deletions examples/flutter/demo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ flutter:
- assets/share/face_quality/
- assets/share/faceanalysis/
- assets/share/facedetectors/blf/
- assets/share/facedetectors/uld/
- assets/share/facedetectors/config_lbf/
- assets/share/facedetectors/config_lbf_noise/
- assets/share/faceattributes/
- assets/share/fda/
- assets/share/facerec/recognizers/method10v30/
- assets/share/facerec/recognizers/method12v30/

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
Expand Down
10 changes: 2 additions & 8 deletions examples/flutter/scripts/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,5 @@ cp -r "$RESULT_DIR/share/faceattributes" "$CUR/share";
cp -r "$RESULT_DIR/share/fda" "$CUR/share";

cp -r "$RESULT_DIR/share/facedetectors/blf" "$CUR/share/facedetectors";
cp -r "$RESULT_DIR/share/facedetectors/uld" "$CUR/share/facedetectors";
cp -r "$RESULT_DIR/share/facedetectors/config_lbf" "$CUR/share/facedetectors";
cp -r "$RESULT_DIR/share/facedetectors/config_lbf_noise" "$CUR/share/facedetectors";

cp -r "$RESULT_DIR/share/facerec/recognizers/method10v30" "$CUR/share/facerec/recognizers";
rm "$CUR/share/facerec/recognizers/method10v30/method10v30_1.bin.dt";
rm "$CUR/share/facerec/recognizers/method10v30/method10v30_2.bin.dt";
rm "$CUR/share/facerec/recognizers/method10v30/method10v30_3.bin.dt";

cp -r "$RESULT_DIR/share/facerec/recognizers/method12v30" "$CUR/share/facerec/recognizers";
2 changes: 1 addition & 1 deletion examples/python/face_mask_and_eyes_closeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def detect(img_path):
capturer = service.create_capturer(Config("common_capturer_blf_fda_back.xml"))
print('Capturer created')

masked_face_estimator = service.create_face_attributes_estimator("face_mask_estimator.xml")
masked_face_estimator = service.create_face_attributes_estimator("face_mask_estimator_v2.xml")
print('Masked face estimator created')

eyes_openness_estimator = service.create_face_attributes_estimator("eyes_openness_estimator_v2.xml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def main():
recognizer = service.create_recognizer(args.method_config, True, True)
recognition_distance_threshold = recognizer.get_roc_curve_point_by_far(args.recognition_far_threshold).distance

capturer_config = Config("common_capturer4_fda_singleface.xml")
capturer_config = Config("common_capturer_blf_fda_front.xml")
capturer = service.create_capturer(capturer_config)

# create database
Expand Down
4 changes: 2 additions & 2 deletions include/facerec/libfacerec.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#ifndef FACEREC_LIBFACEREC_H_
#define FACEREC_LIBFACEREC_H_

#define LIBFACEREC_VERSION "3.20.01"
#define LIBFACEREC_VERSION "3.21.00"

#define LIBFACEREC_VERSION_HEX 0x032001
#define LIBFACEREC_VERSION_HEX 0x032100

#include "../pbio/FacerecService.h"

Expand Down
8 changes: 4 additions & 4 deletions python_api/face_sdk_3divi/modules/context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from multipledispatch import dispatch
from ctypes import c_char_p, c_void_p
from ctypes import c_int32, c_bool, c_long, c_ulong, c_double, POINTER
from ctypes import c_int32, c_int64, c_uint64, c_bool, c_double, POINTER

from .exception_check import check_exception, make_exception
from .complex_object import ComplexObject
Expand Down Expand Up @@ -106,7 +106,7 @@ def __setBool(self, value: bool):
def __setDataPtr(self, value: bytes):
exception = make_exception()

self._dll_handle.putDataPtr(self._impl, c_char_p(value), c_ulong(len(value)), exception)
self._dll_handle.putDataPtr(self._impl, c_char_p(value), c_uint64(len(value)), exception)
check_exception(exception, self._dll_handle)

def getDataPtr(self):
Expand All @@ -128,7 +128,7 @@ def __getBool(self):
def __setLong(self, value: int):
exception = make_exception()

self._dll_handle.putLong(self._impl, c_long(value), exception)
self._dll_handle.putLong(self._impl, c_int64(value), exception)

check_exception(exception, self._dll_handle)

Expand Down Expand Up @@ -256,7 +256,7 @@ def __get_keys(self) -> list:
cout_keys = self.__getLength()
buf = POINTER(c_char_p)

p_value_array = self._dll_handle.getKeys(self._impl, cout_keys, c_ulong(cout_keys), exception)
p_value_array = self._dll_handle.getKeys(self._impl, c_uint64(cout_keys), exception)
check_exception(exception, self._dll_handle)

result = [buf(i)[0].decode() for i in p_value_array[0]]
Expand Down
Loading

0 comments on commit 9bea2ee

Please sign in to comment.