File size: 2,542 Bytes
be94e5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// 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.

#include <opencv2/gapi/infer/bindings_onnx.hpp>

cv::gapi::onnx::PyParams::PyParams(const std::string& tag,
                                   const std::string& model_path)
    : m_priv(std::make_shared<Params<cv::gapi::Generic>>(tag, model_path)) {}

cv::gapi::onnx::PyParams& cv::gapi::onnx::PyParams::cfgMeanStd(const std::string &layer_name,
                                                               const cv::Scalar &m,
                                                               const cv::Scalar &s) {
    m_priv->cfgMeanStdDev(layer_name, m, s);
    return *this;
}

cv::gapi::onnx::PyParams& cv::gapi::onnx::PyParams::cfgNormalize(const std::string &layer_name,
                                                                 bool flag) {
    m_priv->cfgNormalize(layer_name, flag);
    return *this;
}

cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgAddExecutionProvider(cv::gapi::onnx::ep::OpenVINO ep) {
    m_priv->cfgAddExecutionProvider(std::move(ep));
    return *this;
}

cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgAddExecutionProvider(cv::gapi::onnx::ep::DirectML ep) {
    m_priv->cfgAddExecutionProvider(std::move(ep));
    return *this;
}

cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgAddExecutionProvider(cv::gapi::onnx::ep::CoreML ep) {
    m_priv->cfgAddExecutionProvider(std::move(ep));
    return *this;
}

cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgAddExecutionProvider(cv::gapi::onnx::ep::CUDA ep) {
    m_priv->cfgAddExecutionProvider(std::move(ep));
    return *this;
}

cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgAddExecutionProvider(cv::gapi::onnx::ep::TensorRT ep) {
    m_priv->cfgAddExecutionProvider(std::move(ep));
    return *this;
}

cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgDisableMemPattern() {
    m_priv->cfgDisableMemPattern();
    return *this;
}

cv::gapi::GBackend cv::gapi::onnx::PyParams::backend() const {
    return m_priv->backend();
}

std::string cv::gapi::onnx::PyParams::tag() const { return m_priv->tag(); }

cv::util::any cv::gapi::onnx::PyParams::params() const {
    return m_priv->params();
}

cv::gapi::onnx::PyParams cv::gapi::onnx::params(
    const std::string& tag, const std::string& model_path) {
    return {tag, model_path};
}