Fix mutex lock issues (OCR and FR)
This commit is contained in:
@@ -212,7 +212,9 @@ namespace ANSCENTER {
|
||||
return RunInference(input, "OCRCPUCAM");
|
||||
}
|
||||
std::vector<ANSCENTER::OCRObject> ANSCPUOCR::RunInference(const cv::Mat& input, const std::string& cameraId) {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
if (_modelLoading.load()) return {};
|
||||
auto lock = TryLockWithTimeout("ANSCPUOCR::RunInference");
|
||||
if (!lock.owns_lock()) return {};
|
||||
|
||||
// Early validation
|
||||
if (!_licenseValid) {
|
||||
@@ -311,7 +313,9 @@ namespace ANSCENTER {
|
||||
}
|
||||
|
||||
std::vector<ANSCENTER::OCRObject> ANSCPUOCR::RunInference(const cv::Mat& input, const std::vector<cv::Rect>& Bbox) {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
if (_modelLoading.load()) return {};
|
||||
auto lock = TryLockWithTimeout("ANSCPUOCR::RunInference(Bbox)");
|
||||
if (!lock.owns_lock()) return {};
|
||||
|
||||
// Early validation
|
||||
if (!_licenseValid) {
|
||||
@@ -434,7 +438,9 @@ namespace ANSCENTER {
|
||||
const std::vector<cv::Rect>& Bbox,
|
||||
const std::string& cameraId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
if (_modelLoading.load()) return {};
|
||||
auto lock = TryLockWithTimeout("ANSCPUOCR::RunInference(Bbox,CamId)");
|
||||
if (!lock.owns_lock()) return {};
|
||||
|
||||
// Early validation
|
||||
if (!_licenseValid) {
|
||||
|
||||
Reference in New Issue
Block a user