mirror of
https://github.com/opencv/opencv.git
synced 2025-06-09 18:43:05 +08:00

G-API: Support CUDA & TensoRT Execution Providers for ONNXRT Backend #24059 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [ ] I agree to contribute to the project under Apache 2 License. - [ ] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
66 lines
1.7 KiB
C++
66 lines
1.7 KiB
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level
|
|
// directory of this distribution and at http://opencv.org/license.html.
|
|
|
|
#ifndef OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
|
|
#define OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
|
|
|
|
#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
|
|
#include <opencv2/gapi/infer/onnx.hpp> // Params
|
|
#include "opencv2/gapi/own/exports.hpp" // GAPI_EXPORTS
|
|
#include <opencv2/gapi/util/any.hpp>
|
|
|
|
#include <string>
|
|
|
|
namespace cv {
|
|
namespace gapi {
|
|
namespace onnx {
|
|
|
|
// NB: Used by python wrapper
|
|
// This class can be marked as SIMPLE, because it's implemented as pimpl
|
|
class GAPI_EXPORTS_W_SIMPLE PyParams {
|
|
public:
|
|
GAPI_WRAP
|
|
PyParams() = default;
|
|
|
|
GAPI_WRAP
|
|
PyParams(const std::string& tag, const std::string& model_path);
|
|
|
|
GAPI_WRAP
|
|
PyParams& cfgMeanStd(const std::string &layer_name,
|
|
const cv::Scalar &m,
|
|
const cv::Scalar &s);
|
|
GAPI_WRAP
|
|
PyParams& cfgNormalize(const std::string &layer_name, bool flag);
|
|
|
|
GAPI_WRAP
|
|
PyParams& cfgAddExecutionProvider(ep::OpenVINO ep);
|
|
|
|
GAPI_WRAP
|
|
PyParams& cfgAddExecutionProvider(ep::DirectML ep);
|
|
|
|
GAPI_WRAP
|
|
PyParams& cfgAddExecutionProvider(ep::CUDA ep);
|
|
|
|
GAPI_WRAP
|
|
PyParams& cfgAddExecutionProvider(ep::TensorRT ep);
|
|
|
|
GAPI_WRAP
|
|
PyParams& cfgDisableMemPattern();
|
|
|
|
GBackend backend() const;
|
|
std::string tag() const;
|
|
cv::util::any params() const;
|
|
|
|
private:
|
|
std::shared_ptr<Params<cv::gapi::Generic>> m_priv;
|
|
};
|
|
|
|
GAPI_EXPORTS_W PyParams params(const std::string& tag, const std::string& model_path);
|
|
|
|
} // namespace onnx
|
|
} // namespace gapi
|
|
} // namespace cv
|
|
|
|
#endif // OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
|