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

Merge pull request #26334 from gursimarsingh:dnn_engine_change

Modify DNN Samples to use ENGINE_CLASSIC for Non-Default Back-end or Target #26334

PR resolves #26325 regarding fall-back to ENGINE_CLASSIC if non-default back-end or target is passed by user.
### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Gursimar Singh
2024-11-08 11:28:35 +05:30
committed by GitHub
parent 1ae304bb83
commit 979428d590
9 changed files with 39 additions and 19 deletions
+5 -1
View File
@@ -143,7 +143,11 @@ int main(int argc, char** argv)
}
CV_Assert(!model.empty());
//! [Read and initialize network]
Net net = readNetFromONNX(model);
EngineType engine = ENGINE_AUTO;
if (backend != "default" || target != "cpu"){
engine = ENGINE_CLASSIC;
}
Net net = readNetFromONNX(model, engine);
net.setPreferableBackend(getBackendID(backend));
net.setPreferableTarget(getTargetID(target));
//! [Read and initialize network]