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:
@@ -1990,7 +1990,8 @@ int ClassroomAttributesVideoTest()
|
||||
// ===========================================================================
|
||||
static void RunSinglePackBenchmark(const std::string& label,
|
||||
const std::string& modelZip, const std::string& dbFolder,
|
||||
int warmupFrames = 10, int measuredFrames = 100)
|
||||
int warmupFrames = 10, int measuredFrames = 100,
|
||||
int attributeInterval = 0) // 0 = keep the DLL default (5)
|
||||
{
|
||||
const std::string videoPath = "C:\\Programs\\DemoAssets\\Videos\\classroom.mp4";
|
||||
const std::string detectorZip = kFaceDetectorZip;
|
||||
@@ -2015,6 +2016,10 @@ static void RunSinglePackBenchmark(const std::string& label,
|
||||
auto loadMs = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - loadStart).count();
|
||||
std::cout << "LoadANSRFEngine = " << le << " (" << loadMs << " ms)" << std::endl;
|
||||
if (attributeInterval > 0) {
|
||||
SetANSRFAttributeInterval(&h, attributeInterval);
|
||||
std::cout << "Attribute interval overridden to " << attributeInterval << std::endl;
|
||||
}
|
||||
std::cout << "Model info: " << h->GetActiveModelInfo() << std::endl;
|
||||
if (le != 1) { ReleaseANSRFHandle(&h); return; }
|
||||
|
||||
@@ -2231,17 +2236,24 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
// Single-pack benchmark mode (one pack per process so the packs cannot
|
||||
// influence each other): ANSFR-UnitTest.exe --bench old|new|both
|
||||
// influence each other): ANSFR-UnitTest.exe --bench old|new|both [interval]
|
||||
// The optional interval overrides the slow-attribute refresh interval
|
||||
// (default 5) via SetANSRFAttributeInterval.
|
||||
if (argc >= 3 && std::string(argv[1]) == "--bench") {
|
||||
const std::string which = argv[2];
|
||||
const int interval = (argc >= 4) ? std::atoi(argv[3]) : 0;
|
||||
const std::string tag = (interval > 0)
|
||||
? (" @interval " + std::to_string(interval)) : std::string();
|
||||
if (which == "old")
|
||||
RunSinglePackBenchmark("v1.1 arcface + OpenVINO attrs",
|
||||
RunSinglePackBenchmark("v1.1 arcface + OpenVINO attrs" + tag,
|
||||
kFaceRecognizerV11Zip,
|
||||
"C:\\Programs\\DemoAssets\\ANSFRDB\\v11_bench");
|
||||
"C:\\Programs\\DemoAssets\\ANSFRDB\\v11_bench",
|
||||
10, 100, interval);
|
||||
else if (which == "new")
|
||||
RunSinglePackBenchmark("v1.4 adaface + ONNX attrs",
|
||||
RunSinglePackBenchmark("v1.4 adaface + ONNX attrs" + tag,
|
||||
kFaceRecognizerV14Zip,
|
||||
"C:\\Programs\\DemoAssets\\ANSFRDB\\v14_bench");
|
||||
"C:\\Programs\\DemoAssets\\ANSFRDB\\v14_bench",
|
||||
10, 100, interval);
|
||||
else
|
||||
ModelSpeedBenchmark();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user