bindings_ov.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. //
  5. // Copyright (C) 2023 Intel Corporation
  6. #ifndef OPENCV_GAPI_INFER_BINDINGS_OV_HPP
  7. #define OPENCV_GAPI_INFER_BINDINGS_OV_HPP
  8. #include <opencv2/gapi/util/any.hpp>
  9. #include "opencv2/gapi/own/exports.hpp" // GAPI_EXPORTS
  10. #include <opencv2/gapi/gkernel.hpp> // GKernelPackage
  11. #include <opencv2/gapi/infer/ov.hpp> // Params
  12. #include <string>
  13. namespace cv {
  14. namespace gapi {
  15. namespace ov {
  16. // NB: Used by python wrapper
  17. // This class can be marked as SIMPLE, because it's implemented as pimpl
  18. class GAPI_EXPORTS_W_SIMPLE PyParams {
  19. public:
  20. GAPI_WRAP
  21. PyParams() = default;
  22. GAPI_WRAP
  23. PyParams(const std::string &tag,
  24. const std::string &model_path,
  25. const std::string &bin_path,
  26. const std::string &device);
  27. GAPI_WRAP
  28. PyParams(const std::string &tag,
  29. const std::string &blob_path,
  30. const std::string &device);
  31. GAPI_WRAP
  32. PyParams& cfgPluginConfig(
  33. const std::map<std::string, std::string> &config);
  34. GAPI_WRAP
  35. PyParams& cfgInputTensorLayout(std::string tensor_layout);
  36. GAPI_WRAP
  37. PyParams& cfgInputTensorLayout(
  38. std::map<std::string, std::string> layout_map);
  39. GAPI_WRAP
  40. PyParams& cfgInputModelLayout(std::string tensor_layout);
  41. GAPI_WRAP
  42. PyParams& cfgInputModelLayout(
  43. std::map<std::string, std::string> layout_map);
  44. GAPI_WRAP
  45. PyParams& cfgOutputTensorLayout(std::string tensor_layout);
  46. GAPI_WRAP
  47. PyParams& cfgOutputTensorLayout(
  48. std::map<std::string, std::string> layout_map);
  49. GAPI_WRAP
  50. PyParams& cfgOutputModelLayout(std::string tensor_layout);
  51. GAPI_WRAP
  52. PyParams& cfgOutputModelLayout(
  53. std::map<std::string, std::string> layout_map);
  54. GAPI_WRAP
  55. PyParams& cfgOutputTensorPrecision(int precision);
  56. GAPI_WRAP
  57. PyParams& cfgOutputTensorPrecision(
  58. std::map<std::string, int> precision_map);
  59. GAPI_WRAP
  60. PyParams& cfgReshape(std::vector<size_t> new_shape);
  61. GAPI_WRAP
  62. PyParams& cfgReshape(
  63. std::map<std::string, std::vector<size_t>> new_shape_map);
  64. GAPI_WRAP
  65. PyParams& cfgNumRequests(const size_t nireq);
  66. GAPI_WRAP
  67. PyParams& cfgMean(std::vector<float> mean_values);
  68. GAPI_WRAP
  69. PyParams& cfgMean(
  70. std::map<std::string, std::vector<float>> mean_map);
  71. GAPI_WRAP
  72. PyParams& cfgScale(std::vector<float> scale_values);
  73. GAPI_WRAP
  74. PyParams& cfgScale(
  75. std::map<std::string, std::vector<float>> scale_map);
  76. GAPI_WRAP
  77. PyParams& cfgResize(int interpolation);
  78. GAPI_WRAP
  79. PyParams& cfgResize(std::map<std::string, int> interpolation);
  80. GBackend backend() const;
  81. std::string tag() const;
  82. cv::util::any params() const;
  83. private:
  84. std::shared_ptr<Params<cv::gapi::Generic>> m_priv;
  85. };
  86. GAPI_EXPORTS_W PyParams params(const std::string &tag,
  87. const std::string &model_path,
  88. const std::string &weights,
  89. const std::string &device);
  90. GAPI_EXPORTS_W PyParams params(const std::string &tag,
  91. const std::string &bin_path,
  92. const std::string &device);
  93. } // namespace ov
  94. } // namespace gapi
  95. } // namespace cv
  96. #endif // OPENCV_GAPI_INFER_BINDINGS_OV_HPP