diff --git a/modules/ANSFR/ANSFR.h b/modules/ANSFR/ANSFR.h index c94522e..bd0fbdc 100644 --- a/modules/ANSFR/ANSFR.h +++ b/modules/ANSFR/ANSFR.h @@ -101,7 +101,9 @@ namespace ANSCENTER // How often the slow attributes (age/gender + emotions) refresh: // every N frames per camera (1 = every frame). Head pose still runs // every frame. The adaptive logic doubles N on stable scenes and - // halves it (min 2) when faces appear/disappear. Default 5. + // halves it (min 2) when faces appear/disappear. Default 20 — + // benchmarked at throughput parity with the v1.1 pack while the + // heavier v1.4 ONNX age-gender model is loaded. bool UpdateAttributeInterval(int frames); int GetAttributeInterval() const { return _attributeInterval; } @@ -195,7 +197,7 @@ namespace ANSCENTER int _faceThresholdSize; // number of frames to consider for face recognition bool _enableFaceQueue; double _faceDetectorScoreThreshold; // Face threshold score for face checker - int _attributeInterval{ 5 }; // Run slow attributes every N frames (1=every frame) + int _attributeInterval{ 20 }; // Run slow attributes every N frames (1=every frame) FaceChecker faceChecker; @@ -276,7 +278,7 @@ namespace ANSCENTER std::unordered_map trackIdentities; // trackId → accumulated identity // Adaptive interval state - int currentAttributeInterval = 5; // current adaptive interval + int currentAttributeInterval = 20; // current adaptive interval int stableFrameCount = 0; // frames with no new/lost trackIds int previousTrackIdCount = 0; // trackId count from last frame @@ -290,7 +292,7 @@ namespace ANSCENTER attributeFrameCounter = 0; cachedAttributes.clear(); trackIdentities.clear(); - currentAttributeInterval = 5; + currentAttributeInterval = 20; stableFrameCount = 0; previousTrackIdCount = 0; } @@ -399,10 +401,10 @@ extern "C" ANSFR_API int GetANSRFRecognizerModel(ANSCENTER::ANSFacialRe // {"recognizer_model":"adaface","agegender_backend":"onnx","emotion_backend":"onnx",...} extern "C" ANSFR_API int GetANSRFModelInfo(ANSCENTER::ANSFacialRecognition** Handle, LStrHandle modelInfo); // Slow-attribute (age/gender + emotions) refresh interval in frames per -// camera (1 = every frame, default 5; clamped to [1, 60]). Larger values +// camera (1 = every frame, default 20; clamped to [1, 60]). Larger values // cut the attribute-model GPU cost proportionally at the price of slower -// attribute updates — useful on smaller GPUs with the heavier v1.4 ONNX -// age-gender model. Returns 1 on success, -1 on invalid arguments. +// attribute updates; lower it for the freshest attributes on GPUs with +// headroom. Returns 1 on success, -1 on invalid arguments. extern "C" ANSFR_API int SetANSRFAttributeInterval(ANSCENTER::ANSFacialRecognition** Handle, int frames); diff --git a/tests/ANSFR-UnitTest/ANSFR-UnitTest.cpp b/tests/ANSFR-UnitTest/ANSFR-UnitTest.cpp index 044faa7..d95e72c 100644 --- a/tests/ANSFR-UnitTest/ANSFR-UnitTest.cpp +++ b/tests/ANSFR-UnitTest/ANSFR-UnitTest.cpp @@ -1991,7 +1991,7 @@ int ClassroomAttributesVideoTest() static void RunSinglePackBenchmark(const std::string& label, const std::string& modelZip, const std::string& dbFolder, int warmupFrames = 10, int measuredFrames = 100, - int attributeInterval = 0) // 0 = keep the DLL default (5) + int attributeInterval = 0) // 0 = keep the DLL default (20) { const std::string videoPath = "C:\\Programs\\DemoAssets\\Videos\\classroom.mp4"; const std::string detectorZip = kFaceDetectorZip;