bindings_onnx.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level
  3. // directory of this distribution and at http://opencv.org/license.html.
  4. #ifndef OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
  5. #define OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
  6. #include <opencv2/gapi/gkernel.hpp> // GKernelPackage
  7. #include <opencv2/gapi/infer/onnx.hpp> // Params
  8. #include "opencv2/gapi/own/exports.hpp" // GAPI_EXPORTS
  9. #include <opencv2/gapi/util/any.hpp>
  10. #include <string>
  11. namespace cv {
  12. namespace gapi {
  13. namespace onnx {
  14. // NB: Used by python wrapper
  15. // This class can be marked as SIMPLE, because it's implemented as pimpl
  16. class GAPI_EXPORTS_W_SIMPLE PyParams {
  17. public:
  18. GAPI_WRAP
  19. PyParams() = default;
  20. GAPI_WRAP
  21. PyParams(const std::string& tag, const std::string& model_path);
  22. GAPI_WRAP
  23. PyParams& cfgMeanStd(const std::string &layer_name,
  24. const cv::Scalar &m,
  25. const cv::Scalar &s);
  26. GAPI_WRAP
  27. PyParams& cfgNormalize(const std::string &layer_name, bool flag);
  28. GAPI_WRAP
  29. PyParams& cfgAddExecutionProvider(ep::OpenVINO ep);
  30. GAPI_WRAP
  31. PyParams& cfgAddExecutionProvider(ep::DirectML ep);
  32. GAPI_WRAP
  33. PyParams& cfgAddExecutionProvider(ep::CoreML ep);
  34. GAPI_WRAP
  35. PyParams& cfgAddExecutionProvider(ep::CUDA ep);
  36. GAPI_WRAP
  37. PyParams& cfgAddExecutionProvider(ep::TensorRT ep);
  38. GAPI_WRAP
  39. PyParams& cfgDisableMemPattern();
  40. GBackend backend() const;
  41. std::string tag() const;
  42. cv::util::any params() const;
  43. private:
  44. std::shared_ptr<Params<cv::gapi::Generic>> m_priv;
  45. };
  46. GAPI_EXPORTS_W PyParams params(const std::string& tag, const std::string& model_path);
  47. } // namespace onnx
  48. } // namespace gapi
  49. } // namespace cv
  50. #endif // OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP