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

@@ -431,15 +431,6 @@ namespace ANSCENTER {
this->_logger.LogError("ANSALPR_OD::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_OD::Initialize");
if (!_flg.acquired()) {
this->_logger.LogError("ANSALPR_OD::Initialize",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
// Check country
std::string countryFile = CreateFilePath(_modelFolder, "country.txt");
@@ -518,15 +509,6 @@ namespace ANSCENTER {
bool ANSALPR_OD::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_OD::LoadEngine");
if (!_flg.acquired()) {
this->_logger.LogError("ANSALPR_OD::LoadEngine",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
WriteEventLog("ANSALPR_OD::LoadEngine: Step 1 - Starting engine load");
this->_logger.LogInfo("ANSALPR_OD::LoadEngine", "Step 1: Starting engine load", __FILE__, __LINE__);
@@ -547,7 +529,6 @@ namespace ANSCENTER {
_lpColourModelConfig.modelConfThreshold = 0.5;
_lpColourModelConfig.modelMNSThreshold = 0.5;
_lpdmodelConfig.inpHeight = 640;
_lpdmodelConfig.inpWidth = 640;
@@ -578,7 +559,6 @@ namespace ANSCENTER {
_lpColourModelConfig.optInputHeight = 224;
_lpColourModelConfig.optInputWidth = 224;
std::string lprModel = CreateFilePath(_modelFolder, "lpd.onnx");
std::string lprClassesFile = CreateFilePath(_modelFolder, "lpd.names");
@@ -1364,7 +1344,6 @@ namespace ANSCENTER {
}
}
// Check if this is actually a single row
// If max gap is too small relative to character height, it's a single row
std::vector<std::vector<Object>> rows;
@@ -3086,7 +3065,6 @@ namespace ANSCENTER {
}
}
if (maxGap < avgHeight * ROW_SPLIT_MIN_GAP_FACTOR) {
// Single row - sort by projection along reading direction
std::vector<std::pair<float, size_t>> allProj;
@@ -3119,7 +3097,6 @@ namespace ANSCENTER {
if (avgY0 > avgY1)
std::swap(rowIndices[0], rowIndices[1]);
// Sort each row by projection along reading direction
std::string ocrText;
ocrText.reserve(n);