ANSFR: raise default slow-attribute refresh interval to 20 frames
With the heavier v1.4 ONNX age-gender model, interval 20 benchmarks at throughput parity with the v1.1 pack (16.8 ms / 59 fps vs 16.0 ms / 62 fps on RTX 3070, classroom.mp4, ~3.1 faces/frame) versus 19.9 ms / 50 fps at the old default of 5. Attributes refresh every ~0.8 s on a 25 fps camera (1.6 s on stable scenes, faster when faces appear), which is ample for age/gender/emotion; head pose and recognition still run every frame. Deployments wanting fresher attributes can lower it at runtime via SetANSRFAttributeInterval. Full test suite passes at the new default; GetANSRFModelInfo reports "attribute_interval":20. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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<int, TrackIdentity> 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);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user