ANSFR: configurable slow-attribute refresh interval
New API SetANSRFAttributeInterval(Handle, frames) / UpdateAttributeInterval (1..60, default 5) controls how often the slow attributes (age/gender + emotions) refresh per camera; head pose and recognition are unaffected. GetANSRFModelInfo now reports "attribute_interval". The adaptive logic's stable-scene branch previously capped at a hardcoded 10 - it now doubles the configured interval instead (default behaviour 10/5/2 unchanged). Motivation: the v1.4 ViT age-gender model is heavier per attribute frame than the old OpenVINO IR. Interval sweep on RTX 3070 (classroom.mp4, ~3.1 faces/frame) vs the v1.1 baseline at 16.0 ms / 62 fps: interval 5 (default): 19.9 ms / 50 fps (+3.9 ms) interval 10: 17.1 ms / 58 fps (+1.1 ms) interval 20: 16.5 ms / 61 fps (parity) Recommendation: default on 8 GB GPUs; interval 10 on small-VRAM machines. ANSFR-UnitTest: --bench old|new [interval] runs the sweep. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,13 @@ namespace ANSCENTER
|
||||
bool UpdateFaceQueue(int queueSize, int faceThresholdSize, bool enableFaceQueue);
|
||||
bool GetFaceQueue(int& queueSize, int& faceThresholdSize, bool& enableFaceQueue);
|
||||
|
||||
// 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.
|
||||
bool UpdateAttributeInterval(int frames);
|
||||
int GetAttributeInterval() const { return _attributeInterval; }
|
||||
|
||||
// Recognizer model switching (0 = AdaFace [default], 1 = ArcFace).
|
||||
// Before LoadEngine: just records the preference. After LoadEngine:
|
||||
// re-initializes the recognizer, regenerates every stored embedding
|
||||
@@ -391,6 +398,12 @@ extern "C" ANSFR_API int GetANSRFRecognizerModel(ANSCENTER::ANSFacialRe
|
||||
// JSON describing the loaded models, e.g.
|
||||
// {"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
|
||||
// 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.
|
||||
extern "C" ANSFR_API int SetANSRFAttributeInterval(ANSCENTER::ANSFacialRecognition** Handle, int frames);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user