Remove locks

This commit is contained in:
2026-04-24 17:10:29 +10:00
parent 7a11c9617b
commit 3a527d2dad
51 changed files with 38 additions and 1251 deletions

View File

@@ -304,15 +304,6 @@ namespace ANSCENTER {
this->_logger.LogError("ANSALPR_CPU::Initialize. Output model folder is not exist", _modelFolder, __FILE__, __LINE__);
return false; // That means the model file is not exist or the password is not correct
}
// Serialize init against concurrent extract re-entries on the same
// folder. See ModelFolderLockGuard in Utility.h.
ANSCENTER::ModelFolderLockGuard _flg(_modelFolder, "ANSALPR_CPU::Initialize");
if (!_flg.acquired()) {
this->_logger.LogError("ANSALPR_CPU::Initialize",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
// 3. Load LD model
alprChecker.Init(MAX_ALPR_FRAME);
@@ -326,15 +317,6 @@ namespace ANSCENTER {
bool ANSALPR_CPU::LoadEngine() {
std::lock_guard<std::recursive_mutex> lock(_mutex);
try {
// Serialize init against concurrent extract re-entries on the same
// folder. See ModelFolderLockGuard in Utility.h.
ANSCENTER::ModelFolderLockGuard _flg(_modelFolder, "ANSALPR_CPU::LoadEngine");
if (!_flg.acquired()) {
this->_logger.LogError("ANSALPR_CPU::LoadEngine",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
// 1. Load license plate detection model (using CPU OpenVINO)
if (_lprDetector) _lprDetector.reset();
std::string lprModel = CreateFilePath(_modelFolder, "lprModel.xml");
@@ -460,7 +442,6 @@ namespace ANSCENTER {
float iouThreshold = 0.4;
std::vector<Object> lprOutput = ANSUtilityHelper::ApplyNMS(lprOutputRaw, iouThreshold);
if (!lprOutput.empty()) {
if (!ppocr) {
this->_logger.LogFatal("ANSALPR_CPU::Inference", "PPOCR instance is null", __FILE__, __LINE__);
@@ -923,7 +904,6 @@ namespace ANSCENTER {
// std::string numberCode = cleanOCRText.substr(7, 2);// 00 to 99
// std::string newSuburbCode = convertStringToDigits(suburbCode);
// // Convert the newSuburbCode to an integer
// int numericValue = std::stoi(newSuburbCode);
// // Check if it is within the range 11 to 99
@@ -986,7 +966,6 @@ namespace ANSCENTER {
// std::string numberCode = cleanOCRText.substr(7, 3);// 00 to 99
// std::string newSuburbCode = convertStringToDigits(suburbCode);
// // Convert the newSuburbCode to an integer
// int numericValue = std::stoi(newSuburbCode);
// // Check if it is within the range 11 to 99
@@ -1280,7 +1259,6 @@ namespace ANSCENTER {
}
}
// Align plate
cv::Mat ANSALPR_CPU::alignPlateForOCR(const cv::Mat& fullImage, const cv::Rect& bbox) {
try {