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

Merge pull request #28752 from abhishek-gola:net_profiling

Added net profiling support #28752

### 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:
Abhishek Gola
2026-05-14 17:17:38 +05:30
committed by GitHub
parent 851e0196b4
commit 873a4635c6
12 changed files with 361 additions and 2 deletions
+5
View File
@@ -5,6 +5,7 @@
#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/utils/logger.hpp>
#include "common.hpp"
@@ -91,6 +92,8 @@ static bool readStringList( const string& filename, vector<string>& l )
int main(int argc, char** argv)
{
utils::logging::setLogLevel(utils::logging::LOG_LEVEL_INFO);
CommandLineParser parser(argc, argv, keys);
if (!parser.has("@alias") || parser.has("help"))
@@ -150,6 +153,7 @@ int main(int argc, char** argv)
Net net = readNetFromONNX(model, engine);
net.setPreferableBackend(getBackendID(backend));
net.setPreferableTarget(getTargetID(target));
net.setProfilingMode(DNN_PROFILE_SUMMARY);
//! [Read and initialize network]
// Create a window
@@ -229,6 +233,7 @@ int main(int argc, char** argv)
timeRecorder.start();
prob = net.forward();
timeRecorder.stop();
net.printPerfProfile();
//! [Make forward pass]
//! [Get a class with a highest score]