Improve ALPR_OCR peformance

This commit is contained in:
2026-04-14 20:30:21 +10:00
parent 3349b45ade
commit f9a0af8949
18 changed files with 991 additions and 77 deletions

View File

@@ -11,6 +11,9 @@ namespace onnxocr {
class ONNXOCRDetector : public BasicOrtHandler {
public:
explicit ONNXOCRDetector(const std::string& onnx_path, unsigned int num_threads = 1);
explicit ONNXOCRDetector(const std::string& onnx_path,
const OrtHandlerOptions& options,
unsigned int num_threads = 1);
~ONNXOCRDetector() override = default;
// Run text detection on an image
@@ -21,7 +24,12 @@ public:
float unclipRatio = kDetUnclipRatio,
bool useDilation = false);
// Pre-warm cuDNN/TRT at a canonical 320x320 input so the first real
// call doesn't pay the algorithm-selection tax. Idempotent.
void Warmup();
private:
bool _warmedUp = false;
Ort::Value transform(const cv::Mat& mat) override;
Ort::Value transformBatch(const std::vector<cv::Mat>& images) override;