1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #25791 from ujjayant-kadian:uk/extend-gapi-onnx-params-arbitrary-session-options

Extending G-API onnx::Params to pass arbitrary session options #25791

### 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
This commit is contained in:
Ujjayant Kadian
2024-06-21 12:34:26 +01:00
committed by GitHub
parent 7ef42d7706
commit 5dc1b39e4c
4 changed files with 33 additions and 1 deletions
@@ -57,6 +57,12 @@ cv::gapi::onnx::PyParams::cfgDisableMemPattern() {
return *this;
}
cv::gapi::onnx::PyParams&
cv::gapi::onnx::PyParams::cfgSessionOptions(const std::map<std::string, std::string>& options) {
m_priv->cfgSessionOptions(options);
return *this;
}
cv::gapi::GBackend cv::gapi::onnx::PyParams::backend() const {
return m_priv->backend();
}
@@ -702,6 +702,10 @@ ONNXCompiled::ONNXCompiled(const gapi::onnx::detail::ParamDesc &pp)
cv::gimpl::onnx::addExecutionProvider(&session_options, ep);
}
for (const auto &option : pp.session_options) {
session_options.AddConfigEntry(option.first.c_str(), option.second.c_str());
}
if (pp.disable_mem_pattern) {
session_options.DisableMemPattern();
}