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
+6
View File
@@ -6,6 +6,7 @@
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/utils/logger.hpp>
#include <mutex>
#include <thread>
@@ -161,6 +162,8 @@ private:
int main(int argc, char** argv)
{
utils::logging::setLogLevel(utils::logging::LOG_LEVEL_INFO);
CommandLineParser parser(argc, argv, keys);
string zooFile = parser.get<String>("zoo");
@@ -225,6 +228,7 @@ int main(int argc, char** argv)
int backend = getBackendID(parser.get<String>("backend"));
net.setPreferableBackend(backend);
net.setPreferableTarget(getTargetID(parser.get<String>("target")));
net.setProfilingMode(DNN_PROFILE_SUMMARY);
//![read_net]
// Create a window
@@ -302,6 +306,7 @@ int main(int argc, char** argv)
//![forward]
vector<Mat> outs;
net.forward(outs, net.getUnconnectedOutLayersNames());
net.printPerfProfile();
predictionsQueue.push(outs);
//![forward]
}
@@ -372,6 +377,7 @@ int main(int argc, char** argv)
tickMeter.start();
net.forward(outs, net.getUnconnectedOutLayersNames());
tickMeter.stop();
net.printPerfProfile();
classIds.clear();
confidences.clear();