Fix mutex lock issues (OCR and FR)

This commit is contained in:
2026-04-13 20:38:40 +10:00
parent 844d7396b2
commit 8e60126c4c
16 changed files with 227 additions and 18 deletions

View File

@@ -102,6 +102,7 @@ namespace ANSCENTER {
std::vector<Object> ANSOVFD::RunInference(const cv::Mat& input, const std::string& camera_id, bool useDynamicImage, bool validateFace, bool facelivenessCheck) {
// ── DML device-lost recovery (outside mutex) ──────────────
if (_dmlDeviceLost && _face_detector) {
if (_modelLoading.load()) return {};
// The DML session is broken — recreate on CPU
try {
auto cpuDetector = std::make_unique<ANSCENTER::SCRFD>(
@@ -136,6 +137,7 @@ namespace ANSCENTER {
std::vector<Object> ANSOVFD::RunInference(const cv::Mat& input, bool useDynamicImage, bool validateFace, bool facelivenessCheck) {
// ── DML device-lost recovery (outside mutex) ──────────────
if (_dmlDeviceLost && _face_detector) {
if (_modelLoading.load()) return {};
try {
auto cpuDetector = std::make_unique<ANSCENTER::SCRFD>(
_scrfdModelPath, ANSCENTER::EngineType::CPU);