disable ALPR checker by default
This commit is contained in:
@@ -116,8 +116,9 @@ int ANSLPR_CPU_VideoTest() {
|
||||
boost::property_tree::ptree detectionObjects;
|
||||
boost::property_tree::ptree pt;
|
||||
ANSCENTER::ANSALPR* infHandle = new ANSCENTER::ANSALPR_CPU();
|
||||
infHandle->SetALPRCheckerEnabled(true);
|
||||
std::string licenseKey = "";
|
||||
std::string modelZipFile = currentPath.string() + "\\ANS_GenericALPR_v1.0.zip";
|
||||
std::string modelZipFile = currentPath.string() + "\\ANS_GenericALPR_v1.0.zip";
|
||||
modelZipFile = "C:\\ProgramData\\ANSCENTER\\Shared\\ANS_GenericALPR_v1.0.zip";
|
||||
std::string videoFilePath = "C:\\Programs\\DemoAssets\\Videos\\ALRP\\ALPR1.mp4";
|
||||
std::string lpnResult;
|
||||
@@ -186,6 +187,7 @@ int ANSLPR_BigSize_VideoTest() {
|
||||
boost::property_tree::ptree detectionObjects;
|
||||
boost::property_tree::ptree pt;
|
||||
ANSCENTER::ANSALPR* infHandle = new ANSCENTER::ANSALPR_CPU();
|
||||
infHandle->SetALPRCheckerEnabled(true);
|
||||
std::string licenseKey = "";
|
||||
std::string modelZipFile = currentPath.string() + "\\ANS_GenericALPR_v1.0.zip";
|
||||
modelZipFile = "C:\\ProgramData\\ANSCENTER\\Shared\\ANS_GenericALPR_v1.0.zip";
|
||||
@@ -284,7 +286,8 @@ int ANSLPR_CPU_Inferences_FileTest() {
|
||||
std::string StrBox = readJsonFile("C:\\Projects\\ANLS\\Documents\\bboxStr.json");
|
||||
|
||||
int result = CreateANSALPRHandle(& infHandle, "", modelZipFile.c_str(), "",0,0.5,0.5,0);
|
||||
std::cout << "Init Result:" << result << std::endl;
|
||||
std::cout << "Init Result:" << result << std::endl;
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
unsigned int bufferLength = 0;
|
||||
|
||||
cv::Mat input = cv::imread(imageFilePath, cv::IMREAD_COLOR);
|
||||
@@ -341,6 +344,7 @@ int ANSLPR_CV_VideoTest() {
|
||||
std::string lpnResult;
|
||||
int result = CreateANSALPRHandle(& infHandle, licenseKey.c_str(), modelZipFile.c_str(), "",0,0.5,0.5,0);
|
||||
std::cout << "Loading ANSLRP:" << result << std::endl;
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
cv::VideoCapture capture(videoFilePath);
|
||||
if (!capture.isOpened()) {
|
||||
printf("could not read this video file...\n");
|
||||
@@ -421,7 +425,8 @@ int ANSLPR_OD_VideoTest() {
|
||||
double detectionColourThreshold = 0.5;
|
||||
int result = CreateANSALPRHandle(&infHandle, licenseKey.c_str(), modelZipFile.c_str(), "", engineType, detectionThreshold, ocrThreshold, detectionColourThreshold);
|
||||
std::cout << "Loading ANSLRP:" << result << std::endl;
|
||||
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
int loadEngine = LoadANSALPREngineHandle(&infHandle);
|
||||
std::cout << "Loading ANSLRP:" << loadEngine << std::endl;
|
||||
cv::VideoCapture capture(videoFilePath);
|
||||
@@ -506,6 +511,7 @@ int ANSLPR_OD_Inferences_FileTest() {
|
||||
double colourThreshold = 0.5;
|
||||
int result = CreateANSALPRHandle(&infHandle, licenseKey.c_str(), modelZipFile.c_str(), "", engineType, detectionThreshold, ocrThreshold, colourThreshold);
|
||||
std::cout << "Loading ANSLRP:" << result << std::endl;
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
|
||||
@@ -581,6 +587,7 @@ int ANSLPR_OD_FolderInferences_Test() {
|
||||
int result = CreateANSALPRHandle(&infHandle, licenseKey.c_str(), modelZipFile.c_str(), "",
|
||||
engineType, detectionThreshold, ocrThreshold, colourThreshold);
|
||||
std::cout << "Loading ANSLPR: " << result << std::endl;
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
auto startLoad = std::chrono::system_clock::now();
|
||||
int loadEngine = LoadANSALPREngineHandle(&infHandle);
|
||||
@@ -702,6 +709,7 @@ int ANSLPR_OD_INDOInferences_FileTest() {
|
||||
double ocrThreshold = 0.5;
|
||||
int result = CreateANSALPRHandle(&infHandle, licenseKey.c_str(), modelZipFile.c_str(), "", engineType, detectionThreshold, ocrThreshold, 0.5);
|
||||
std::cout << "Loading ANSLRP:" << result << std::endl;
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
int loadEngine = LoadANSALPREngineHandle(&infHandle);
|
||||
std::cout << "Init Result:" << result << std::endl;
|
||||
@@ -1210,6 +1218,7 @@ int ANSLPR_SingleTask_Test() {
|
||||
ANSCENTER::ANSOPENCV::DeinitCameraNetwork();
|
||||
return -1;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&alprHandle, 1);
|
||||
|
||||
printf("[Task0] Loading ALPR engine...\n");
|
||||
int loadResult = LoadANSALPREngineHandle(&alprHandle);
|
||||
@@ -1388,6 +1397,7 @@ int ANSLPR_CPU_StressTest() {
|
||||
g_log.add(std::string(tag) + " ALPR create FAILED");
|
||||
continue;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&alprHandles[i], 1);
|
||||
|
||||
printf("%s Loading ALPR engine...\n", tag);
|
||||
int loadResult = LoadANSALPREngineHandle(&alprHandles[i]);
|
||||
@@ -1713,6 +1723,7 @@ int ANSLPR_MultiGPU_StressTest() {
|
||||
taskStates[i].statusMsg = "ALPR create failed";
|
||||
continue;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&alprHandles[i], 1);
|
||||
|
||||
printf("%s Loading ALPR engine (%s)...\n", tag, hasGpu ? "TensorRT" : "CPU");
|
||||
g_log.add(std::string(tag) + " Loading ALPR engine...");
|
||||
@@ -2602,6 +2613,7 @@ int ANSLPR_MultiGPU_StressTest_SimulatedCam() {
|
||||
taskStates[i].statusMsg = "ALPR create failed";
|
||||
continue;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&alprHandles[i], 1);
|
||||
|
||||
printf("%s Loading ALPR engine (TensorRT)...\n", tag);
|
||||
g_log.add(std::string(tag) + " Loading ALPR engine...");
|
||||
@@ -3231,6 +3243,7 @@ int ANSLPR_MultiGPU_StressTest_FilePlayer() {
|
||||
taskStates[i].statusMsg = "ALPR create failed";
|
||||
continue;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&alprHandles[i], 1);
|
||||
|
||||
printf("%s Loading ALPR engine (TensorRT)...\n", tag);
|
||||
g_log.add(std::string(tag) + " Loading ALPR engine...");
|
||||
@@ -3610,6 +3623,7 @@ int ANSLPR_OD_CPU_VideoTest() {
|
||||
std::cerr << "[LPR-CPU] FAILED: CreateANSALPRHandle returned " << createResult << std::endl;
|
||||
return -1;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
// Step 2: Load engine
|
||||
std::cout << "[LPR-CPU] Step 2: Loading engine..." << std::endl;
|
||||
@@ -3796,6 +3810,7 @@ int ALPR_OCR_Test() {
|
||||
std::cerr << "Failed to create ANSALPR_OCR handle" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
// Step 2: Set country to Japan
|
||||
ANSALPR_SetCountry(&infHandle, 5); // JAPAN = 5
|
||||
@@ -3953,6 +3968,7 @@ int ALPR_OCR_VideoTest() {
|
||||
std::cerr << "Failed to create ANSALPR_OCR handle" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
// Step 2: Set country (VIETNAM = 0 — adjust to match the dataset if needed).
|
||||
// Country codes match country.txt parsing in ANSALPR_OCR::Initialize:
|
||||
@@ -4780,6 +4796,7 @@ int ALPR_Helmet_Parallel_VideoTest() {
|
||||
ANSCENTER::ANSOPENCV::DeinitCameraNetwork();
|
||||
return -2;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&alprHandle, 1);
|
||||
ANSALPR_SetCountry(&alprHandle, alprCountry);
|
||||
auto loadStart = std::chrono::steady_clock::now();
|
||||
int loadResult = LoadANSALPREngineHandle(&alprHandle);
|
||||
@@ -5056,6 +5073,7 @@ int ALPR_OCR_FolderInferences_Test() {
|
||||
std::cerr << "Failed to create ANSALPR_OCR handle" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
ANSALPR_SetALPRCheckerEnabled(&infHandle, 1);
|
||||
|
||||
// Step 2: Country = VIETNAM (0). Activates Vietnam-only post-processing
|
||||
// (alnum filter + uppercase + format validation against the 11 standard
|
||||
|
||||
Reference in New Issue
Block a user