#pragma once #include "RTOCRTypes.h" #include "engine.h" #include "engine/EnginePoolManager.h" #include #include namespace ANSCENTER { namespace rtocr { class RTOCRClassifier { public: RTOCRClassifier() = default; ~RTOCRClassifier(); RTOCRClassifier(const RTOCRClassifier&) = delete; RTOCRClassifier& operator=(const RTOCRClassifier&) = delete; bool Initialize(const std::string& onnxPath, int gpuId = 0, const std::string& engineCacheDir = ""); // Classify a batch of text images // Returns vector of (cls_label, cls_score) per image // cls_label: 0 = normal, 1 = rotated 180 degrees std::vector> Classify( const std::vector& images, float clsThresh = kClsThresh); private: std::shared_ptr> m_engine = nullptr; EnginePoolManager::PoolKey m_poolKey; bool m_usingSharedPool = false; std::mutex _mutex; }; } // namespace rtocr } // namespace ANSCENTER