ClipApp.h 811 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef __CLIPAPP_H
  2. #define __CLIPAPP_H
  3. #include "ClipCfg.h"
  4. #include "Locks.h"
  5. #include "ExHeaders.h"
  6. #include <opencv2/opencv.hpp>
  7. #include "onnxruntime_cxx_api.h"
  8. NAMESPACE_MAS_BEGIN
  9. NAMESPACE_CLIP_BEGIN
  10. class ClipApp {
  11. public:
  12. static ClipApp* Instance();
  13. static void DestroyInstance();
  14. TZ_INT Initialize(const std::string& initParam);
  15. TZ_INT Dispose();
  16. TZ_INT DoDetect(cv::Mat& input, ClipDetectResult& detRes);
  17. private:
  18. ClipApp();
  19. ~ClipApp();
  20. TZ_BOOL m_inited;
  21. TZ_INT m_usecnt;
  22. Ort::Env* m_env;
  23. Ort::Session* m_session;
  24. Ort::SessionOptions m_sessionOptions;
  25. static tzc::Mutex _mutex;
  26. static ClipApp* _instance;
  27. TZ_INT PreprocessImage(cv::Mat& input, std::vector<float>& outputTensor);
  28. };
  29. NAMESPACE_CLIP_END
  30. NAMESPACE_MAS_END
  31. #endif