From 59d1e9413d3c5610ffb37e80c02c5772966fef7d Mon Sep 17 00:00:00 2001 From: jack <136876878@qq.com> Date: Wed, 1 Jul 2020 14:20:45 +0800 Subject: [PATCH] add running time stats in dectector --- deploy/cpp/demo/detector.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deploy/cpp/demo/detector.cpp b/deploy/cpp/demo/detector.cpp index 8104655..07bb766 100644 --- a/deploy/cpp/demo/detector.cpp +++ b/deploy/cpp/demo/detector.cpp @@ -56,7 +56,6 @@ int main(int argc, char** argv) { std::cerr << "--image or --image_list need to be defined" << std::endl; return -1; } - std::cout << "Thread num: " << FLAGS_thread_num << std::endl; // 加载模型 PaddleX::Model model; model.Init(FLAGS_model_dir, @@ -132,9 +131,16 @@ int main(int argc, char** argv) { } } } else { + auto start = system_clock::now(); PaddleX::DetResult result; cv::Mat im = cv::imread(FLAGS_image, 1); model.predict(im, &result); + auto end = system_clock::now(); + auto duration = duration_cast(end - start); + total_running_time_s += static_cast(duration.count()) * + microseconds::period::num / + microseconds::period::den; + // 输出结果目标框 for (int i = 0; i < result.boxes.size(); ++i) { std::cout << "image file: " << FLAGS_image << std::endl; std::cout << ", predict label: " << result.boxes[i].category -- GitLab