Fix AMD ALPR_OCR and custom model
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <atomic>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "Utility.h"
|
||||
#include "ANSLicense.h"
|
||||
@@ -98,6 +99,31 @@ namespace ANSCENTER
|
||||
bool _debugFlag{ false };
|
||||
bool _licenseValid{ false };
|
||||
bool _isInitialized{ false};
|
||||
|
||||
// Loading-in-progress flag — distinguishes the "LoadEngine() is still
|
||||
// running" state from "LoadEngine() never called or failed". Set by
|
||||
// ModelLoadingGuard at the top of LoadEngine() and cleared on exit
|
||||
// (success, failure, or exception). RunInference/RunInferencesBatch
|
||||
// consult this BEFORE _isInitialized so the early frames during the
|
||||
// 3+ second model-load window don't flood the log with bogus
|
||||
// "Model is not initialized" errors.
|
||||
std::atomic<bool> _modelLoading{ false };
|
||||
|
||||
// RAII helper: sets _modelLoading=true on construction, false on
|
||||
// destruction. Use at the top of LoadEngine() so the flag is always
|
||||
// cleared on every exit path.
|
||||
struct ModelLoadingGuard {
|
||||
std::atomic<bool>& flag;
|
||||
explicit ModelLoadingGuard(std::atomic<bool>& f) : flag(f) {
|
||||
flag.store(true, std::memory_order_release);
|
||||
}
|
||||
~ModelLoadingGuard() {
|
||||
flag.store(false, std::memory_order_release);
|
||||
}
|
||||
ModelLoadingGuard(const ModelLoadingGuard&) = delete;
|
||||
ModelLoadingGuard& operator=(const ModelLoadingGuard&) = delete;
|
||||
};
|
||||
|
||||
double _detectorThreshold{ 0.5 };
|
||||
double _ocrThreshold{ 0.5 };
|
||||
double _colorThreshold{ 0.0 };// If we use the colour information, this threshold should be greater than 0.0
|
||||
|
||||
Reference in New Issue
Block a user