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

@@ -14,15 +14,6 @@ namespace ANSCENTER {
// Call base class Initialize
bool result = ANSFDBase::Initialize(licenseKey, modelConfig, modelZipFilePath, modelZipPassword, labelMap);
if (!result) return false;
// Serialize derived init against concurrent extract re-entries on the
// same folder. See ModelFolderLockGuard in ANSEngineCommon.h.
ModelFolderLockGuard _flg(_modelFolder, "ANSSCRFDFD::Initialize");
if (!_flg.acquired()) {
this->_logger.LogError("ANSSCRFDFD::Initialize",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
labelMap = "Face";
_licenseValid = true;
try {
@@ -84,15 +75,6 @@ namespace ANSCENTER {
// We need to get the _modelFolder
bool result = ANSFDBase::LoadModel(modelZipFilePath, modelZipPassword);
if (!result) return false;
// Serialize derived init against concurrent extract re-entries on the
// same folder. See ModelFolderLockGuard in ANSEngineCommon.h.
ModelFolderLockGuard _flg(_modelFolder, "ANSSCRFDFD::LoadModel");
if (!_flg.acquired()) {
this->_logger.LogError("ANSSCRFDFD::LoadModel",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
const bool engineAlreadyLoaded = _isInitialized && m_trtEngine != nullptr;
_modelConfig.modelType = ModelType::FACEDETECT;
_modelConfig.detectionType = DetectionType::FACEDETECTOR;
@@ -151,15 +133,6 @@ namespace ANSCENTER {
// We need to get the _modelFolder
bool result = ANSFDBase::LoadModelFromFolder(licenseKey, modelConfig, modelName, className, modelFolder, labelMap);
if (!result) return false;
// Serialize derived init against concurrent extract re-entries on the
// same folder. See ModelFolderLockGuard in ANSEngineCommon.h.
ModelFolderLockGuard _flg(_modelFolder, "ANSSCRFDFD::LoadModelFromFolder");
if (!_flg.acquired()) {
this->_logger.LogError("ANSSCRFDFD::LoadModelFromFolder",
"Timed out waiting for model-folder lock: " + _modelFolder,
__FILE__, __LINE__);
return false;
}
std::string _modelName = modelName;
if (_modelName.empty()) {
_modelName = "scrfdface";
@@ -437,8 +410,6 @@ namespace ANSCENTER {
return output;
}
std::vector<Object> ANSSCRFDFD::InferenceDynamic(const cv::Mat& input, const std::string& camera_id) {
if (_modelLoading.load()) return {};
auto lock = TryLockWithTimeout("ANSSCRFDFD::InferenceDynamic");
@@ -602,7 +573,6 @@ namespace ANSCENTER {
return output;
}
std::vector<Object> ANSSCRFDFD::Detect(const cv::Mat& input)
{
// Phase 1: Validation + engine dims (brief lock)