ANSFR-UnitTest: point tests at the official SharedCore model packs

The re-packed ANS_FaceRecognizer_v1.4.zip (ONNX attribute models only, no
OpenVINO agegender/emotion IRs) is now the official pack and lives in the
canonical distribution folder C:\Projects\SharedCore next to v1.1.

Centralize every hardcoded pack path into three file-scope constants
(kFaceRecognizerV14Zip, kFaceRecognizerV11Zip, kFaceDetectorZip) used by
the model-switch test, classroom demo, benchmark, and parity test - a
future pack bump is a one-line edit. Verified against the official path:
adaface + ONNX attribute backends load and bench at 17.9 ms avg. The
slimmer pack was separately validated from a clean extraction (all
TestModelSwitchV14 checks pass without the OpenVINO fallback files).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 01:40:59 +10:00
co-authored by Claude Fable 5
parent 13eacc4ab2
commit 89b2efe182
+21 -15
View File
@@ -31,6 +31,12 @@ using namespace cv;
using namespace dnn;
using namespace std;
// Official model packs — C:\Projects\SharedCore is the canonical
// distribution folder for released ANS_FaceRecognizer zips.
static const std::string kFaceRecognizerV14Zip = "C:\\Projects\\SharedCore\\ANS_FaceRecognizer_v1.4.zip";
static const std::string kFaceRecognizerV11Zip = "C:\\Projects\\SharedCore\\ANS_FaceRecognizer_v1.1.zip";
static const std::string kFaceDetectorZip = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
template<typename T>
T GetOptionalValue(const boost::property_tree::ptree& pt, std::string attribute, T defaultValue) {
if (pt.count(attribute)) {
@@ -725,7 +731,7 @@ int ANSVISTest() {
// Get the current working directory
std::string databaseFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFR\\ANSFR.db";
std::string recognizerFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFR\\ANS_FaceRecognizer_v1.1.zip";
std::string facedetectorFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
std::string facedetectorFilePath = kFaceDetectorZip;
//std::string recognizerFilePath = "C:\\ProgramData\\ANSCENTER\\Shared\\ANS_FaceRecognizer_v1.1.zip";
@@ -1143,7 +1149,7 @@ int ANSVISTestFilePlayer() {
std::string databaseFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFR\\ANSFR.db";
std::string recognizerFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFR\\ANS_FaceRecognizer_v1.1.zip";
std::string facedetectorFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
std::string facedetectorFilePath = kFaceDetectorZip;
// std::string facedetectorFilePath = "C:\\ProgramData\\ANSCENTER\\Shared\\ANS_GenericFD(CPU)_v1.0.zip";
std::string videoFilePath = "E:\\Programs\\DemoAssets\\Videos\\TestFR\\school1.mp4";
@@ -1296,7 +1302,7 @@ int FRStressTest() {
std::filesystem::path currentPath = "C:\\Programs\\DemoAssets";
std::string databaseFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFR\\ANSFR.db";
std::string recognizerFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFR\\ANS_FaceRecognizer_v1.0.zip";
std::string facedetectorFilePath = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
std::string facedetectorFilePath = kFaceDetectorZip;
//std::string facedetectorFilePath = "C:\\ProgramData\\ANSCENTER\\Shared\\ANS_GenericFD(CPU)_v1.0.zip";
std::string imagePath = "C:\\Programs\\DemoAssets\\Images\\TestFaces\\Tien1.jpg";
@@ -1731,8 +1737,8 @@ static bool V14Check(bool condition, const std::string& label, int& failures)
int TestModelSwitchV14()
{
const std::string modelZip = "C:\\Programs\\Models\\ANS_FaceRecognizer_v1.4.zip";
const std::string detectorZip = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
const std::string modelZip = kFaceRecognizerV14Zip;
const std::string detectorZip = kFaceDetectorZip;
const std::string dbFolder = "C:\\Programs\\DemoAssets\\ANSFRDB\\v14_test";
const std::string dbFile = dbFolder + "\\ANSFR_v14_test.db";
const std::string enrollImage = "C:\\Programs\\DemoAssets\\TestImages\\FacialRecognition\\Obama+Oprah1.jpg";
@@ -1848,8 +1854,8 @@ int TestModelSwitchV14()
// ===========================================================================
int ClassroomAttributesVideoTest()
{
const std::string modelZip = "C:\\Programs\\Models\\ANS_FaceRecognizer_v1.4.zip";
const std::string detectorZip = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
const std::string modelZip = kFaceRecognizerV14Zip;
const std::string detectorZip = kFaceDetectorZip;
const std::string dbFile = "C:\\Programs\\DemoAssets\\ANSFRDB\\v14_test\\ANSFR_v14_test.db";
const std::string videoPath = "C:\\Programs\\DemoAssets\\Videos\\classroom.mp4";
const int maxFrames = 600;
@@ -1987,7 +1993,7 @@ static void RunSinglePackBenchmark(const std::string& label,
int warmupFrames = 10, int measuredFrames = 100)
{
const std::string videoPath = "C:\\Programs\\DemoAssets\\Videos\\classroom.mp4";
const std::string detectorZip = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
const std::string detectorZip = kFaceDetectorZip;
std::cout << "\n===== BENCH [" << label << "] =====" << std::endl;
std::cout << "model pack: " << modelZip << std::endl;
@@ -2072,10 +2078,10 @@ static void RunSinglePackBenchmark(const std::string& label,
int ModelSpeedBenchmark()
{
RunSinglePackBenchmark("v1.1 arcface + OpenVINO attrs",
"C:\\Projects\\SharedCore\\ANS_FaceRecognizer_v1.1.zip",
kFaceRecognizerV11Zip,
"C:\\Programs\\DemoAssets\\ANSFRDB\\v11_bench");
RunSinglePackBenchmark("v1.4 adaface + ONNX attrs",
"C:\\Programs\\Models\\ANS_FaceRecognizer_v1.4.zip",
kFaceRecognizerV14Zip,
"C:\\Programs\\DemoAssets\\ANSFRDB\\v14_bench");
return 0;
}
@@ -2090,7 +2096,7 @@ int ModelSpeedBenchmark()
static std::string ParityRunOnePack(const std::string& label,
const std::string& modelZip, const std::string& dbFolder)
{
const std::string detectorZip = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\ANSFDET\\ANS_GenericFD(GPU)_v1.0.zip";
const std::string detectorZip = kFaceDetectorZip;
const std::string imagePath = "C:\\Programs\\DemoAssets\\TestImages\\FacialRecognition\\Obama+Oprah1.jpg";
std::error_code ec;
@@ -2130,10 +2136,10 @@ int TestOutputFormatParity()
std::cout << "\n===== TestOutputFormatParity =====" << std::endl;
std::string oldJson = ParityRunOnePack("v1.1",
"C:\\Projects\\SharedCore\\ANS_FaceRecognizer_v1.1.zip",
kFaceRecognizerV11Zip,
"C:\\Programs\\DemoAssets\\ANSFRDB\\v11_parity");
std::string newJson = ParityRunOnePack("v1.4",
"C:\\Programs\\Models\\ANS_FaceRecognizer_v1.4.zip",
kFaceRecognizerV14Zip,
"C:\\Programs\\DemoAssets\\ANSFRDB\\v14_parity");
if (!V14Check(!oldJson.empty() && !newJson.empty(), "both packs produced results", failures))
@@ -2230,11 +2236,11 @@ int main(int argc, char** argv)
const std::string which = argv[2];
if (which == "old")
RunSinglePackBenchmark("v1.1 arcface + OpenVINO attrs",
"C:\\Projects\\SharedCore\\ANS_FaceRecognizer_v1.1.zip",
kFaceRecognizerV11Zip,
"C:\\Programs\\DemoAssets\\ANSFRDB\\v11_bench");
else if (which == "new")
RunSinglePackBenchmark("v1.4 adaface + ONNX attrs",
"C:\\Programs\\Models\\ANS_FaceRecognizer_v1.4.zip",
kFaceRecognizerV14Zip,
"C:\\Programs\\DemoAssets\\ANSFRDB\\v14_bench");
else
ModelSpeedBenchmark();